sim {mclust} | R Documentation

## Simulate from Parameterized MVN Mixture Models

### Description

Simulate data from parameterized MVN mixture models.

### Usage

    sim(modelName, mu, ..., seed = 0)

### Arguments

`modelName` | A character string indicating the model. Possible models: "E": equal variance (one-dimensional) "V": variable variance (one-dimensional) "EII": spherical, equal volume "VII": spherical, unequal volume "EEI": diagonal, equal volume, equal shape "VEI": diagonal, varying volume, equal shape "EVI": diagonal, equal volume, varying shape "VVI": diagonal, varying volume, varying shape "EEE": ellipsoidal, equal volume, shape, and orientation "EEV": ellipsoidal, equal volume and equal shape "VEV": ellipsoidal, equal shape "VVV": ellipsoidal, varying volume, shape, and orientation
`mu` | The mean for each component. If there is more than one component, `mu` is a matrix whose columns are the means of the components.
`...` | Arguments for model-specific functions. Specifically: An argument describing the variance (depends on the model): sigmasq for the one-dimensional models ("E", "V") and spherical models ("EII", "VII"). This is either a vector whose kth component is the variance for the kth component in the mixture model ("V" and "VII"), or a scalar giving the common variance for all components in the mixture model ("E" and "EII"). decomp for the diagonal models ("EEI", "VEI", "EVI", "VVI") and some ellipsoidal models ("EEV", "VEV"). This is a list described in `cdens`. Sigma for the equal variance model "EEE". A d by d matrix giving the common covariance for all components of the mixture model. sigma for the unconstrained variance model "VVV". A d by d by G matrix array whose `[,,k]`th entry is the covariance matrix for the kth component of the mixture model. The form of the variance specification is the same as for the output for the `em`, `me`, or `mstep` methods for the specified mixture model. pro Component mixing proportions. If missing, equal proportions are assumed. n An integer specifying the number of data points to be simulated.
`seed` | A integer between 0 and 1000, inclusive, for specifying a seed for random class assignment. The default value is 0.

### Details

This function can be used with an indirect or list call using `do.call`, allowing the output of e.g. `mstep`, `em`, `me`, or `EMclust` to be passed directly without the need to specify individual parameters as arguments.

### Value

A data set consisting of n points simulated from the specified MVN mixture model.

### References

C. Fraley and A. E. Raftery (2002a). 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 (2002b). 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

`simE`, ..., `simVVV`, `EMclust`, `mstep`, `do.call`

### Examples

    data(iris)
    irisMatrix <- as.matrix(iris[,1:4])

    irisBic <- EMclust(irisMatrix)
    irisSumry <- summary(irisBic,irisMatrix)
    names(irisSumry)
    irisSim <- sim(modelName = irisSumry$modelName, n = dim(irisMatrix)[1],
           mu = irisSumry$mu, decomp = irisSumry$decomp, pro = irisSumry$pro)
    ## Not run:
    irisSim <- do.call("sim", irisSumry) ## alternative call
    ## End(Not run)

    par(pty = "s", mfrow = c(1,2))
    dimens <- c(1,2)
    xlim <- range(rbind(irisMatrix,irisSim)[,dimens][,1])
    ylim <- range(rbind(irisMatrix,irisSim)[,dimens][,2])

    cl <- irisSumry$classification
    coordProj(irisMatrix, par=irisSumry, classification=cl, dimens=dimens,
              xlim=xlim, ylim=ylim)
    cl <- attr(irisSim,"classification")
    coordProj(irisSim, par=irisSumry, classification=cl, dimens=dimens,
              xlim=xlim, ylim=ylim)

    irisSumry3 <- summary(irisBic,irisMatrix, G=3)
    irisSim3 <- do.call("sim", c(list(n = 500, seed = 1), irisSumry3))
    clPairs(irisSim3, cl = attr(irisSim3,"classification"))

[Package mclust version 2.1-10 Index]