| Title: | Multi-Class Sparse Discriminant Analysis |
|---|---|
| Description: | Efficient procedures for computing a new Multi-Class Sparse Discriminant Analysis method that estimates all discriminant directions simultaneously. |
| Authors: | Qing Mai <[email protected]>, Yi Yang <[email protected]>, Hui Zou <[email protected]> |
| Maintainer: | Yi Yang <[email protected]> |
| License: | GPL-2 |
| Version: | 1.0.2 |
| Built: | 2026-05-08 07:47:34 UTC |
| Source: | https://github.com/archer-yang-lab/msda |
Does k-fold cross-validation for msda, returns a value for lambda.
cv.msda(x, y, nfolds = 5, lambda = NULL, lambda.opt = "min", ...)cv.msda(x, y, nfolds = 5, lambda = NULL, lambda.opt = "min", ...)
x |
matrix of predictors, of dimension |
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 <[email protected]>, Yi Yang <[email protected]>, Hui Zou <[email protected]>
Maintainer: Yi Yang <[email protected]>
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
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]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]
The dataset is a subset of the dataset available on Gene Expression Omnibus with the accession number GDS1615. The original dataset contains 22283 gene expression levels and the disease states of the observed subjects. In Mai, Yang and Zou, the dimension of the original dataset was first reduced to 127 by F-test screening.
data(GDS1615)data(GDS1615)
This data frame contains the following:
x |
gene expression levels. |
y |
Disease state that is coded as 1,2,3. 1: normal; 2: ulcerative colitis; 3: Crohn's disease. |
M. E. Burczynski, R. L Peterson, N. C. Twine, K. A. Zuberek, B. J. Brodeur, L. Casciotti, V. Maganti, P. S. Reddy, A. Strahs, F. Immermann, W. Spinelli, U. Schwertschlag, A. M. Slager, M. M. Cotreau, and A. J. Dorner. (2012), "Molecular classification of crohn's disease and ulcerative colitis patients using transcriptional profiles in peripheral blood mononuclear cells". Journal of Molecular Diagnostics, 8:51–61.
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
data(GDS1615)data(GDS1615)
Fits a regularization path for Multi-Class Sparse Discriminant Analysis at a sequence of regularization parameters lambda.
msda(x, y, nlambda = 100, lambda.factor = ifelse((nobs - nclass) <= nvars, 0.2, 0.001), lambda = NULL, dfmax = nobs, pmax = min(dfmax * 2 + 20, nvars), pf = rep(1, nvars), eps = 1e-04, maxit = 1e+06, sml = 1e-06, verbose = FALSE, perturb = NULL)msda(x, y, nlambda = 100, lambda.factor = ifelse((nobs - nclass) <= nvars, 0.2, 0.001), lambda = NULL, dfmax = nobs, pmax = min(dfmax * 2 + 20, nvars), pf = rep(1, nvars), eps = 1e-04, maxit = 1e+06, sml = 1e-06, verbose = FALSE, perturb = NULL)
x |
matrix of predictors, of dimension |
y |
response variable. This argument should be a factor for classification. |
nlambda |
the number of |
lambda.factor |
The factor for getting the minimal lambda in |
lambda |
a user supplied |
dfmax |
limit the maximum number of variables in the
model. Useful for very large |
pmax |
limit the maximum number of variables ever to be nonzero. For example once |
pf |
L1 penalty factor of length |
eps |
convergence threshold for coordinate descent. Each inner
coordinate descent loop continues until the relative change in any
coefficient. Defaults value is |
maxit |
maximum number of outer-loop iterations allowed at fixed lambda value. Default is 1e6. If models do not converge, consider increasing |
sml |
|
verbose |
whether to print out computation progress. The default is |
perturb |
a scalar number. If it is specified, the number will be added to each diagonal element of the sigma matrix as perturbation. The default is |
Note that for computing speed reason, if models are not converging or running slow, consider increasing eps and sml, or decreasing
nlambda, or increasing lambda.factor before increasing
maxit. Users can also reduce dfmax to limit the maximum number of variables in the model.
An object with S3 class msda.
theta |
a list of length(lambda) for fitted coefficients theta, each one corresponding to one lambda value, each stored as a sparse matrix ( |
df |
the number of nonzero coefficients for each value of
|
obj |
the fitted value of the objective function for each value of
|
dim |
dimension of each coefficient matrix at each lambda. |
lambda |
the actual sequence of |
x |
matrix of predictors. |
y |
response variable. |
npasses |
total number of iterations (the most inner loop) summed over all lambda values |
jerr |
error flag, for warnings and errors, 0 if no error. |
sigma |
estimated sigma matrix. |
delta |
estimated delta matrix. delta[k] = mu[k]-mu[1]. |
mu |
estimated mu vector. |
prior |
prior probability that y belong to class k, estimated by mean(y that belong to k). |
call |
the call that produced this object |
Qing Mai <[email protected]>, Yi Yang <[email protected]>, Hui Zou <[email protected]>
Maintainer: Yi Yang <[email protected]>
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
cv.msda, predict.msda
data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y)data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y)
Produces a coefficient profile plot of the coefficient paths for a
fitted msda object.
## S3 method for class 'msda' plot(x, xvar = c("norm", "lambda"), ...)## S3 method for class 'msda' plot(x, xvar = c("norm", "lambda"), ...)
x |
fitted |
xvar |
the variable on the X-axis. The option |
... |
other graphical parameters to plot |
A coefficient profile plot is produced.
Qing Mai <[email protected]>, Yi Yang <[email protected]>, Hui Zou <[email protected]>
Maintainer: Yi Yang <[email protected]>
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
data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y) plot(obj)data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y) plot(obj)
This functions predicts class labels from a fitted msda object.
## S3 method for class 'msda' predict(object, newx, ...)## S3 method for class 'msda' predict(object, newx, ...)
object |
fitted |
newx |
matrix of new values for |
... |
Not used. Other arguments to predict. |
predicted class label(s) at the entire sequence of the penalty parameter lambda used to create the model.
Qing Mai <[email protected]>, Yi Yang <[email protected]>, Hui Zou <[email protected]>
Maintainer: Yi Yang <[email protected]>
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
data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y) pred<-predict(obj,x)data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y) pred<-predict(obj,x)