[R] Help: predict.qda

Shengzhe Wu r.shengzhe at gmail.com
Mon Aug 29 23:45:41 CEST 2005


Hello,

I use the function qda (package MASS) to obtain a qda object like below.

x.qda = qda(x, group)

the group is a factor of two levels

and use this object to do the prediction below.

y.pred = predict(x.qda, y)

after that, I set different prediction priors like below, but the
results of prediction are totally the same as above using prior of
training set (use all.equal to compare).

y.pred1 = predict(x.qda,y, prior = c(1, 0))
y.pred2 = predict(x.qda,y, prior = c(0.5, 0.5))
y.pred3 = predict(x.qda,y, prior = c(0, 1))
y.pred4 = predict(x.qda,y, prior = c(0, 0))

the prediction prior of the last one should be wrong, but I still got
the same result.
And I tested the example of the function predict.qda by setting a
prediction prior.

predict(z, test, prior = c(0.1, 0.1, 0.8))

this result is exact the same as "predict(z, test)" which use training prior 
"c(0.3333333, 0.3333333, 0.3333333)"

If the prediction prior for qda does not work?

The version of R I use is 2.1.1, and this argument for lda works.

Thank you,
Shengzhe




More information about the R-help mailing list