Learn R Programming

mclust (version 4.1)

predict.MclustDA: Classify multivariate observations by Gaussian finite mixture modeling

Description

Classify multivariate observations based on Gaussian finite mixture models estimated by MclustDA.

Usage

## S3 method for class 'MclustDA':
predict(object, newdata, prior, \dots)

Arguments

object
an object of class "MclustDA" resulting from a call to MclustDA.
newdata
a data frame or matrix giving the data. If missing the train data obtained from the call to MclustDA are classified.
prior
the prior probabilities of the classes; by default, this is set at the proportions in the training data.
...
further arguments passed to or from other methods.

Value

  • Returns a list of with the following components:
  • classificationa factor of predicted class labels for newdata.
  • za matrix whose [i,k]th entry is the probability that observation i in newdata belongs to the kth class.

References

C. Fraley and A. E. Raftery (2002). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association 97:611:631.

C. Fraley, A. E. Raftery, T. B. Murphy and L. Scrucca (2012). mclust Version 4 for R: Normal Mixture Modeling for Model-Based Clustering, Classification, and Density Estimation. Technical Report No. 597, Department of Statistics, University of Washington.

See Also

MclustDA.

Examples

Run this code
odd <- seq(from = 1, to = nrow(iris), by = 2)
even <- odd + 1
X.train <- iris[odd,-5]
Class.train <- iris[odd,5]
X.test <- iris[even,-5]
Class.test <- iris[even,5]

irisMclustDA <- MclustDA(X.train, Class.train)

predTrain <- predict(irisMclustDA)
predTrain
predTest <- predict(irisMclustDA, X.test)
predTest

Run the code above in your browser using DataLab