The `getCVfolds` function splits n observations into k groups in s different ways to be used for repeated k-fold cross-validations over s repeats. This function is designed for cases where the the response variable is binary.

getCVfolds(y, k = 10, repeats = 50, type = "random")

Arguments

y

A binary vector of length n.

k

An integer giving the number of groups into which n observations need to be split. The default is 10.

repeats

Number of repeats. Default is 50.

type

A character string to specify the type of folds to be obtained. See cvTools::cvFolds for more. The default is "random".

Value

A list object of data frames, each consisting of two columns, where column `k` gives the fold for each permuted observation; column `Ind` gives the index of each observation. Each data frame element of the returned list should be used in a different repeat of k-fold cross-validation.

Examples

## NOT RUN # getCVfolds(sample(c(0, 1), size = 100, replace = T))