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: