Learn R Programming

chemometrics (version 1.4.4)

ridgeCV: Repeated CV for Ridge regression

Description

Performs repeated cross-validation (CV) to evaluate the result of Ridge regression where the optimal Ridge parameter lambda was chosen on a fast evaluation scheme.

Usage

ridgeCV(formula, data, lambdaopt, repl = 5, segments = 10, 
   segment.type = c("random", "consecutive", "interleaved"), length.seg, 
   trace = FALSE, plot.opt = TRUE, ...)

Value

residuals

matrix of size length(y) x repl with residuals

predicted

matrix of size length(y) x repl with predicted values

SEP

Standard Error of Prediction computed for each column of "residuals"

SEPm

mean SEP value

sMAD

MAD of Prediction computed for each column of "residuals"

sMADm

mean of MAD values

RMSEP

Root MSEP value computed for each column of "residuals"

RMSEPm

mean RMSEP value

Arguments

formula

formula, like y~X, i.e., dependent~response variables

data

data frame to be analyzed

lambdaopt

optimal Ridge parameter lambda

repl

number of replications for the CV

segments

the number of segments to use for CV, or a list with segments (see mvrCv)

segment.type

the type of segments to use. Ignored if 'segments' is a list

length.seg

Positive integer. The length of the segments to use. If specified, it overrides 'segments' unless 'segments' is a list

trace

logical; if 'TRUE', the segment number is printed for each segment

plot.opt

if TRUE a plot will be generated that shows the predicted versus the observed y-values

...

additional plot arguments

Author

Peter Filzmoser <P.Filzmoser@tuwien.ac.at>

Details

Generalized Cross Validation (GCV) is used by the function lm.ridge to get a quick answer for the optimal Ridge parameter. This function should make a careful evaluation once the optimal parameter lambda has been selected. Measures for the prediction quality are computed and optionally plots are shown.

References

K. Varmuza and P. Filzmoser: Introduction to Multivariate Statistical Analysis in Chemometrics. CRC Press, Boca Raton, FL, 2009.

See Also

lm.ridge, plotRidge

Examples

Run this code
data(PAC)
res=ridgeCV(y~X,data=PAC,lambdaopt=4.3,repl=5,segments=5)

Run the code above in your browser using DataLab