Learn R Programming

DiceEval (version 1.4)

testCrossValidation: Test the robustess of the cross-validation procedure

Description

This function calculates the estimated K-fold cross-validation for different values of K.

Usage

testCrossValidation(model,Kfold=c(2,5,10,20,30,40,dim(model$data$X)[1]),N=10)

Arguments

model

a fitted model from modelFit

Kfold

a vector containing the values to test (default corresponds to 2,5,10,20,30,40 and the number of observations for leave-one-out procedure)

N

an integer given the number of times the K-fold cross-validation is performed for each value of K

Value

a matrix of all the values obtained by K-fold cross-validation

See Also

crossValidation

Examples

Run this code
# NOT RUN {
rm(list=ls())
# A 2D example
Branin <- function(x1,x2) {
  x1 <- x1*15-5   
  x2 <- x2*15
  (x2 - 5/(4*pi^2)*(x1^2) + 5/pi*x1 - 6)^2 + 10*(1 - 1/(8*pi))*cos(x1) + 10
}
# a 2D uniform design and the value of the response at these points
n <- 50
X <- matrix(runif(n*2),ncol=2,nrow=n)
Y <- Branin(X[,1],X[,2])

mod <- modelFit(X,Y,type="Linear",formula=formulaLm(X,Y))
out <- testCrossValidation(mod,N=20)
# }

Run the code above in your browser using DataLab