mclust (version 3.4.7)

mclust2Dplot: Plot two-dimensional data modelled by an MVN mixture.

Description

Plot two-dimensional data given parameters of an MVN mixture model for the data.

Usage

mclust2Dplot(data, parameters=NULL, z=NULL,
             classification=NULL, truth=NULL, uncertainty=NULL,
             what = c("classification","uncertainty","errors"), 
             quantiles = c(0.75,0.95), symbols=NULL, colors=NULL, 
             scale=FALSE, xlim=NULL, ylim=NULL, CEX = 1, PCH = ".", 
             identify = FALSE, swapAxes = FALSE, ...)

Arguments

data
A numeric 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. In this case the data are two dimensional, so there are
parameters
A named list giving the parameters of an MCLUST model, used to produce superimposing ellipses on the plot. The relevant components are as follows: [object Object],[object Object],[object Object]
z
A matrix in which the [i,k]th entry gives the probability of observation i belonging to the kth class. Used to compute classification and uncertainty if those arguments aren
classification
A numeric or character vector representing a classification of observations (rows) of data. If present argument z will be ignored.
truth
A numeric or character vector giving a known classification of each data point. If classification or z is also present, this is used for displaying classification errors.
uncertainty
A numeric vector of values in (0,1) giving the uncertainty of each data point. If present argument z will be ignored.
what
Choose from one of the following three options: "classification" (default), "errors", "uncertainty".
quantiles
A vector of length 2 giving quantiles used in plotting uncertainty. The smallest symbols correspond to the smallest quantile (lowest uncertainty), medium-sized (open) symbols to points falling between the given quantiles, and large (filled)
symbols
Either an integer or character vector assigning a plotting symbol to each unique class in classification. Elements in colors correspond to classes in order of appearance in the sequence of observations (the order used
colors
Either an integer or character vector assigning a color to each unique class in classification. Elements in colors correspond to classes in order of appearance in the sequence of observations (the order used by the fu
scale
A logical variable indicating whether or not the two chosen dimensions should be plotted on the same scale, and thus preserve the shape of the distribution. Default: scale=FALSE
xlim, ylim
An argument specifying bounds for the ordinate, abscissa of the plot. This may be useful for when comparing plots.
CEX
An argument specifying the size of the plotting symbols. The default value is 1.
PCH
An argument specifying the symbol to be used when a classificatiion has not been specified for the data. The default value is a small dot ".".
identify
A logical variable indicating whether or not to add a title to the plot identifying the dimensions used.
swapAxes
A logical variable indicating whether or not the axes should be swapped for the plot.
...
Other graphics parameters.

Side Effects

A plot showing the data, together with the location of the mixture components, classification, uncertainty, and/or classification errors.

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 and A. E. Raftery (2006). MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering, Technical Report no. 504, Department of Statistics, University of Washington.

See Also

surfacePlot, clPairs, coordProj, mclustOptions

Examples

Run this code
faithfulModel <- mclustModel(faithful,mclustBIC(faithful))

mclust2Dplot(faithful, parameters=faithfulModel$parameters, 
             z=faithfulModel$z, what = "classification", identify = TRUE)

mclust2Dplot(faithful, parameters=faithfulModel$parameters, 
             z=faithfulModel$z, what = "uncertainty", identify = TRUE)

Run the code above in your browser using DataLab