# plot.regvec3d

0th

Percentile

##### Plot method for regvec3d objects

The plot method for regvec3d objects uses the low-level graphics tools in this package to draw 3D and 3D vector diagrams reflecting the partial and marginal relations of y to x1 and x2 in a bivariate multiple linear regression model, lm(y ~ x1 + x2).

The summary method prints the vectors and their vector lengths, followed by the summary for the model.

##### Usage
# S3 method for regvec3d
plot(x, y, dimension = 3, col = c("black", "red",
"blue", "brown", "lightgray"), col.plane = "gray", cex.lab = 1.2,
show.base = 2, show.marginal = FALSE, show.hplane = TRUE,
show.angles = TRUE, error.sphere = c("none", "e", "y.hat"),
scale.error.sphere = x\$scale, level.error.sphere = 0.95,
grid = FALSE, add = FALSE, ...)# S3 method for regvec3d
summary(object, ...)# S3 method for regvec3d
print(x, ...)
##### Arguments
x

A “regvec3d” object

y

Ignored; only included for compatibility with the S3 generic

dimension

Number of dimensions to plot: 3 (default) or 2

col

A vector of 5 colors. col[1] is used for the y and residual (e) vectors, and for x1 and x2; col[2] is used for the vectors y -> yhat and y -> e; col[3] is used for the vectors yhat -> b1 and yhat -> b2;

col.plane

Color of the base plane in a 3D plot or axes in a 2D plot

cex.lab

character expansion applied to vector labels. May be a number or numeric vector corresponding to the the rows of X, recycled as necessary.

show.base

If show.base > 0, draws the base plane in a 3D plot; if show.base > 1, the plane is drawn thicker

show.marginal

If TRUE also draws lines showing the marginal relations of y on x1 and on x2

show.hplane

If TRUE, draws the plane defined by y, yhat and the origin in the 3D

show.angles

If TRUE, draw and label the angle between the x1 and x2 and between y and yhat, corresponding respectively to the correlation between the xs and the multiple correlation

error.sphere

Plot a sphere (or in 2D, a circle) of radius proportional to the length of the residual vector, centered either at the origin ("e") or at the fitted-values vector ("y.hat"; the default is "none".)

scale.error.sphere

Whether to scale the error sphere if error.sphere="y.hat"; defaults to TRUE if the vectors representing the variables are scaled, in which case the oblique projections of the error spheres can represent confidence intervals for the coefficients; otherwise defaults to FALSE.

level.error.sphere

The confidence level for the error sphere, applied if scale.error.sphere=TRUE.

grid

If TRUE, draws a light grid on the base plane

If TRUE, add to the current plot; otherwise start a new rgl or plot window

...

Parameters passed down to functions [unused now]

object

A regvec3d object for the summary method

##### Details

A 3D diagram shows the vector y and the plane formed by the predictors, x1 and x2, where all variables are represented in deviation form, so that the intercept need not be included.

A 2D diagram, using the first two columns of the result, can be used to show the projection of the space in the x1, x2 plane.

The drawing functions vectors and link{vectors3d} used by the plot.regvec3d method only work reasonably well if the variables are shown on commensurate scales, i.e., with either scale=TRUE or normalize=TRUE.

None

##### References

Fox, J. (2016). Applied Regression Analysis and Generalized Linear Models, 3rd ed., Sage, Chapter 10.

regvec3d, vectors3d, vectors

Other vector diagrams: Proj, arc, arrows3d, circle3d, corner, pointOnLine, regvec3d, vectors3d, vectors

##### Aliases
• plot.regvec3d
• summary.regvec3d
• print.regvec3d
##### Examples
# NOT RUN {
if (require(carData)) {
data("Duncan", package="carData")
dunc.reg <- regvec3d(prestige ~ income + education, data=Duncan)
plot(dunc.reg)
plot(dunc.reg, dimension=2)
plot(dunc.reg, error.sphere="e")
summary(dunc.reg)