CVDH: Adjusted K-fold Cross-Validation

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

View source: R/CVDH.R

Description

An adjustment to K-fold cross-validation is made to reduce bias.

Usage

1
CVDH(X, y, K = 10, REP = 1)

Arguments

X

training inputs

y

training output

K

size of validation sample

REP

number of replications

Details

Algorithm 6.5 (Davison and Hinkley, p.295) is implemented.

Value

Vector of two components comprising the cross-validation MSE and its sd based on the MSE in each validation sample.

Author(s)

A.I. McLeod and C. Xu

References

Davison, A.C. and Hinkley, D.V. (1997). Bootstrap Methods and their Application. Cambridge University Press.

See Also

bestglm, CVHTF, CVd, LOOCV

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#Example 1. Variability in 10-fold CV with Davison-Hartigan Algorithm.
#Plot the CVs obtained by using 10-fold CV on the best subset
#model of size 2 for the prostate data. We assume the best model is
#the model with the first two inputs and then we compute the CV's
#using 10-fold CV, 100 times. The result is summarized by a boxplot as well 
#as the sd.
NUMSIM<-10
data(zprostate)
train<-(zprostate[zprostate[,10],])[,-10]
X<-train[,1:2]
y<-train[,9]
cvs<-numeric(NUMSIM)
set.seed(123321123)
for (isim in 1:NUMSIM)
    cvs[isim]<-CVDH(X,y,K=10,REP=1)[1]
summary(cvs)

Example output

Loading required package: leaps
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.5845  0.5942  0.6040  0.6055  0.6167  0.6250 

bestglm documentation built on March 26, 2020, 7:25 p.m.