ridgeCV {chemometrics}R Documentation

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, ...)

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

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.

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

Author(s)

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

References

K. Varmuza and P. Filzmoser: Introduction to Multivariate Statistical Analysis in Chemometrics. CRC Press. To appear.

See Also

lm.ridge, plotRidge

Examples

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

[Package chemometrics version 0.4 Index]