Learn R Programming

mclust (version 3.4.7)

surfacePlot: Density or uncertainty surface for bivariate mixtures.

Description

Plots a density or uncertainty surface given bivariate data and parameters of an MVN mixture model for the data.

Usage

surfacePlot(data, parameters, 
            type = c("contour", "image", "persp"), 
            what = c("density", "uncertainty"), 
            transformation = c("none", "log", "sqrt"),          
            grid = 50, nlevels = 20, scale = FALSE, 
            xlim=NULL, ylim=NULL, 
            identify = FALSE, verbose = FALSE, swapAxes = FALSE, ...)

Arguments

data
A matrix, or data frame of bivariate observations. Categorical variables are not allowed. If a matrix or data frame, rows correspond to observations and columns correspond to variables.
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]
type
Choose from one of the following three options: "contour" (default), "image", "persp" indicating the plot type.
what
Choose from one of the following options: "density" (default), "uncertainty" indicating what to plot.
transformation
Choose from one of the following three options: "none" (default), "log", "sqrt" indicating a transformation to be applied before plotting.
grid
The number of grid points (evenly spaced on each axis). The mixture density and uncertainty is computed at grid x grid points to produce the surface plot. Default: 50.
nlevels
The number of levels to use for a contour plot. Default: 20.
scale
A logical variable indicating whether or not the two dimensions should be plotted on the same scale, and thus preserve the shape of the distribution. The default is not to scale.
xlim, ylim
An argument specifying bounds for the ordinate, abscissa of the plot. This may be useful for when comparing plots.
identify
A logical variable indicating whether or not to add a title to the plot identifying the dimensions used.
verbose
A logical variable telling whether or not to print an indication that the function is in the process of computing values at the grid points, which typically takes some time to complete.
swapAxes
A logical variable indicating whether or not the axes should be swapped for the plot.
...
Other graphics parameters.

Value

  • An invisible list with components x, y, and z in which x and y are the values used to define the grid and z is the transformed density or uncertainty at the grid points.

Side Effects

A plots showing (a transformation of) the density or uncertainty for the given mixture model and data.

Details

For an image plot, a color scheme may need to be selected on the display device in order to view the plot.

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

See Also

mclust2Dplot

Examples

Run this code
faithfulModel <- mclustModel(faithful,mclustBIC(faithful))
surfacePlot(faithful, parameters = faithfulModel$parameters,
            type = "contour", what = "density", transformation = "none",
            drawlabels = FALSE)

Run the code above in your browser using DataLab