cv.msda: Cross-validation for msda

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Does k-fold cross-validation for msda, returns a value for lambda.

Usage

1
cv.msda(x, y, nfolds = 5, lambda = NULL, lambda.opt = "min", ...)

Arguments

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 nfolds can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets. Smallest value allowable is nfolds=3.

lambda

optional user-supplied lambda sequence; default is NULL, and msda chooses its own sequence.

lambda.opt

If choose "min", the smallest lambda that gives minimum cross validation error cvm will be returned. If choose "max", the largest lambda that gives minimum cross validation error cvm will be returned.

...

other arguments that can be passed to msda.

Details

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.

Value

an object of class cv.msda is returned, which is a list with the ingredients of the cross-validation fit.

lambda

the values of lambda used in the fits.

cvm

the mean cross-validated error - a vector of length length(lambda).

cvsd

estimate of standard error of cvm.

lambda.min

the optimal value of lambda that gives minimum cross validation error cvm.

lambda.1se

the largest value of lambda such that error is within 1 standard error of the minimum.

msda.fit

a fitted msda object for the full data.

Author(s)

Qing Mai <mai@stat.fsu.edu>, Yi Yang <yiyang@umn.edu>, Hui Zou <hzou@stat.umn.edu>
Maintainer: Yi Yang <yiyang@umn.edu>

References

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

See Also

msda

Examples

1
2
3
4
5
6
7
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]

emeryyi/msda documentation built on May 16, 2019, 5:07 a.m.