generate.learningsets {MAclinical} | R Documentation |
This function generates a design matrix giving the indices of observations forming the learning data set for several iterations.
generate.learningsets(n,method,fold=NULL,niter=NULL,nlearn=NULL)
n |
The total number of observations in the available data set. |
method |
One of "LOOCV" (leave-one-out cross-validation),"CV" (cross-validation),"MCCV" (Monte-Carlo cross-validation, also called subsampling),"bootstrap" (bootstrap sampling - with replacement). |
fold |
Gives the number of CV-groups. Used only when method="CV" . |
niter |
Number of iterations. |
nlearn |
Number of observations in the learning sets. Used only for method="MCCV" and method="bootstrap" . When method="bootstrap" , the default is nlearn=n . |
method="CV"
, niter
gives the number of times
the whole CV-procedure is repeated. The output matrix has then fold
xniter
rows. When method="MCCV"
or method="bootstrap"
, niter
is simply the number of considered
learning sets.
method="CV",fold=n
is equivalent to method="LOOCV"
.
A matrix giving the indices (from 1 to n) of the observations included in the learning sets.
Each row corresponds to a learning set. The order of the columns is not important. The number of rows
is equal to n
when method="LOOCV"
, niter
when method="MCCV"
or method="bootstrap"
, fold
when method="CV"
and niter
is null, and fold
x niter
when method="CV"
and niter
is non-null.
Anne-Laure Boulesteix (http://www.slcmsr.net/boulesteix)
Boulesteix AL, Porzelius C, Daumer M, 2008. Microarray-based classification and clinical predictors: On combined classifiers and additional predictive value. Bioinformatics 24:1698-1706.
testclass
.
# load MAclinical library # library(MAclinical) # LOOCV generate.learningsets(n=40,method="LOOCV") # CV generate.learningsets(n=40,method="CV",fold=5) generate.learningsets(n=40,method="CV",fold=5,niter=3) # MCCV generate.learningsets(n=40,method="MCCV",niter=3,nlearn=30) # bootstrap generate.learningsets(n=40,method="bootstrap",niter=3)