Learn R Programming

genridge (version 0.6-3)

plot.ridge: Bivariate Ridge Trace Plots

Description

The bivariate ridge trace plot displays 2D 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 ellipses show directly the effect on precision of the estimates as a function of the ridge tuning constant.

Usage

## S3 method for class 'ridge':
plot(x, variables = 1:2, radius = 1, which.lambda=1:length(x$lambda),
   labels=lambda, pos=3, cex=1.2,
   lwd = 2, lty = 1, xlim, ylim, 
   col = c("black", "red", "darkgreen", "blue", "darkcyan", "magenta", "brown", "darkgray"), 
   center.pch = 16, center.cex = 1.5, fill = FALSE, fill.alpha = 0.3, ref=TRUE, ref.col=gray(.70), ...)

## S3 method for class 'pcaridge':
plot(x, variables = (p-1):p, labels=NULL, ...)

Arguments

Value

None. Used for its side effect of plotting.

References

Friendly, M. (2012). The Generalized Ridge Trace Plot: Visualizing Bias and Precision. In press, Journal of Computational and Graphical Statistics, 21.

See Also

ridge for details on ridge regression as implemented here pairs.ridge, traceplot, biplot.pcaridge and plot3d.ridge for other plotting methods

Examples

Run this code
longley.y <- longley[, "Employed"]
longley.X <- data.matrix(longley[, c(2:6,1)])

lambda <- c(0, 0.005, 0.01, 0.02, 0.04, 0.08)
lambdaf <- c("", ".005", ".01", ".02", ".04", ".08")
lridge <- ridge(longley.y, longley.X, lambda=lambda)

op <- par(mfrow=c(2,2), mar=c(4, 4, 1, 1)+ 0.1)
for (i in 2:5) {
	plot.ridge(lridge, variables=c(1,i), radius=0.5, cex.lab=1.5)
	text(lridge$coef[1,1], lridge$coef[1,i], expression(~widehat(beta)^OLS), cex=1.5, pos=4, offset=.1)
	if (i==2) text(lridge$coef[-1,1:2], lambdaf[-1], pos=3, cex=1.25)
}
par(op)

if (require("ElemStatLearn")) {
	py <- prostate[, "lpsa"]
	pX <- data.matrix(prostate[, 1:8])
	pridge <- ridge(py, pX, df=8:1)
	
	plot(pridge)
	plot(pridge, fill=c(TRUE, rep(FALSE,7)))
}

Run the code above in your browser using DataLab