kfold.cv: Perform k-fold cross-validation of a model.

Description Usage Arguments Value

Description

Perform k-fold cross-validation of a model.

Usage

1
2
kfold.cv(data, model.Rfunc, model.Rfunc.args, predict.Rfunc, predict.Rfunc.args,
  k.fold = 5, cv.iter = 50, strata, max.iter = 500)

Arguments

data

the CV data

model.Rfunc

Name of the model function.

model.Rfunc.args

List of input arguments to model.Rfunc.

predict.Rfunc

Name of the prediction function, which takes the prediction rule returned by model.Rfunc along with any input data (not necessarily the input data to kfold.cv) and returns a TRUE-FALSE predictionvector specifying the positive and negative classes for the data.

predict.Rfunc.args

List containing input arguments to predict.Rfunc, except for data and predict.rule.

k.fold

Number of folds of the cross-validation.

cv.iter

Number of iterations of the cross-validation. If model.Rfunc returns an error at any of the k.fold calls, the current iteration is aborted. Iterations are repeated until cv.iter successful iterations have occurred.

strata

Stratification vector of length the number of rows of data, usually corresponding to the vector of events.

max.iter

Function stops after max.iter iterations even if cv.iter successful iterations have not occurred.

Value

List of length 2 with the following fields:

cv.data - List of length cv.iter. Entry i contains the output of predict.Rfunc at the ith iteration.

sig.list - list of length cv.iter * k.fold, whose entries are the prediction.rules (signatures) returned by model.Rfunc at each k.fold iteration.


SubgrpID documentation built on May 2, 2019, 8:02 a.m.