surfacePlot {mclust} | R Documentation

## Density or uncertainty surface for two dimensional mixtures.

### Description

Plots a density or uncertainty surface given data in more than two dimensions and parameters of an MVN mixture model for the data.

### Usage

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

### 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.
`mu` | A matrix whose columns are the means of each group.
`pro` | A list with `scale`, `shape` and `orientation` components giving an alternative form for the covariance structure of the mixture model.
`...` | An argument specifying the covariance structure of the model. If used an indirect function call via `do.call` (see example below), it is usually not necessary to know the precise form for this argument. This argument usually take one of the following forms: `sigma` A three dimensional array in which `sigma[,,k]` gives the covariance for the kth group. `decomp` A list with `scale`, `shape` and `orientation` components giving an alternative form for the covariance structure of the mixture model.
`type` | Any subset of `c("contour","image","persp")` indicating the plot type. For more than one selection, users will be asked to choose from a menu.
`what` | Any subset of `c("density","uncertainty","skip")` indicating what to plot. For more than one selection, users will be asked to choose from a menu. The `"skip"` produces and empty plot, which may be useful if multiple plots are displayed simultaneously.
`transformation` | Any subset of `c("none","log","sqrt")` indicating a transformation to be applied to the surface values before plotting. For more than one selection, users will be asked to choose from a menu.
`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 chosen dimensions should be plotted on the same scale, and thus preserve the shape of the distribution. Default: `scale=F`
`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.
`xlim, ylim` | An argument specifying bounds for the ordinate, abscissa of the plot. This may be useful for when comparing plots.
`swapAxes` | A logical variable indicating whether or not the axes should be swapped for the plot.

### 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

One or more plots showing location of the mixture components, classification, uncertainty, and/or classification errors.

### 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. See http://www.stat.washington.edu/mclust.

C. Fraley and A. E. Raftery (2002). MCLUST:Software for model-based clustering, density estimation and discriminant analysis. Technical Report, Department of Statistics, University of Washington. See http://www.stat.washington.edu/mclust.

### See Also

`mclust2Dplot`, `do.call`

### Examples

    n <- 250 ## create artificial data
    set.seed(0)
    x <- rbind(matrix(rnorm(n*2), n, 2) %*% diag(c(1,9)),
               matrix(rnorm(n*2), n, 2) %*% diag(c(1,9))[,2:1])
    xclass <- c(rep(1,n),rep(2,n))

    xEMclust <- summary(EMclust(x),x)
    surfacePlot(x, mu = xEMclust$mu, sigma = xEMclust$sigma, pro=xEMclust$pro,
                type = "contour", what = "density", transformation = "none")

    ## Not run: do.call("surfacePlot", c(list(data = x), xEMclust))

[Package mclust version 2.1-10 Index]