rgl (version 0.100.19)

plot3d.lm: Method for plotting simple linear fit.

Description

This function provides several plots of the result of fitting a simple two-predictor linear model.

Usage

# S3 method for lm
plot3d(x, 
       which = 1, 
       plane.col = "gray", plane.alpha = 0.5,
       sharedMouse = TRUE, ...)

Arguments

x

An object of class "lm" resulting from fitting a two-predictor linear model.

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 plot3d method, to control the appearance of aspects of the plot other than the plane.

Value

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.

Details

Three plots are possible, depending on the value(s) in which:

  1. (default) Show the points and the fitted plane.

  2. Show the residuals and the plane at z = 0.

  3. Show the predicted values on the fitted plane.

Examples

Run this code
# NOT RUN {
ids <- plot3d(lm(mpg ~ wt + qsec, data = mtcars), which = 1:3)
names(ids)
# }

Run the code above in your browser using DataLab