dLDA {MGSDA} | R Documentation |
Estimate the matrix of discriminant vectors using L_1 penalty on the rows
Description
Solve Multi-Group Sparse Discriminant Anlalysis problem for the supplied value of the tuning parameter lambda.
Usage
dLDA(xtrain, ytrain, lambda, Vinit = NULL,eps=1e-6,maxiter=1000,rho=1)
Arguments
xtrain |
A Nxp data matrix; N observations on the rows and p features on the columns. |
ytrain |
A N-vector containing the group labels. Should be coded as 1,2,...,G, where G is the number of groups. |
lambda |
Tuning parameter. |
Vinit |
A px(G-1) optional initial value for the optimization algorithm; the default value is NULL. |
eps |
Tolerance level for the convergence of the optimization algorithm; the default value is 1e-6. |
maxiter |
Maximal number of iterations for the optimization algorithm; the default value is 1000. |
rho |
A scalar that ensures the objective function is bounded from below; the default value is 1. |
Details
Solves the following optimization problem:
\min_V \frac12 Tr(V^tWV+\rho V^tDD^tV)-Tr(D^tV)+\lambda\sum_{i=1}^p\|v_i\|_2
Here W is the within-group sample covariance matrix and D is the matrix of orthogonal contrasts between the group means, both are constructed based on the supplied values of xtrain
and ytrain
.
When G=2
, the row penalty reduces to vector L_1 penalty.
Value
Returns a px(G-1) matrix of canonical vectors V.
Author(s)
Irina Gaynanova
References
I.Gaynanova, J.Booth and M.Wells (2016) "Simultaneous Sparse Estimation of Canonical Vectors in the p>>N setting", JASA, 111(514), 696-706.
Examples
# Example 1
n=10
p=100
G=3
ytrain=rep(1:G,each=n)
set.seed(1)
xtrain=matrix(rnorm(p*n*G),n*G,p)
V=dLDA(xtrain,ytrain,lambda=0.1)
sum(rowSums(V)!=0) # number of non-zero rows