ridge.cv {parcor}R Documentation

Ridge Regression.

Description

This function computes the optimal ridge regression model based on cross-validation.

Usage

ridge.cv(X, y, lambda, scale = TRUE, k = 10, plot.it = FALSE)

Arguments

X matrix of input observations. The rows of X contain the samples, the columns of X contain the observed variables
y vector of responses. The length of y must equal the number of rows of X
lambda Vector of penalty terms.
scale Scale the columns of X? Default is scale=TRUE.
k Number of splits in k-fold cross-validation. Default value is k=10.
plot.it Plot the cross-validation error as a function of lambda? Default is FALSE.

Value

coefficients vector of regression coefficients
lambda.opt optimal value of lambda.

Author(s)

Nicole Kraemer

See Also

ridge.net

Examples

n<-50 # number of observations
p<-10 # number of variables
X<-matrix(rnorm(n*p),ncol=p) 
y<-rnorm(n)
ridge.object<-ridge.cv(X,y,k=5)

[Package parcor version 0.1 Index]