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
intercept |
cross-validation optimal intercept |
coefficients |
cross-validation optimal regression coefficients |
lambda.opt |
optimal value of lambda . |
Author(s)
Nicole Kraemer
See Also
ridge.net
Examples
n<-100 # number of observations
p<-60 # number of variables
X<-matrix(rnorm(n*p),ncol=p)
y<-rnorm(n)
ridge.object<-ridge.cv(X,y)
[Package
parcor version 0.2-2
Index]