[R] Regularized Discriminant Analysis scores, anyone?
mef2153 at columbia.edu
Sun Jun 2 05:01:45 CEST 2013
I am attempting to do Regularized Discriminant Analysis (RDA) on a large
dataset, and I want to extract the RDA discriminant score matrix. But
the predict function in the "klaR" package, unlike the predict function
for LDA in the "MASS" package, doesn't seem to give me an option to
extract the scores. Any suggestions?
i have already tried (and failed; ran out of 16 GB of memory) to do this
with the "rda" package: don't know why, but the klaR package seems to be
much more efficient with memory. I have included an example below:
x <- rda(Species ~ ., data = iris, gamma = 0.05, lambda = 0.2)
rda1<-predict(x, iris[, 1:4])
# This gets you an object with posterior probabilities and classes, but
no discriminant scores!
# if you run lda
y <- lda(Species ~ ., data = iris)
lda1<-predict(y, iris[, 1:4])
head(lda1$x) # gets you the discriminant scores for the LDA. But how
to do this for RDA?
# curiously, the QDA function in MASS has this same problem, although
you can get around it using the rrcov package.
Regards, and thank very much for any help,
More information about the R-help