Description Usage Arguments Details Value Author(s) References See Also Examples
A function that does RDA crossvalidation analysis on the training data set.
1 2 
fit 
An 
x 
The training data set as used in the 
y 
The class labels of the training samples (columns) in "x" as
used in 
prior 
A numerical vector that gives the prior proportion of each
class. Its length should be equal to the number of classes. By default,
the function uses the one coming along with the 
alpha 
A numerical vector of the regularization values for alpha.
By default, the function uses the one coming along with the 
delta 
A numerical vector of the threshold values for delta.
By default, the function uses the one coming along with the 
nfold 
An integer number to specify the number of folds in
the crossvalidation analysis. This option is overwritten when the

folds 
A list that provides the folds used in the crossvalidation analysis. Each component of the list is an integer vector of the sample indices. See examples below for more details. 
trace 
A logical flag indicating whether the intermediate steps should be printed. 
rda.cv
does the RDAbased crossvalidation on the training data
set.
The rda.cv
function will return an object of class rdacv
with the following list of components:
alpha 
The vector of the regularization values for alpha used in the crossvalidation. 
delta 
The vector of the threshold values for delta used in the crossvalidation. 
prior 
The vector of the prior proportion of each class used in the crossvalidation. 
nfold 
The number of folds used in the crossvalidation. 
folds 
The folds used in the crossvalidation. 
yhat.new 
The 3dim array of the predicted class labels of the training samples for each combination (alpha, delta). The first index corresponds to the alpha values while the second index corresponds to the delta values. The third index is the predicted class labels for the corresponding samples. 
err 
The training error matrix from crossvalidation. The rows correspond to the alpha values while the columns correspond to the delta values. It is automatically generated by the function. 
cv.err 
The test error (or crossvalidation error) matrix. The rows correspond to the alpha values while the columns correspond to the delta values. 
ngene 
The matrix of the number of shrunken genes. The rows correspond to the alpha values while the columns correspond to the delta values. Note: the number of shrunken genes is based on the average result from crossvalidation. 
reg 
The type of regularization used in crossvalidation. 
n 
The sample size of the training data set. 
Yaqian Guo, Trevor Hastie and Robert Tibshirani
Guo, Y. et al. (2004) Regularized Discriminant Analysis and Its Application in Microarrays, Technical Report, Department of Statistics, Stanford University.
Also see rda
and predict.rda
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  data(colon)
colon.x < t(colon.x)
fit < rda(colon.x, colon.y)
fit.cv < rda.cv(fit, x=colon.x, y=colon.y)
## to use the customized folds in crossvalidation,
## for example, 6fold with 11, 11, 10, 10, 10, 10 samples
## in the respective folds, you can do the follows:
index < sample(1:62, 62)
folds < list()
folds[[1]] < index[1:11]
folds[[2]] < index[12:22]
folds[[3]] < index[23:32]
folds[[4]] < index[33:42]
folds[[5]] < index[43:52]
folds[[6]] < index[53:62]
fit.cv < rda.cv(fit, colon.x, colon.y, folds=folds)

Fold 1 :
Fold 2 :
Fold 3 :
Fold 4 :
Fold 5 :
Fold 6 :
Fold 7 :
Fold 8 :
Fold 9 :
Fold 10 :
Fold 1 :
Fold 2 :
Fold 3 :
Fold 4 :
Fold 5 :
Fold 6 :
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.