plot3d.lm {rgl} | R Documentation |
This function provides several plots of the result of fitting a simple two-predictor linear model.
## S3 method for class 'lm' plot3d(x, which = 1, plane.col = "gray", plane.alpha = 0.5, sharedMouse = TRUE, ...)
x |
An object of class |
which |
Which plot to show? See Details below. |
plane.col, plane.alpha |
All plots draw a plane; these parameters control its colour and transparency respectively. |
sharedMouse |
If multiple plots are requested, should they share mouse controls, so that they move in sync? |
... |
Other parameters to pass to the default |
Three plots are possible, depending on the value(s) in which
:
(default) Show the points and the fitted plane.
Show the residuals and the plane at z = 0
.
Show the predicted values on the fitted plane.
Called for the side effect of drawing one or more plots.
Invisibly returns a high-level vector of object ids. Names of object ids have the plot number (in drawing order) appended.
This function can only handle fairly simple linear models,
the same ones handled by xyz.coords
: a single
response variable and two predictor variables, e.g.
z ~ x + y
.
Duncan Murdoch
ids <- plot3d(lm(mpg ~ wt + qsec, data = mtcars), which = 1:3) names(ids)