ridgeCV: Repeated CV for Ridge regression

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ridgeCV.R

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

1
2
3
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 <[email protected]>

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

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

chemometrics documentation built on May 29, 2017, 10:42 a.m.