cv.msda | R Documentation |
Does k-fold cross-validation for msda, returns a value for lambda
.
cv.msda(x, y, nfolds = 5, lambda = NULL, lambda.opt = "min", ...)
x |
matrix of predictors, of dimension N*p; each row is an observation vector. |
y |
response variable. This argument should be a factor for classification. |
nfolds |
number of folds - default is 5. Although |
lambda |
optional user-supplied lambda sequence; default is
|
lambda.opt |
If choose |
... |
other arguments that can be passed to msda. |
The function runs msda
nfolds
+1 times; the
first to get the lambda
sequence, and then the remainder to
compute the fit with each of the folds omitted. The average error and standard deviation over the folds are computed.
an object of class cv.msda
is returned, which is a
list with the ingredients of the cross-validation fit.
lambda |
the values of |
cvm |
the mean cross-validated error - a vector of length
|
cvsd |
estimate of standard error of |
lambda.min |
the optimal value of |
lambda.1se |
the largest value of |
msda.fit |
a fitted |
Qing Mai <mai@stat.fsu.edu>, Yi Yang <yi.yang6@mcgill.ca>, Hui Zou <hzou@stat.umn.edu>
Maintainer: Yi Yang <yi.yang6@mcgill.ca>
Mai, Q.*, Yang, Y.*, and Zou, H. (2014), "Multiclass Sparse Discriminant Analysis." Submitted to Journal of the American Statistical Association. (* co-first author)
URL: https://github.com/emeryyi/msda
msda
data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj.cv<-cv.msda(x=x,y=y,nfolds=5,lambda.opt="max") lambda.min<-obj.cv$lambda.min id.min<-which(obj.cv$lambda==lambda.min) pred<-predict(obj.cv$msda.fit,x)[,id.min]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.