Message Boards Message Boards

GROUPS:

Why are the plot points and residual lines not showing?

Posted 9 years ago
7264 Views
|
2 Replies
|
0 Total Likes
|

t = Import[ "http://www.doc.gold.ac.uk//~ma302jh//RegressionExample.xls"];

tp = t[[1]];
t1 = Table[tp[[i]], {i, 2, Length[tp]}];
xcol = Table[t1[[i]][[1]], {i, 1, Length[t1]}];
ycol = Table[t1[[i]][[2]], {i, 1, Length[t1]}];
zcol = Table[t1[[i]][[3]], {i, 1, Length[t1]}];


Clear[DefineRSS];
DefineRSS[a_?NumericQ, b_?NumericQ, 
  c_?NumericQ] := (rss = Total[((zcol - a*xcol + b*ycol + c)^2)];
  (a*x) + (b*y) + c)


Manipulate[
 With[{plane = DefineRSS[a, b, c]}, 
  Show[Plot3D[plane, {x, -10, 10}, {y, -10, 10}, 
    AxesLabel -> {X, Y, Z}, PlotLabel -> rss], 
   Graphics3D[{Red, PointSize[Medium], 
     Point[Transpose[{xcol, ycol, zcol}]], 
     Line[Transpose[{{xcol, ycol, zcol}, {xcol, ycol, 
         plane /. Thread[{x, y} -> {xcol, ycol}]}}, {2, 3, 1}]]}], 
   PlotRange -> {{-11, 11}, {-11, 11}, {-50, 50}}]], {a, -5, 
  5}, {b, -5, 5}, {c, -5, 5}]
POSTED BY: jethro holcroft
2 Replies

I see you're a fan of recursion

POSTED BY: jethro holcroft
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