msda | R Documentation |
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)
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. |
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 p, if a partial path is desired. Default is n. |
pmax |
limit the maximum number of variables ever to be nonzero. For example once β enters the model, no matter how many times it exits or re-enters model through the path, it will be counted only once. Default is |
pf |
L1 penalty factor of length p. Separate L1 penalty weights can be applied to each coefficient of theta to allow
differential L1 shrinkage. Can be 0 for some variables, which implies
no L1 shrinkage, and results in that variable always being included in the
model. Default is 1 for all variables (and implicitly infinity for
variables listed in |
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 <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
cv.msda
, predict.msda
data(GDS1615) x<-GDS1615$x y<-GDS1615$y obj <- msda(x = x, y = y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.