Learn R Programming

genridge (version 0.6-2)

ridge: Ridge Regression Estimates

Description

The function ridge fits linear models by ridge regression, returning an object of class ridge designed to be used with the plotting methods in this package.

Usage

ridge(y, ...)

## S3 method for class 'default':
ridge(y, X, lambda = 0, df, svd = TRUE, ...)

## S3 method for class 'formula':
ridge(formula, data, lambda = 0, df, svd = TRUE, ...)

## S3 method for class 'ridge':
print(x, digits = max(5, getOption("digits") - 5), ...)

## S3 method for class 'ridge':
coef(object, ...)

## S3 method for class 'ridge':
vcov(object, ...)

Arguments

Value

A list with the following components:lambdaThe vector of ridge constantsdfThe vector of effective degrees of freedom corresponding to lambdacoefThe matrix of estimated ridge regression coefficientsscalesscalings used on the X matrixkHKBHKB estimate of the ridge constantkLWL-W estimate of the ridge constantGCVvector of GCV valueskGCVvalue of lambda with the minimum GCVIf svd==TRUE, the following are also included:svd.DSingular values of the svd of the scaled X matrixsvd.ULeft singular vectors of the svd of the scaled X matrixsvd.VRight singular vectors of the svd of the scaled X matrix

Details

Ridge regression shrinkage can be parameterized in several ways. If a vector of lambda values is supplied, these are used directly in the ridge regression computations. Otherwise, if a vector df is supplied the equivalent values of lambda. In either case, both lambda and df are returned in the ridge object.

References

Hoerl, A. E., Kennard, R. W., and Baldwin, K. F. (1975), "Ridge Regression: Some Simulations," Communications in Statistics, 4, 105-123. Lawless, J.F., and Wang, P. (1976), "A Simulation Study of Ridge and Other Regression Estimators," Communications in Statistics, 5, 307-323.

See Also

lm.ridge, simple.ridge for other implementations of ridge regression plot.ridge, pairs.ridge, traceplot for plotting methods precision.ridge

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)
lridge <- ridge(longley.y, longley.X, lambda=lambda)
coef(lridge)

if (require("ElemStatLearn")) {
	py <- prostate[, "lpsa"]
	pX <- data.matrix(prostate[, 1:8])
	pridge <- ridge(py, pX, df=8:1)
	pridge
	
	plot(pridge)
	pairs(pridge)
	traceplot(pridge)
	traceplot(pridge, X="df")
}

Run the code above in your browser using DataLab