[R] Regularized Discriminant Analysis scores, anyone?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Jun 2 16:39:30 CEST 2013

On 02.06.2013 05:01, Matthew Fagan wrote:
> Hi all,
> 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?

There are no such scores:

same as for qda, you do not follow the Fisher idea of the linear 
discriminant components any more: Your space is now partitioned by 
ellipsoid like structures based on the estimation of the inner-class 
covariance matrices.

rda as implemented in klaR (see the reference given on the help page) is 
a regularization that helps to overcome problems when estimating 
non-singular covariance matrices for the separate classes.

> 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:

The rda package provides a completely different regularization 
technique, see the reference given on the help page.

Uwe Ligges

> library(klaR)
> library(MASS)
> data(iris)
> x <- rda(Species ~ ., data = iris, gamma = 0.05, lambda = 0.2)
> rda1<-predict(x, iris[, 1:4])
> str(rda1)
> #  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])
> str(lda1)
> 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,
> Matt
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list