- Introduced by
- Dempster, Laird & Rubin
- Year
- 1977
- Type
- Iterative optimization algorithm
- Family
- Estimation
What does it do?
The Expectation-Maximization (EM) algorithm is an iterative procedure for finding maximum likelihood (or maximum a posteriori) estimates of model parameters when some data are missing or latent.
Dempster, Laird, and Rubin presented it in general form in their 1977 paper in the Journal of the Royal Statistical Society, Series B. Each iteration alternates an E-step, which computes the expected complete-data log-likelihood, with an M-step, which maximizes that expectation over the parameters, and the observed-data likelihood does not decrease from one iteration to the next.
The intuition behind the method
Imagine trying to learn the rules of a game by watching players whose cards you cannot see. In each round you guess what cards they likely hold given what you observe, then update your model of the rules assuming those guesses are correct. EM does exactly this: the E-step fills in the missing information probabilistically using current parameter estimates, and the M-step re-fits the model as if those filled-in values were real observations.
History
In their 1977 paper in the Journal of the Royal Statistical Society, Series B, Dempster, Laird, and Rubin presented the algorithm in a broadly applicable general form, together with theory on the monotone behaviour of the likelihood and convergence. The paper illustrates the method on missing-value problems, grouped, censored or truncated data, finite mixture models, variance component and hyperparameter estimation, iteratively reweighted least squares, and factor analysis. Later variants named in this entry, including the ECM, ECME, AECM, and SEM algorithms, extend the procedure to related problems.
When to use it
Choose EM when the data contain missing values, hidden states, or latent variables, the complete-data model is tractable, and the goal is maximum likelihood (or MAP) estimation of the model parameters. Typical examples are Gaussian mixture models, hidden Markov models, factor analysis, and missing-data imputation. The usual missing-data assumption is missing at random (MAR); when missingness depends on unobserved values (MNAR), running EM on the observed data is not sufficient without an explicit model for the missingness. Avoid EM when the E-step expectations cannot be computed in practice, when the target is a full posterior distribution rather than point estimates (MCMC or variational inference are alternatives), or when standard errors are needed and no supplementary procedure is planned. Gradient-based optimization of the marginal likelihood is an alternative when its gradients are available.
Limitations and considerations
- Converges to a local maximum or saddle point of the observed-data likelihood, so the final estimates can depend on the starting values when the likelihood is multimodal.
- Convergence is typically linear and can be slow when a large share of the information is missing, since the rate depends on the fraction of missing information.
- Requires a specified complete-data model with tractable E-step expectations; if the posterior of the latent variables has no closed form, the E-step must be approximated, which weakens the monotonicity guarantee.
- Standard EM does not return the observed-data covariance matrix of the estimates; standard errors require an additional step, such as the SEM algorithm mentioned in the history section.
- Estimates are interpretable only if the complete-data model is correctly specified and the parameters are identifiable. Under a misspecified model or non-identified parameters, EM still returns estimates, but they cannot be trusted as estimates of the target quantities.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The observed-data likelihood is monotone non-decreasing across iterations, a property established by the theory in the 1977 paper.
- Replaces a difficult maximization of the marginal likelihood with a sequence of complete-data maximizations, which are often simpler once the latent or missing values are treated as part of the model.
- Applies to a wide range of problems, including missing values, grouped, censored or truncated data, finite mixture models, and factor analysis, as illustrated in the original paper.
- For many standard models the M-step has closed-form updates, so each iteration is inexpensive to implement.
Applications
- Fitting Gaussian mixture models for clustering and density estimation
- Training hidden Markov models in sequence analysis
- Estimation and imputation of missing values in incomplete datasets
- Parameter estimation in factor analysis and latent class analysis
- Estimation with grouped, censored, or truncated data and variance component estimation
How it works
How it works
Before iteration begins, the analyst selects starting values for the unknown parameters, denoted theta-0. These can be chosen randomly, from a simplified fit, or by domain knowledge. For mixture models, starting values are often taken from hierarchical clustering or k-means solutions. The quality of initialization can affect which local maximum the algorithm converges to, which is why multiple random restarts are common practice.
Formula
\text{Choose initial parameter estimates } \theta^{(0)}Given the current parameter estimate theta-t, the E-step computes Q, the expected value of the complete-data log-likelihood over the distribution of the unobserved latent variables Z, conditioned on the observed data X. This expectation effectively replaces unknown quantities with their probabilistic estimates without committing to a single imputed value.
Formula
Q(\theta \mid \theta^{(t)}) = \mathbb{E}_{Z \mid X, \theta^{(t)}}[\log p(X, Z \mid \theta)]The M-step maximizes the Q function from the E-step with respect to theta, producing an updated estimate theta-(t+1). Because the complete-data log-likelihood is often simpler to maximize than the marginal observed-data likelihood, this step is frequently tractable even when direct maximum likelihood is not.
Formula
\theta^{(t+1)} = \arg\max_{\theta} \, Q(\theta \mid \theta^{(t)})The E- and M-steps are repeated in alternation. After each cycle, the observed-data log-likelihood is evaluated. A common practical rule stops iteration when the absolute change between successive values falls below a user-defined tolerance epsilon, as in the formula above. The 1977 paper establishes that the observed-data likelihood is non-decreasing under these iterations and derives theory on the convergence of the algorithm. A small change in the log-likelihood does not by itself guarantee that the parameters have reached a maximum, because the likelihood can change little on a flat plateau or near a saddle point. It is therefore good practice to also monitor the change in the parameter estimates and to compare solutions from several starting values.
Formula
\text{Repeat E- and M-steps until } |\ell(\theta^{(t+1)}) - \ell(\theta^{(t)})| < \epsilonCommon pitfalls
- Using a single random initialization risks terminating at a poor local maximum; run multiple restarts and select the solution with the highest final log-likelihood. A stochastic EM phase, which randomly redraws the unknown component labels between the E and M steps, can serve as an exploratory first stage. Its parameter estimates are then used as starting values for standard EM. Celeux and Govaert (1992) suggested this use of stochastic EM, and Berchtold (2004) found that such a two-stage approach gave the best results.
- Stopping on a small change in the parameter vector alone, rather than on the change in observed-data log-likelihood used in the convergence criterion above, can halt the algorithm at an inaccurate estimate.
- Applying EM when data are Missing Not At Random (MNAR) without modelling the missingness mechanism can introduce systematic bias in the estimates.
- Ignoring the label-switching problem in mixture models leads to uninterpretable component assignments even after correct convergence.
- With unrestricted covariance matrices and many components relative to the sample size, the mixture likelihood is unbounded. EM may then fail to converge and instead diverge toward a degenerate solution at a point of infinite likelihood, for example a component whose variance shrinks towards zero. Constraining or regularizing the covariance matrices, imposing a lower bound on component variances, or requiring a minimum component size are standard safeguards.
Frequently asked questions
Does the EM algorithm always converge to the global maximum?
No. EM is guaranteed only to find a local maximum (or saddle point) of the observed-data likelihood. When the likelihood surface has multiple modes, the final solution depends on initialization. Running the algorithm from several different starting points and retaining the solution with the highest log-likelihood is the standard practical remedy.
How is EM different from direct maximum likelihood optimization?
Direct MLE maximizes the observed-data log-likelihood, which may involve intractable integrals over latent variables. EM sidesteps this by iteratively maximizing the expected complete-data log-likelihood, which is often analytically tractable. The trade-off is that EM may converge slowly, whereas gradient-based methods can be faster when gradients of the marginal likelihood are available.
When should I prefer MICE imputation over the EM algorithm?
MICE (Multiple Imputation by Chained Equations) is preferable when the data include variables of mixed types, non-linear relationships, or complex interaction structures that are difficult to encode in a single parametric complete-data model. EM is more natural when a well-specified joint model for all variables exists and inference targets the model parameters rather than imputed datasets.
Related methods
Sources
Dempster, A. P., Laird, N. M., & Rubin, D. B. (1977). Maximum likelihood from incomplete data via the EM algorithm. Journal of the Royal Statistical Society: Series B, 39(1), 1–38.
Open DOI reference[Brian_S._Everitt,_Dr_Sabine_Landau,_Dr_Morven_Lee(z-lib.org), p. 151