3D plot of z against x and y, with regression plane fit and display of squared residuals.
1 2 3 4 5 6 7 8 9 
x,y,z 
See

main.in 

resid.plot 
Argument to 
plot.base.plane, plot.back.planes, plot.base.points 
Should these items be plotted? 
eye 
SPlus only. See

theta, phi, r, ticktype 
R only. See

... 
Other arguments to 
"Viewing Transformation" for projecting 3D coordinates (x,y,z)
into the 2D plane. See persp
for details.
This plot is designed as a pedagogical example for introductory
courses. When resid.plot=="square"
, then we actually see the
set of squares for which the sum of their areas is minimized by the
method of "least squares". The demo called in the examples section
shows the geometry of regression coefficients, the change in predicted
y when x1 is changed one unit holding all other x variables constant.
Richard M. Heiberger <rmh@temple.edu>
Heiberger, Richard M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in SPlus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0387402705.
Smith, W. and Gonick, L. (1993). The Cartoon Guide to Statistics. HarperCollins.
resid.squares
, regr1.plot
, persp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  data(fat)
regr2.plot(fat[,"abdomin"], xlab="abdomin",
fat[,"biceps"], ylab="biceps",
fat[,"bodyfat"], zlab="bodyfat",
resid.plot="square",
eye=c(335.5, 115.65, 171.9), ## used only in SPlus
theta=140, phi=35, r=sqrt(15), ## used only in R
box=is.R(),
plot.back.planes=FALSE,
main="Leastsquares with two Xvariables")
## Not run:
demo("regr2", package="HH", ask=FALSE)
## run the file manually to see the individual steps.
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.