Last data update: 2014.03.03

R: 3D plot of z against x and y, with regression plane fit and...
regr2.plotR Documentation

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.

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".

Author(s)

Richard M. Heiberger <rmh@temple.edu>

References

Heiberger, Richard M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5.

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

See Also

resid.squares, regr1.plot

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")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(HH)
Loading required package: lattice
Loading required package: grid
Loading required package: latticeExtra
Loading required package: RColorBrewer
Loading required package: multcomp
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

    geyser

Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HH/regr2.plot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: regr2.plot
> ### Title: 3D plot of z against x and y, with regression plane fit and
> ###   display of squared residuals.
> ### Aliases: regr2.plot
> ### Keywords: models regression
> 
> ### ** 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")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>