Message Boards Message Boards

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

Posted 10 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[[1]]; 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[[1]][[2]]; M[[2]] Sum[(M[[k]])^2,
> {k, Length[M]}]
> 
> xi = Table[t1[[i]][[1]], {i, 1, Length[t1]}]; ymax = Max[xi];
> 
> yi = Table[t1[[i]][[2]], {i, 1, Length[t1]}]; Max[yi];
> 
> zi = Table[t1[[i]][[3]], {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:
POSTED BY: jethro holcroft
4 Replies
Posted 10 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 BY: jethro holcroft
Posted 10 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 BY: jethro holcroft
Posted 10 years ago

Hi Jethro,

See the attached notebook. It's in V10.

Kind regards,

David

Edit: Note that the data file needs to be in the same directory as the notebook.

enter image description here

Attachments:
POSTED BY: David Keith
Posted 9 years ago

Oh, the attached file is the answer to the question) Thanks!

POSTED BY: Denis KIss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract