[R] weird! QDA does not depend on priors?

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Mar 11 15:14:04 CET 2006


Michael wrote:

> Hi all,
> 
> If I run LDA on the same data (2-class classification) with default(no
> priors specified in the lda function) vs. "prior=c(0.5, 0.5)", the results
> are different.
> 
> The (0.5, 0.5) priors give better 1-classify-to-1 rate, and the proportional
> priors(default, no priors specified in the lda function) give better
> 0-classify-to-0 rate, for both training and testing data sets.
> 
> However, if I run QDA on the same data (2-class classification) with
> default(no priors specified in the lda function) vs. "prior=c(0.5, 0.5)",
> the results are the same,
> 
> i.e. the confusion tables are completely the same for two types of priors, I
> even tried "qda" function with "prior=c(0.3, 0.7)" and other values, the
> confusion tables are still the same...
> 
> What might be the problem?


Are we talking about the lda() and qda() implementations in package MASS?
Which versions of R and MASS (?) are we talking about?
Can you specify a reproducible example, please?

The follwing example works for me:
  library(MASS)
  qdaObj <- qda(Species ~ ., data = iris, prior = c(1, 0, 0))
  predict(qdaObj)$class

Uwe Ligges




> Thanks a lot!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list