decodeLDA {rDecode} | R Documentation |
DECODE
for simple LDAImplement DECODE
for simple LDA. The LDA assumes both classes have equal prior probabilities. This implementation is used in Hadimaja and Pun (2018).
decodeLDA(X, y, lambda0 = NULL, ...)
X |
nxp data matrix. |
y |
binary n-length vector containing the class of each observation. |
lambda0 |
number between 0 and 1. If |
... |
additional arguments to be passed to general decode function. |
An object of class decodeLDA
containing:
eta |
|
X |
training data used |
y |
training label used |
and various outputs from decode
function.
Hadimaja, M. Z., & Pun, C. S. (2018). A Self-Calibrated Regularized Direct Estimation for Graphical Selection and Discriminant Analysis.
# for efficiency, we will only use 500 variables # load the training data (Lung cancer data, cleaned) data(lung.train) # 145 x 1578 X.train <- lung.train[,1:500] y.train <- lung.train[,1578] # build the DECODE object <- decodeLDA(X.train, y.train) object summary(object) coef(object) # test on test data data(lung.test) X.test <- lung.test[,1:500] y.test <- lung.test[,1578] y.pred <- predict(object, X.test) table(y.pred, y.test)