Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

regr2.plot

3D plot of z against x and y, with regression plane fit and display of squared residuals.


Description

3D plot of z against x and y, with regression plane fit and display of squared residuals.

Usage

regr2.plot(x, y, z,
           main.in="put a useful title here",
           resid.plot=FALSE,
           plot.base.plane=TRUE,
           plot.back.planes=TRUE,
           plot.base.points=FALSE,
           eye=NULL,                   ## S-Plus
           theta=0, phi=15, r=sqrt(3), ticktype="detailed", ## R
           ...)

Arguments

x,y,z

See persp.

main.in

main title for plot.

resid.plot

Argument to resid.squares.

plot.base.plane, plot.back.planes, plot.base.points

Should these items be plotted?

eye

S-Plus only. See persp.

theta, phi, r, ticktype

R only. See persp.

...

Other arguments to persp.

Value

"Viewing Transformation" for projecting 3D coordinates (x,y,z) into the 2D plane. See persp for details.

Note

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.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

References

Heiberger, Richard M. and Holland, Burt (2015). Statistical Analysis and Data Display: An Intermediate Course with Examples in R. Second Edition. Springer-Verlag, New York. https://www.springer.com/us/book/9781493921218

Smith, W. and Gonick, L. (1993). The Cartoon Guide to Statistics. HarperCollins.

See Also

Examples

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 S-Plus
           theta=140, phi=35, r=sqrt(15), ## used only in R
           box=is.R(),
           plot.back.planes=FALSE,
           main="Least-squares with two X-variables")

## Not run: 
  demo("regr2", package="HH", ask=FALSE)
  ## run the file manually to see the individual steps.

## End(Not run)

HH

Statistical Analysis and Data Display: Heiberger and Holland

v3.1-43
GPL (>= 2)
Authors
Richard M. Heiberger
Initial release
2020-11-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.