Learn R Programming

GMCM (version 1.1.1)

SimulateGMCMData: Simulation from the Gaussian mixture (copula) model

Description

Functions to simulate data from the Gaussian mixture model (GMM) and the Gaussian mixture copula model (GMCM).

Usage

SimulateGMCMData(n = 1000, par, d = 2, theta, ...)

SimulateGMMData(n = 1000, theta = rtheta(...), ...)

Arguments

n
Integer. The number of realizations drawn from the model. Default is 1000.
par
A vector of parameters of length 4 where par[1] is the mixture proportion, par[2] is the mean, par[3] is the standard deviation, and par[4] is the correlation.
d
The number of dimensions (or, equivalently, experiments) in the mixture distribution.
theta
A list of parameters for the model as described in rtheta.
...
In SimulateGMCMData the arguments are passed to SimulateGMMData. In SimulateGMMData the arguments are passed to rtheta.

Value

  • SimulateGMCMData returns a list of length 4 with elements:
  • uA matrix of the realized values of the GMCM.
  • zA matrix of the latent GMM realizations.
  • KAn integer vector denoting the component from which the realization comes.
  • thetaA list containing the used parameters for the simulations with the format described in rtheta.
  • SimulateGMMData returns a list of length 3 with elements:
  • zA matrix of GMM realizations.
  • KAn integer vector denoting the component from which the realization comes.
  • thetaAs above and in rtheta.

Details

The par argument specifies the parameters of the Li et. al. (2011) GMCM. The theta argument specifies an arbitrary GMCM. Either one can be supplied. If both are missing, random parameters are chosen for the general model.

See Also

rtheta

Examples

Run this code
set.seed(2)

# Simulation from the GMM
gmm.data1 <- SimulateGMMData(n = 200, m = 3, d = 2)
str(gmm.data1)

# Plotting the simulated data
plot(gmm.data1$z, col = gmm.data1$K)

# Simulation from the GMCM
gmcm.data1 <- SimulateGMCMData(n = 1000, m = 4, d = 2)
str(gmcm.data1)

# Plotthe 2nd simulation
par(mfrow = c(1,2))
plot(gmcm.data1$z, col = gmcm.data1$K)
plot(gmcm.data1$u, col = gmcm.data1$K)

# Simulation from the special case of GMCM
theta <- meta2full(c(0.7, 2, 1, 0.7), d = 3)
gmcm.data2 <- SimulateGMCMData(n = 5000, theta = theta)
str(gmcm.data2)

# Plotting the 3rd simulation
par(mfrow=c(1,2))
plot(gmcm.data2$z, col = gmcm.data2$K)
plot(gmcm.data2$u, col = gmcm.data2$K)

Run the code above in your browser using DataLab