# EM algorithm for Manly mixture model

### Description

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

### Usage

1 2 |

### 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 |

### Details

Runs the EM algorithm 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.

### Value

`la ` |
matrix of the estimated transformation parameters (K x p) |

`tau ` |
vector of mixing proportions (length K) |

`Mu ` |
matrix of the estimated mean vectors (K x p) |

`S ` |
array of the estimated covariance matrices (p x p x K) |

`gamma ` |
matrix of posterior probabilities (n x K) |

`id ` |
estimated membership vector (length n) |

`ll ` |
log likelihood value |

`bic ` |
Bayesian Information Criterion |

`iter ` |
number of EM iterations run |

`flag ` |
convergence flag (0 - success, 1 - failure) |

### See Also

Manly.select

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
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)
``` |