[R] Help: predict.qda

From: Shengzhe Wu <r.shengzhe_at_gmail.com>
Date: Tue 30 Aug 2005 - 19:43:51 EST


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



R-help@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 Received on Tue Aug 30 20:10:02 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:07:28 EST