Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Re: linear regression' topicStudent Support Forum > General > Archives > "Re: linear regression"

Help | Reply To Topic
Author Comment/Response
George Marrash
05/07/97 12:27pm

Reply to message #300 from David Belisle: > Reply to message #198
from Roger J. Brown: > > Reply to message #180 from gregory b buck:
> > > I'm having a problem getting Math 3.0 to conduct a linear regression
on a set of unrelated points, graph the best fit line and the points
together. Can anyone give me the ACTUAL COMMAND STRINGS required to
do this, starting with the best way to input the coordinates. Thank
you. > > > > Greg > > > > I am afraid I don't have your answer, but
there are so few clues on how to use Mathematica for statistics, I
thought you might know of a book on statistics using mathematica.
I have the one for Linear Algebra and it is excellent. If you hear
of one on stat, please let me know. > > > > Thanks > > > > RJB > >
> If all you want to do is fit data, you can use the Fit[pts,{1,x},x]
command. This will return the equation of a line (for higher orders,
include the terms, ie replace {1,x} with {1,x,x^2} for a quadratic.
To assign this as a function, type f[x_]= in front of it. Then plot
the function (a=Plot[f[x],{x,x1,x2}]), plot the points (b=ListPlot[pts]),
and then show them together (Show[a,b]). This creates three plots.
To only show one, include DisplayFunction->Identity in the plot commands
(b=ListPlot[pts,DisplayFunction->Identity]), and then you must also
include DisplayFunction->$DisplayFunction in the Show command (Show[a,b],DisplayFunction->$DisplayFunction).
To get the regression output (ss, dof ...) and the ANOVA output, use
the LinearRegression Package (<<Statistics`LinearRegression`) by typing
Regress instead of Fit. If you do this, just copy the regression equation
generated instead of trying making the output a function. I hope this
answers your question, If not, or there are any questions, feel free
to mail me. > > Cheers, > > Dave > If you go to http://www.mccallie.chattanooga.tn.us/george/physics/thin/thin.html
you will find a notebook where I did a linear regression (actually
the html output) I am sure that there are better ways to do the task,
but that is how I did it. if you want i can email you the notebook
hope this helps regards george


URL: ,
Help | Reply To Topic