Learn R Programming

WilcoxCV (version 1.0-2)

generate.cv: Generating groups for cross-validation

Description

The function generate.cv generates randomly m groups for m-fold cross-validation.

Usage

generate.cv(n,m)

Arguments

n
The total number of observations in the data set.
m
The desired number of groups.

Value

A m x ceiling(n/m) matrix giving the indices of the observations included in each group. The i-th row gives the indices of observations included in the i-th group. If the m groups are not perfectly equally sized, the last column includes one or several zero(s).

Details

Leave-one-out cross-validation is a special case of cross-validation, with m=n.

References

A. L. Boulesteix (2007). WilcoxCV: an R package for fast variable selection in cross-validation. Bioinformatics 23:1702-1704.

See Also

generate.split,wilcox.split,wilcox.selection.split

Examples

Run this code
# load WilcoxCV library
library(WilcoxCV)

# Generate 10 groups for a data set of size 95.
my.cv<-generate.cv(n=95,m=10)

Run the code above in your browser using DataLab