k-Fold Crossvalidation for a mogavs model

Description

Performs k-fold CV for a model of class mogavs via the cvTools package.

Usage

1
cv.mogavs(mogavs, nvar, data, y_ind, K = 10, R = 1, order = FALSE)

Arguments

mogavs

A model of class mogavs.

nvar

The number of variables for which you want to run k-fold CV.

data

Used data set.

y_ind

The column number for the y-variable in the dataset.

K

Number of folds in the cross-validation, default K=10.

R

Number of repeats for the CV, default R=1.

order

Logical, whether the result should be sorted by the column CVerror.

Details

Perform k-fold cross-validation for all the linear models with nvar number of variables, which have been tried during the course of the genetic algorithm.

Value

A data frame with the following columns:

archInd

The row index of the linear model in the archiveSet of the mogavs model.

formula

The formula of the linear model as a character string.

CVerror

The root mean square error of the model.

CVse

The standard error of the model across the R runs of the cross-validation. NA if R=1.

Author(s)

Tommi Pajala <tommi.pajala@aalto.fi>

See Also

mogavsToLinear

Examples

1
2
3
data(sampleData)
mod<-mogavs(y~.,data=sampleData,maxGenerations=20)
cv.mogavs(mod,nvar=3,data=sampleData,y_ind=1,K=10,R=1,order=FALSE)