CVfolds: Creates (repeated) cross-validation folds

View source: R/MultiLambdaCVfun.R

CVfoldsR Documentation

Creates (repeated) cross-validation folds

Description

Creates (repeated) cross-validation folds for samples

Usage

CVfolds(Y, model = NULL, balance = TRUE, kfold = 10, fixedfolds = TRUE, nrepeat = 1)

Arguments

Y

Response vector: numeric, binary, factor or survival.

model

Character. Any of c("linear", "logistic", "cox"). Is inferred from Y when NULL.

balance

Boolean. Should the splits be balanced in terms of response labels?

kfold

Integer. Desired fold.

fixedfolds

Boolean. Should fixed splits be used for reproducibility?

nrepeat

Numeric. Number of repeats.

Details

Creates (repeated), possibly balanced, splits of the samples. Computing time will often largely depend on on kfold*nrepeat, the number of training-test splits evaluated.

Value

List object with kfold*nrepeat elements containing the sample indices of the left-out samples per split.

See Also

A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4

Examples

data(dataXXmirmeth)
resp <- dataXXmirmeth[[1]]
leftout <- CVfolds(Y=resp,kfold=10,nrepeat=3,fixedfolds = TRUE)

multiridge documentation built on June 13, 2022, 5:07 p.m.