0
|
15757 Views
|
4 Replies
|
1 Total Likes
View groups...
Share

# How can I find the sum of squared errors in a 3d table?

Posted 9 years ago
 I have found the plane of best fit on a 3d graph, I have put the points on the graph, I now want to sum up the squared errors, I would also like the vertical residual lines to reach the plane, so far I have this: > t = Import["C:\\RegressionExample.xls", "xls"]; tp = t[]; t1 = > Table[tp[[i]], {i, 2, Length[tp]}]; > > Needs["LinearRegression"] fit = Fit[t1, {1, x, y}, {y, x}]; > > RESID = Regress[t1, {1, x, y}, {y, x}, RegressionReport -> > {StandardizedResiduals}]; M = RESID[][]; M[] Sum[(M[[k]])^2, > {k, Length[M]}] > > xi = Table[t1[[i]][], {i, 1, Length[t1]}]; ymax = Max[xi]; > > yi = Table[t1[[i]][], {i, 1, Length[t1]}]; Max[yi]; > > zi = Table[t1[[i]][], {i, 1, Length[t1]}]; xmax = Max[Round[yi]]; > > > > Show[ListPointPlot3D[t1, PlotStyle -> Red , Filling -> Bottom], > Plot3D[fit, {y, 0, ymax}, {x, 0, xmax}]] ` Im sure I have gone wrong somewhere, please help, thanks. Attachments:
4 Replies
Sort By:
Posted 9 years ago
 How much of it to wrap up in manipulate to use a slider? still finding something to be stuck on I guess, really appreciate the help though
Posted 9 years ago
 I would like to thank you, I worked and studied hard and as close as I came I failed, sweat and tears over this problem, thanks a lot.
Posted 9 years ago
 Hi Jethro,See the attached notebook. It's in V10.Kind regards,DavidEdit: Note that the data file needs to be in the same directory as the notebook.  Attachments:
Posted 9 years ago
 Oh, the attached file is the answer to the question) Thanks!