cv.msda {TULIP} | R Documentation |
Cross-validation for DSDA/MSDA through function msda
Description
Performs K-fold cross validation for msda
and returns the best tuning parameter \lambda
in the user-specified or automatically generated choices.
Usage
cv.msda(x, y, model = NULL, nfolds = 5, lambda = NULL,
lambda.opt = "min", ...)
Arguments
x |
Input matrix of predictors. |
y |
Class label. For |
model |
Method type. The |
nfolds |
Number of folds. Default value is 5. Although |
lambda |
User-specified |
lambda.opt |
The optimal criteria when multiple elements in |
... |
other arguments that can be passed to |
Details
The function cv.msda
runs function msda
nfolds+1
times. The first one fits model on all data. If lambda
is specified, it will check if all lambda
satisfies the constraints of dfmax
and pmax
in msda
. If not, a lambda
sequence will be generated according to lambda.factor
in msda
. Then the rest nfolds
many replicates will fit model on nfolds-1
many folds data and predict on the omitted fold, repectively. Return the lambda
with minimum average cross validation error and the largest lambda
within one standard error of the minimum.
Similar as msda
, user can specify which method to use by inputing argument model
. Without specification, the function can automatically decide the method by number of classes and variables.
Value
An object of class cv.dsda
or cv.msda.original
or cv.msda.modified
is returned, which is a
list with the ingredients of the cross-validation fit.
lambda |
The actual |
cvm |
The mean of cross validation errors for each |
cvsd |
The standard error of cross validaiton errors for each |
lambda.min |
The |
lambda.1se |
The largest value of |
model.fit |
A fitted |
Author(s)
Yuqing Pan, Qing Mai, Xin Zhang
References
Mai, Q., Zou, H. and Yuan, M. (2012), "A direct approach to sparse discriminant analysis in ultra-high dimensions." Biometrica, 99, 29-42.
Mai, Q., Yang, Y., and Zou, H. (2017), "Multiclass sparse discriminant analysis." Statistica Sinica, in press.
URL: https://github.com/emeryyi/msda
See Also
Examples
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
obj <- msda(x=x, y=y, lambda=lambda.min)
pred <- predict(obj,x)