rmixcomp: Simulation of compositional data from Gaussian mixture models

Description

Simulation of compositional data from Gaussian mixture models.

Usage

1
rmixcomp(n, prob, mu, sigma, type = "alr")

Arguments

n

The sample size

prob

A vector with mixing probabilities. Its length is equal to the number of clusters.

mu

A matrix where each row corresponds to the mean vector of each cluster.

sigma

An array consisting of the covariance matrix of each cluster.

type

Should the additive ("type=alr") or the isometric (type="ilr") log-ration be used? The default value is for the additive log-ratio transformation.

Details

A sample from a multivariate Gaussian mixture model is generated.

Value

A list including:

id

A numeric variable indicating the cluster of simulated vector.

x

A matrix containing the simulated compositional data. The number of dimensions will be + 1.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@yahoo.gr> and Giorgos Athineou <athineou@csd.uoc.gr>

References

Ryan P. Browne, Aisha ElSherbiny and Paul D. McNicholas (2015). R package mixture: Mixture Models for Clustering and Classification.

See Also

mix.compnorm, bic.mixcompnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
p <- c(1/3, 1/3, 1/3)
mu <- matrix(nrow = 3, ncol = 4)
s <- array( dim = c(4, 4, 3) )
x <- as.matrix(iris[, 1:4])
ina <- as.numeric(iris[, 5])
for (i in 1:3) {
  mu[i, ] <- colMeans(x[ina == i, ])
  s[, , i] <- cov(x[ina == i, ])
}
y <- rmixcomp(100, p, mu, s, type = "alr")

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.