plot3d.lm {rgl} | R Documentation

## 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 class '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.

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

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

### Note

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

### Author(s)

Duncan Murdoch

### Examples

    ids <- plot3d(lm(mpg ~ wt + qsec, data = mtcars), which = 1:3)
    names(ids)

[Package rgl version 0.100.19 Index]