Prediction Method for a discrim Object

DESCRIPTION:

Predict group membership of observations using a discriminant function estimated by the discrim function.

USAGE:

predict.discrim(object, newdata,
    method=c("plug-in", "predictive", "unbiased"), doubt=0,
    digits=.Options$digits)

REQUIRED ARGUMENTS:

object
the discrim object constructed by the discrim function containing the estimated discriminant function.

OPTIONAL ARGUMENTS:

newdata
a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made for the training data use to compute the discriminant function. Only those feature variables used to compute the discriminant function need be present by name in newdata.
method
a character string specifying the method of prediction. Valid methods are "plug-in", the default, "predictive", or "unbiased".
doubt
a numeric variable, 0 <= 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.
digits
the number of significant digits to retain in the posterior probability. Rounding the posterior probabilities is done mostly for printing purposes.

VALUE:

an n x (g+1) data.frame, where n is the number of observations and g is the number of groups, containing a 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.

DETAILS:

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.

REFERENCES:



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.

SEE ALSO:

, , , , .

EXAMPLES:

# 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)