plot3d | R Documentation |
The 3D ridge trace plot displays 3D projections of the covariance ellipsoids for a set of ridge regression estimates indexed by a ridge tuning constant.
The centers of these ellipses show the bias induced for each parameter, and also how the change in the ridge estimate for one parameter is related to changes for other parameters.
The size and shapes of the covariance ellipsoids show directly the effect on precision of the estimates as a function of the ridge tuning constant.
plot3d.ridge
and plot3d.pcaridge
differ only in the defaults
for the variables plotted.
plot3d(x, ...)
## S3 method for class 'pcaridge'
plot3d(x, variables = (p - 2):p, ...)
## S3 method for class 'ridge'
plot3d(
x,
variables = 1:3,
radius = 1,
which.lambda = 1:length(x$lambda),
lwd = 1,
lty = 1,
xlim,
ylim,
zlim,
xlab,
ylab,
zlab,
col = c("black", "red", "darkgreen", "blue", "darkcyan", "magenta", "brown",
"darkgray"),
labels = lambda,
ref = TRUE,
ref.col = gray(0.7),
segments = 40,
shade = TRUE,
shade.alpha = 0.1,
wire = FALSE,
aspect = 1,
add = FALSE,
...
)
x |
A |
... |
Other arguments passed down |
variables |
Predictors in the model to be displayed in the plot: an
integer or character vector of length 3, giving the indices or names of the
variables. Defaults to the first three predictors for |
radius |
Radius of the ellipse-generating circle for the covariance
ellipsoids. The default, |
which.lambda |
A vector of indices used to select the values of
|
lwd, lty |
Line width and line type for the covariance ellipsoids. Recycled as necessary. |
xlim, ylim, zlim |
X, Y, Z limits for the plot, each a vector of length 2. If missing, the range of the covariance ellipsoids is used. |
xlab, ylab, zlab |
Labels for the X, Y, Z variables in the plot. If
missing, the names of the predictors given in |
col |
A numeric or character vector giving the colors used to plot the covariance ellipsoids. Recycled as necessary. |
labels |
A numeric or character vector giving the labels to be drawn at the centers of the covariance ellipsoids. |
ref |
Logical: whether to draw horizontal and vertical reference lines at 0. This is not yet implemented. |
ref.col |
Color of reference lines. |
segments |
Number of line segments used in drawing each dimension of a covariance ellipsoid. |
shade |
a logical scalar or vector, indicating whether the ellipsoids
should be rendered with |
shade.alpha |
a numeric value in the range [0,1], or a vector of such
values, giving the alpha transparency for ellipsoids rendered with
|
wire |
a logical scalar or vector, indicating whether the ellipsoids
should be rendered with |
aspect |
a scalar or vector of length 3, or the character string "iso",
indicating the ratios of the x, y, and z axes of the bounding box. The
default, |
add |
if |
None. Used for its side-effect of plotting
This is an initial implementation. The details and arguments are subject to change.
Michael Friendly
Friendly, M. (2013). The Generalized Ridge Trace Plot: Visualizing Bias and Precision. Journal of Computational and Graphical Statistics, 22(1), 50-68, doi:10.1080/10618600.2012.681237, https://www.datavis.ca/papers/genridge-jcgs.pdf
plot.ridge
, pairs.ridge
,
pca.ridge
lmod <- lm(Employed ~ GNP + Unemployed + Armed.Forces + Population +
Year + GNP.deflator, data=longley)
longley.y <- longley[, "Employed"]
longley.X <- model.matrix(lmod)[,-1]
lambda <- c(0, 0.005, 0.01, 0.02, 0.04, 0.08)
lambdaf <- c("0", ".005", ".01", ".02", ".04", ".08")
lridge <- ridge(longley.y, longley.X, lambda=lambda)
plot3d(lridge, var=c(1,4,5), radius=0.5)
# view in SVD/PCA space
plridge <- pca(lridge)
plot3d(plridge, radius=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.