discrim
Object
discrim
function.
predict.discrim(object, newdata, method=c("plug-in", "predictive", "unbiased"), doubt=0, digits=.Options$digits)
discrim
object constructed by the
discrim
function containing the estimated discriminant function.
newdata
.
doubt
< (g-1)/g, where g is the number of groups,
defining the minimum difference the maximum posterior probability of group
membership must exceed all others before assigning the observation to that group. If there does
not exist a posterior probability of group membership for an observation that exceeds
doubt
+ 1/g, the observation is assigned to an "unknown" group.
group
factor column followed by the posterior probability of group membership
for each observation in the
newdata
data frame or the training data used to
fit the discriminant function.
Predicts group membership for observations in the data frame
newdata
using the discriminant function
contained in the
discrim
object,
object
.
Options for predictions are
method
= "plug-in", "predictive", or "unbiased". The plug-in
method computes the posterior probability of group membership for each
observation, where the prior probabilities of group membership are given
by the variable
prior
, and assigns the observation to the group that has the
highest probability. This is the optimal allocation rule, or Bayes rule.
The predictive method is a Bayesian method, where the posterior density of
the mean and covariance for each group given the training data is incorporated
in the posterior probability of group membership. The unbiased method uses an
unbiased estimate of the log normal density.
Further details of these methods can be found in both McLachlan (1992) and
Ripley (1996).
The
predict
method is based on
the
predict
method of the
lda
and
qda
objects from the Venables
and Ripley (1997)
MASS
library.
McLachlan, G. J. (1992).
Discriminant Analysis and Statistical Pattern Recognition,
John Wiley & Sons.
Ripley, B.D. (1996).
Pattern Recognition and Neural Networks,
Cambridge University Press.
Venables, W.N. and Ripley, B.D. (1997).
Modern Applied Statistics with S-PLUS, Second Ed.,
Springer.
# Iris data iris.quad <- discrim(Species~Sepal.L. + Sepal.W. + Petal.L. + Petal.W., data=iris.mm, family=Classical("heter")) pred <- predict(iris.quad) pred[sort(sample(seq(150),15)),] table(Iris.mm$Sp, pred$group)