MGSDA (Multi-Group Sparse Discriminant Analysis) is an R package that implements methods described in
The package is available from CRAN.
To install from Github:
devtools::install_github("irinagain/MGSDApackage")
The main functions are cv.dLDA(cross-validation), dLDA(fitting for specified value of tuning parameter) and classifyV(classification). Each function has a documentation with a simple example which can be accessed using standard ? commands in R (i.e. ?cv.dLDA).
Please feel free to contact me at irinag [at] stat [dot] tamu [dot] edu if you have any questions or experience problems with the package.
library(MGSDA)
### Example 1# generate training datan<-10p<-100G<-3ytrain<- rep(1:G, each=n)
set.seed(1)
xtrain<-matrix(rnorm(p*n*G), n*G, p)
# find matrix of canonical vectors VV<- dLDA(xtrain, ytrain, lambda=0.1)
sum(rowSums(V) !=0)
# generate test datam<-20
set.seed(3)
xtest<-matrix(rnorm(p*m), m, p)
# perform classificationytest<- classifyV(xtrain, ytrain, xtest, V)