Learn R Programming

mclust (version 5.2.2)

Mclust: Model-Based Clustering

Description

The optimal model according to BIC for EM initialized by hierarchical clustering for parameterized Gaussian mixture models.

Usage

Mclust(data, G = NULL, modelNames = NULL, prior = NULL, control = emControl(), initialization = NULL, warn = mclust.options("warn"), x =  NULL, ...)

Arguments

data
A numeric vector, matrix, or data frame of observations. Categorical variables are not allowed. If a matrix or data frame, rows correspond to observations and columns correspond to variables.
G
An integer vector specifying the numbers of mixture components (clusters) for which the BIC is to be calculated. The default is G=1:9.
modelNames
A vector of character strings indicating the models to be fitted in the EM phase of clustering. The default is:
for univariate data
c("E", "V")
for multivariate data ($n > d$)
mclust.options("emModelNames")
The help file for mclustModelNames describes the available models.
prior
The default assumes no prior, but this argument allows specification of a conjugate prior on the means and variances through the function priorControl. Note that, as described in defaultPrior, in the multivariate case only 10 out of 14 models may be used in conjunction with a prior, i.e. those available in MCLUST up to version 4.4.
control
A list of control parameters for EM. The defaults are set by the call emControl().
initialization
A list containing zero or more of the following components:

warn
A logical value indicating whether or not certain warnings (usually related to singularity) should be issued. The default is controlled by mclust.options.
x
An object of class 'mclustBIC'. If supplied, BIC values for models that have already been computed and are available in x are not recomputed. All arguments, with the exception of data, G and modelName, are ignored and their values are set as specified in the attributes of x. Defaults for G and modelNames are taken from x.
...
Catches unused arguments in indirect or list calls via do.call.

Value

An object of class 'Mclust' providing the optimal (according to BIC) mixture model estimation.The details of the output components are as follows:

References

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. 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 and A. E. Raftery (2005, revised 2009). Bayesian regularization for normal mixture estimation and model-based clustering. Technical Report, Department of Statistics, University of Washington. C. Fraley and A. E. Raftery (2007). Bayesian regularization for normal mixture estimation and model-based clustering. Journal of Classification 24:155-181.

See Also

summary.Mclust, plot.Mclust, priorControl, emControl, hc, mclustBIC, mclustModelNames, mclust.options

Examples

Run this code
mod1 = Mclust(iris[,1:4])
summary(mod1)

mod2 = Mclust(iris[,1:4], G = 3)
summary(mod2, parameters = TRUE)

# Using prior
mod3 = Mclust(iris[,1:4], prior = priorControl())
summary(mod3)

mod4 = Mclust(iris[,1:4], prior = priorControl(functionName="defaultPrior", shrinkage=0.1))
summary(mod4)

# Clustering of faithful data with some artificial noise added 
nNoise = 100
set.seed(0) # to make it reproducible
Noise = apply(faithful, 2, function(x) 
                           runif(nNoise, min = min(x)-.1, max = max(x)+.1))
data = rbind(faithful, Noise)
plot(faithful)
points(Noise, pch = 20, cex = 0.5, col = "lightgrey")
set.seed(0)
NoiseInit = sample(c(TRUE,FALSE), size = nrow(faithful)+nNoise, 
                   replace = TRUE, prob = c(3,1)/4)
mod5 = Mclust(data, initialization = list(noise = NoiseInit))
summary(mod5, parameter = TRUE)
plot(mod5, what = "classification")

Run the code above in your browser using DataLab