Learn R Programming

ManlyMix (version 0.1.2)

Manly.EM: EM algorithm for Manly mixture model

Description

Runs the EM algorithm for a Manly mixture model with specified initial membership and transformation parameters.

Usage

Manly.EM(X, id = NULL, la = NULL, tau = NULL, Mu = NULL, S = NULL, 
tol = 1e-5, max.iter = 1000)

Arguments

X
dataset matrix (n x p)
id
initial membership vector (length n)
la
initial transformation parameters (K x p)
tau
initial vector of mixing proportions (length K)
Mu
initial matrix of mean vectors (K x p)
S
initial array of covariance matrices (p x p x K)
tol
tolerance level
max.iter
maximum number of iterations

Value

  • lamatrix of the estimated transformation parameters (K x p)
  • tauvector of mixing proportions (length K)
  • Mumatrix of the estimated mean vectors (K x p)
  • Sarray of the estimated covariance matrices (p x p x K)
  • gammamatrix of posterior probabilities (n x K)
  • idestimated membership vector (length n)
  • lllog likelihood value
  • bicBayesian Information Criterion
  • iternumber of EM iterations run
  • flagconvergence flag (0 - success, 1 - failure)

Details

Runs the EM algorith for a Manly mixture model for a provided dataset. Manly mixture model assumes that a multivariate Manly transformation applied to each component allows to reach near-normality. A user has a choice to specify either initial id vector 'id' and transformation parameters 'la' or initial mode parameters 'la', 'tau', 'Mu', and 'S'. In the case when transformation parameters are not provided, the function runs the EM algorithm without any transformations, i.e., it is equivalent to the EM algorithm for a Gaussian mixtuire model. If some transformation parameters have to be excluded from the consideration, in the corresponding positions of matrix 'la', the user has to specify value 0. Notation: n - sample size, p - dimensionality of the dataset X, K - number of mixture components.

See Also

Manly.select

Examples

Run this code
set.seed(123)

K <- 3; p <- 4
X <- as.matrix(iris[,-5])
id.true <- rep(1:K, each = 50)

# Obtain initial memberships based on the K-means algorithm
id.km <- kmeans(X, K)$cluster

# Run the EM algorithm for a Gaussian mixture model based on K-means solution
A <- Manly.EM(X, id.km)
id.Gauss <- A$id

table(id.true, id.Gauss)

# Run the EM algorithm for a Manly mixture model based on Gaussian mixture solution
la <- matrix(0.1, K, p)
B <- Manly.EM(X, id.Gauss, la)
id.Manly <- B$id

table(id.true, id.Manly)

Run the code above in your browser using DataLab