gmm {gmgm}R Documentation

Create a Gaussian mixture model

Description

This function creates a Gaussian mixture model as an object of S3 class gmm. A Gaussian mixture model is a weighted sum of multivariate Gaussian distributions:

p(x) = \sum_{i = 1}^M \alpha_i \mathcal{N}(x | \mu_i, \Sigma_i)

where \alpha_i is the ith mixture proportion such that \alpha_i > 0 and \sum_{i = 1}^M \alpha_i = 1, \mu_i the mean vector and \Sigma_i the covariance matrix of the ith mixture component (Bilmes, 1998). Since conditional distributions can be derived from joint distributions, the gmm class is also used to work with conditional Gaussian mixture models (see function conditional to explicit their parameters). Finally, note that a one-component Gaussian mixture model can be created with function add_var (by passing NULL as argument gmm), which allows to quickly initialize a gmm object that can be passed to a learning function.

Usage

gmm(alpha, mu, sigma, var = rownames(mu))

Arguments

alpha

A positive numeric vector containing the mixture proportions. If the sum of these proportions is not 1, a normalization is performed by dividing them by this sum.

mu

A numeric matrix containing the mean vectors bound by column.

sigma

A list containing the covariance matrices.

var

A character vector containing the variable names (by default the row names of mu).

Value

A list of class gmm containing the elements alpha, mu and sigma passed as arguments (completed with the variable names passed as argument var).

References

Bilmes, J. A. (1998). A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models. Technical report, International Computer Science Institute.

See Also

gmbn, gmdbn

Examples

gmm_1 <- gmm(alpha = c(0.2, 0.5, 0.3),
             mu = matrix(c(109, 91, 44, 160, 41, 99, 87, 27, 173, 40, 86, 65,
                           35, 161, 40),
                         nrow = 5),
             sigma = list(matrix(c(208, 240, 32, 17, -6, 240, 378, 40, 55, -38,
                                   32, 40, 15, -2, 1, 17, 55, -2, 47, -13, -6,
                                   -38, 1, -13, 127),
                                 nrow = 5),
                          matrix(c(242, 270, 82, 10, 49, 270, 363, 83, 44, 19,
                                   82, 83, 38, -2, 15, 10, 44, -2, 45, -7, 49,
                                   19, 15, -7, 137),
                                 nrow = 5),
                          matrix(c(109, 102, 41, 11, 29, 102, 128, 34, 38, 10,
                                   41, 34, 36, -9, 16, 11, 38, -9, 56, -5, 29,
                                   10, 16, -5, 138),
                                 nrow = 5)),
             var = c("WAIST", "WEIGHT", "FAT", "HEIGHT", "AGE"))


[Package gmgm version 1.1.2 Index]