Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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, prop = object$prop, ...)

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.

prop

the class proportions or prior class probabilities to belong to each class; by default, this is set at the class proportions in the training data.

...

further arguments passed to or from other methods.

Value

Returns a list of with the following components:

classification

a factor of predicted class labels for newdata.

z

a matrix whose [i,k]th entry is the probability that observation i in newdata belongs to the kth class.

Author(s)

Luca Scrucca

See Also

Examples

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

mclust

Gaussian Mixture Modelling for Model-Based Clustering, Classification, and Density Estimation

v5.4.10
GPL (>= 2)
Authors
Chris Fraley [aut], Adrian E. Raftery [aut] (<https://orcid.org/0000-0002-6589-301X>), Luca Scrucca [aut, cre] (<https://orcid.org/0000-0003-3826-0484>), Thomas Brendan Murphy [ctb] (<https://orcid.org/0000-0002-5668-7046>), Michael Fop [ctb] (<https://orcid.org/0000-0003-3936-2757>)
Initial release
2022-05-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.