Learn R Programming

mclust (version 4.1)

plot.densityMclust: Plot for a mclustDensity object

Description

Plotting methods for mclustDensity objects. Available graphs are plot of BIC values and density for univariate and bivariate data. For higher data dimensionality a scatterplot matrix of pairwise densities is drawn.

Usage

## S3 method for class 'densityMclust':
plot(x, data = NULL, what = c("density", "BIC", "diagnostic"), ...)

plotDensityMclust1(x, data = NULL, hist.col = "lightgrey", hist.border = "grey", breaks = "Sturges", ...)

plotDensityMclust2(x, data = NULL, col = grey(0.6), nlevels = 11, levels = NULL, points.col = 1, pch = 1, ...)

plotDensityMclustd(x, data = NULL, col = grey(0.6), nlevels = 11, levels = NULL, points.col = 1, pch = 1, gap = 0.2, ...)

Arguments

x
mclustDensity object obtained from densityMclust function.
data
optional data points.
what
the type of graph requested: [object Object],[object Object],[object Object]
hist.col
the colour to be used to fill the bars of the histogram.
hist.border
the color of the border around the bars of the histogram.
breaks
see the argument in function hist.
points.col
the color to be used for plotting data points.
pch
an integer, a symbol or a single character to be used for plotting data points.
col
color for the contour lines drawn.
nlevels
an integer, the number of levels to be used in plotting contour densities.
levels
a vector of density levels at which to draw the contour lines.
gap
distance between subplots, in margin lines, for the matrix of pairwise scatterplots.
...
additional arguments.

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.

Details

The function plot.densityMclust allows to obtain the plot of estimated density or the graph of BIC values for evaluated models. If what = "density" the produced plot dependes on the dimensionality of the data. For one-dimensional data a call with no data provided produces a plot of the estimated density over a sensible range of values. If data is provided the density is over-plotted on a histogram for the observed data. For two-dimensional data further arguments available are those accepted by the surfacePlot function. In particular, the density can be represented through "contour", "image", and "persp" type of graph. For higher dimensionality a scatterplot matrix of pairwise densities is drawn.

See Also

densityMclust, densityMclust.diagnostic, Mclust.

Examples

Run this code
x = faithful$waiting
dens = densityMclust(x)
summary(dens)
summary(dens, parameters = TRUE)
plot(dens, what = "BIC")
plot(dens)
plot(dens, x)
plot(dens, x, what = "diagnostic")

x = as.matrix(faithful)
dens = densityMclust(x)
summary(dens)
summary(dens, parameters = TRUE)
plot(dens, what = "BIC")
plot(dens)
plot(dens, x, col = "cadetblue", drawlabels = FALSE, pch = 20,
     levels = quantile(dens$density, probs = c(0.05, 0.25, 0.5, 0.75, 0.95)))
plot(dens, x, col = "grey", 
     points.col = dens$classification+1, pch = dens$classification)
plot(dens, type = "image", col = terrain.colors(50))
plot(dens, type = "persp")

x = iris[,1:4]
dens = densityMclust(x)
summary(dens, parameters = TRUE)
plot(dens)
plot(dens, x, col = "cadetblue", drawlabels = FALSE,
     levels = quantile(dens$density, probs = c(0.05, 0.25, 0.5, 0.75, 0.95)))
plot(dens, type = "image", col = topo.colors(50))
plot(dens, type = "persp", border = NA)

Run the code above in your browser using DataLab