I know it's really simple, but can anyone tell me the formula for a least squares line? I probably won't understand the variables either because I'm particularly clueless. I know it comes out to be y=mx+b, but somehow or another I'm supposed to account for the error of all the data points. If anyone wants to use them, here's some data points that I know the the line of best fit for because I used Matlab.X Y 14 4216 5122 6818 5930 91y=2.95x+3.2
2/17/2006 12:58:24 PM
you in the online course? If its problem4 HW10 then it says to use matlab?and that leads into my questionif i have a table of data in webass and it tells me to put it in matlab, how exactly does one go about doing this? This is what webass says:Use the table below for pasting into M-LAB:X Y5 11.27 17.011 20.311 20.99 15.325 27.317 16.912 18.045 47.723 25.815 19.338 42.9
2/17/2006 1:50:48 PM
i've got exactly the same question....
2/17/2006 7:02:40 PM
2/17/2006 9:24:58 PM
here's some generic code that can help you... however, if you're supposed to use some special packages for ST370, then this won't help you:
x=[0 1 2 3 4 5] ; y=[0 20 60 68 77 110] ; plot(x,y) coefficients=polyfit(x,y,3); newy=polyval(coefficients,x); plot(x,y,'*',x,newy,':')
2/17/2006 9:59:35 PM
http://www.vanderbilt.edu/Engineering/CIS/Sloan/web/es130/statist/mols.htmlYou want this line y=mx+b that predicts behavior for your population. How do we decide how 'bad' any line is at predicting? By looking at how far off the data points are from the predicted value, squaring this "distance" for each point then adding them up. Line with the lowest sum wins.[Edited on February 17, 2006 at 10:42 PM. Reason : sp]
2/17/2006 10:42:28 PM
pimpmaster, you have to create a file in notepad, copy and paste those numbers into the file and save it somewhere on your computer. If for instance you named the file test, and saved it in the directory, c:/Matlab, and you wanted the name of your data set to be statistics, then in Matlab you would type in:addpath c:/Matlabstatistics=readfileIt will then prompt you to type in the names of the variables and you will type them in just as you would want them to appear and then you press enter. You now have access to your data set under the name statistics.
2/19/2006 10:56:12 PM
what kind of file extension would you use, .dat?
2/24/2006 12:49:50 PM