em | R Documentation |
em
returns points estimations of the parameters of a finite mixture
model using the Expectation-Maximization (E-M) algorithm.
em(data, D1, D2, t = 1e-64)
data |
A vector of real numbers, the data to model with a finite mixture model. |
D1,D2 |
Probability distributions constituting the finite mixture model. See Details. |
t |
A numerical scalar indicating the value below which the E-M algorithm should stop. |
The finite mixture model considered in this function is a mixture of two probability distributions that are one of the following: normal, log-normal, gamma or Weibull. Each of these distributions is defined by two parameters: a location and a scale parameter:
location | scale | |
normal | mean | sd |
log-normal | meanlog | sdlog |
gamma | shape | rate |
Weibull | shape | scale |
These parameters, together with the mixture parameter, are estimated by the Expection-Maximization algorithm.
A list with class em
containing the following components:
lambda |
a numerical vector of length |
param |
the location (mu) and scale (sigma) parameters of the
probability distributions |
mu2
and lambda2
.
Chuong B. Do and Serafim Batzoglou (2008) What is the expectation
maximization algorithm? Nature Biotechnology 26(8): 897-899.
Peter Schlattmann (2009) Medical Applications of Finite Mixture Models.
Springer-Verlag, Berlin.
confint.em
method for calculating the confidence
intervals of the parameters and cutoff
for deriving a
cut-off value.
# Measles IgG concentration data: length(measles) range(measles) # Plotting the data: hist(measles,100,F,xlab="concentration",ylab="density",ylim=c(0,.55), main=NULL,col="grey") # The kernel density: lines(density(measles),lwd=1.5,col="blue") # Estimating the parameters of the finite mixture model: (measles_out <- em(measles,"normal","normal")) # The confidence interval of the parameter estimates: confint(measles_out,t=1e-64,nb=100,level=.95) # Adding the E-M estimated finite mixture model: lines(measles_out,lwd=1.5,col="red") # The legend: legend("topleft",leg=c("non-parametric","E-M"),col=c("blue","red"), lty=1,lwd=1.5,bty="n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.