Skip to content

Lda versus Rda

2 messages · Julien Trolet, Uwe Ligges

#
Hello,

I used the lda function from the MASS (VR) package and the rda function 
from the klaR package.
I wanted to compare the result of this two functions by using the same 
training set.
Thus, I used the rda function with lambda=1 an gamma=0, I should emulate 
the lda function and I should obtain the same result.

But this it not the case, the two result are very different.

My training set is 70 observations * 10 variables long, and I performed 
a leave one out for each  observations.

Do somebody have an idea for the cause(s) of this?

Thanks

Trolet Julien
#
Julien Trolet wrote:

            
With the iris data, the following works for me:

  x1 <- predict(lda(Species~., data=iris))
  x2 <- predict(rda(Species~., data=iris, lambda=1, gamma=0))

  all(x1$class == x2$class)
  all.equal(x1$posterior, x2$posterior)

So, can you specify an example (including data + code, in a private 
message) please?

If your analysis for your data is correct, the error is probably in 
rda(). I won't have time to look at it before monday (and the author of 
the rda() code is in Auckland these days).

It's always a good idea to ask the package maintainer first, BTW.

Uwe Ligges