Message Boards Message Boards

volunteered to help a lecturer develop a multiple linear regres visual aid

Posted 10 years ago

And feeling over my head, these are the requirements

Multiple Regression animation: specifications

I would like to be able to:

  1. input a number of triples of numbers (X, Y, Z) representing points in 3-D space, and for the points to appear as dots in a display on the screen.

  2. input a triple of numbers representing intercept, slope on the X-Z plane, and slope on the X-Y plane, and for the corresponding plane to appear in the display, as visible but transparent (so you can see the points through it). The two slopes should appear as lines on the display, where the plane cuts the X-Z, Y-Z planes.

  3. alter the parameters of the plane (intercept, etc) by simple operations: perhaps mouse click and move on sliders on the screen.

  4. rotate the whole display in 3-D.

  5. display the sum of squares of the vertical distances of the points from the plane, in order to show that a unique position of the plane gives a minimal value for this (the regression plane of best fit).

  6. display the residuals, ie lines joining the points to the nearest point (vertically) on the plane.

Now by following tutorials on mathematica I feel as though the functions exist and I can give up trying to understand the formulas and constentrate on the GUI the lecturer asks for but I cant seem to find functions to the lectureers specifications, is mathematica capable of input boxes and the like?

I also been looking at multiple linear regression on rosetta code, what actual program language would you recomend to do this task with a gui etc instead if you know of any? I actually came from a programing background thinking I could help.

POSTED BY: jethro holcroft
7 Replies

All of what you are asking about is completely doable in mathematica.

The "easiest" way for someone new to Mathematica to create a user interface is to make use of the function Manipulate:

With regard to 3D graphics' ability to rotate, this is automatic: all 3D graphics can be rotated by clicking on the graphic and moving the mouse.

However, given that you have not done any of this before--and suspecting that you have a deadline--it'd be prudent to seek out someone in your department who has some experience doing these things.

POSTED BY: David Reiss
Posted 10 years ago

Good to know, and , the uni has no knowledge of mathematica anywhere, thats why they are outsourcing from their students xD

Is it possible to get data on each point on click?

What about the transparent leading lines?

POSTED BY: jethro holcroft

You could have a point show a ToolTip when the mouse hovers over it.

Transparency can be handled using the Opacity directive.

Addressing your problem would generally be best done by creating a custom graphics using Graphics3D rather than making use of prepackaged functions like ListPointPlot3D since you are combining a variety of graphics types: Points, Lines, etc...

Here is a random example of the sort of thing that can be done:

data = Flatten[
   Table[Tooltip[Point[#], #] &@{r Cos[t], r Sin[t], Sinc[r]}, {r, 0, 
     10, 0.5}, {t, 0, 2 Pi, 0.1}], 1];

Graphics3D[{data, Opacity[.5], 
  HalfPlane[{{0, 0, 0}, {1, 0, 0}}, {0, 1, 1}]}, 
 BoxRatios -> {1, 1, 0.4`}, ImageSize -> 500]
POSTED BY: David Reiss
Posted 10 years ago

That's beautiful thank you, I had no idea it could be so simple, I was so close to coding this from scratch in java. Now I just need to learn linear regression so I know how to apply the plain and lines of best fit, and some GUI things to dress it all up.

POSTED BY: jethro holcroft
Posted 10 years ago

i need little danglies to the plain from the plot points, please see this image

enter image description here

is this possible?

POSTED BY: jethro holcroft

The image itself is somewhat indistinct. Since you are creating a Graphics3D object from scratch, simply using Line and Point graphics directives will allow you to create line segments and dots at the ends of those segments as needed.

If you were using, for example , the built-in ListPointPlot funciton then the Filling option would give you what you want.

POSTED BY: David Reiss
Posted 10 years ago

Im struggling with the least squares method, I settled for fit however its not the actuall RSS is it :/ am I doing something that is hardly ever done?

POSTED BY: jethro holcroft
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract