R: Expectation-Maximisation for a mixture of exponential...
EM.mixexp
R Documentation
Expectation-Maximisation for a mixture of exponential distributions
Description
Experimental function for Expectation-Maximisation (EM) estimation
Usage
EM.mixexp(x, m = 2)
Arguments
x
Sample vector with values >0.
m
Number of mixture components.
Details
The EM algorithm is very simple for exponential mixtures (as well as
for many other mixture models).
According to a general feature of EM, this iterative method leads to
successive estimates with increasing likelihood but which may
converge to a local maximum of the likelihood.
Value
List with
estimate
Estimated values as a named vector.
logL
Vector giving the log-likelihood for successive iterations.
Alpha
Matrix with m columns giving probability weights for
successive iterations. Row with number it contains the
m probabilities at iteration it.
Theta
Matrix with m columns giving the estimates of the
m expectations for the successive iterations
Note
The estimation is done for expectation (inverse rates) but the
estimate vector in the result contains rates for compatibility
reasons (e.g with exponential).
Author(s)
Yves Deville
See Also
mom.mixexp2 and ini.mixexp2 for "cheap"
estimators when m = 2.
Examples
set.seed(1234)
x <- rmixexp2(n = 100, prob1 = 0.5, rate2 = 4)
EM.mixexp(x) -> res
res$estimate
matplot(res$Theta, type = "l", lwd = 2,
xlab = "iteration", ylab = "theta",
main = "exponential inverse rates")
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(Renext)
Loading required package: evd
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Renext/EM.mixexp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: EM.mixexp
> ### Title: Expectation-Maximisation for a mixture of exponential
> ### distributions
> ### Aliases: EM.mixexp
>
> ### ** Examples
>
> set.seed(1234)
> x <- rmixexp2(n = 100, prob1 = 0.5, rate2 = 4)
> EM.mixexp(x) -> res
> res$estimate
prob1 prob2 rate1 rate2
0.5844083 0.4155917 1.2991665 4.7291873
> matplot(res$Theta, type = "l", lwd = 2,
+ xlab = "iteration", ylab = "theta",
+ main = "exponential inverse rates")
>
>
>
>
>
> dev.off()
null device
1
>