A matrix of observations where rows correspond to features and
columns to experiments.
theta
A list of parameters as described in rtheta.
eps
The maximal required difference in successive likelihoods to
establish convergence.
max.ite
The maximum number of iterations.
trace.theta
Logical. If TRUE, all estimates are stored and
returned. Default is FALSE.
verbose
Set to TRUE for verbose output. Default is
FALSE.
Details
Though not as versatile, the algorithm can be a faster alternative to
Mclust in the mclust-package.
Value
A list of length 3 with elements:
theta
A list of the estimated parameters as described in
rtheta.
loglik.tr
A numeric vector of the log-likelihood trace.
kappa
A matrix where kappa[i,j] is the probability that
x[i, ] is realized from the j'th component.
Author(s)
Anders Ellern Bilgrau <anders.ellern.bilgrau@gmail.com>
See Also
rtheta, PseudoEMAlgorithm
Examples
set.seed(10)
data <- SimulateGMCMData(n = 1000, d = 2, m = 3)
start.theta <- rtheta(d = 2, m = 3)
res <- GMCM:::EMAlgorithm(data$z, theta = start.theta)
par(mfrow = c(1,2))
plot(data$z, cex = 0.5, pch = 16, main = "Simulated data",
col = rainbow(3)[data$K])
plot(data$z, cex = 0.5, pch = 16, main = "GMM clustering",
col = rainbow(3)[apply(res$kappa,1,which.max)])
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GMCM)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GMCM/EMAlgorithm.Rd_%03d_medium.png", width=480, height=480)
> ### Name: EMAlgorithm
> ### Title: EM algorithm for Gaussian mixture models
> ### Aliases: EMAlgorithm
>
> ### ** Examples
>
> set.seed(10)
> data <- SimulateGMCMData(n = 1000, d = 2, m = 3)
> start.theta <- rtheta(d = 2, m = 3)
> res <- GMCM:::EMAlgorithm(data$z, theta = start.theta)
>
> par(mfrow = c(1,2))
> plot(data$z, cex = 0.5, pch = 16, main = "Simulated data",
+ col = rainbow(3)[data$K])
> plot(data$z, cex = 0.5, pch = 16, main = "GMM clustering",
+ col = rainbow(3)[apply(res$kappa,1,which.max)])
>
>
>
>
>
> dev.off()
null device
1
>