Documentation

19.2 EM and stochastic approximation

Expectation–maximization alternates an E-step—expect complete-data quantities conditional on observations and current parameters—and an M-step—maximize using those expected quantities. In nonlinear mixed-effects models, ETAs are the missing data.

SAEM replaces the exact E-step expectation with MCMC samples and updates a running statistic:

S_k = S_(k−1) + gamma_k [sample statistic − S_(k−1)].

During burn-in, \(\gamma=1\), so the newest information replaces the stored value and permits rapid movement. During accumulation, \(\gamma=1/k\), so successive samples are averaged and stochastic noise decreases.

Sufficient statistics remember noisy samples gradually

The M-step is partly closed form and partly stochastic quasi-Newton in nlmx. MU-linked locations and OMEGA use learned moments; other THETAs and SIGMA take a complete-data optimization step blended with gamma.

Stochastic approximation needs a representative Markov chain. Decreasing gamma cannot rescue a chain confined to the wrong region. Conversely, raw sample noise during burn-in is expected and should not be mistaken for optimizer instability.

Practical interpretation

Imagine estimating a mean from a noisy stream. Replacing the estimate with every new value follows change quickly but never settles; using a running average settles but responds slowly. SAEM deliberately uses the first behavior during burn-in and the second during accumulation. Plot raw batch statistics beside \(S_k\) to see which variation is sampling noise and which represents persistent parameter drift.

Common mistakes

Do not describe SAEM as simply “randomized EM,” ignore autocorrelation, or begin averaging before chains reach a stable region. The M-step does not maximize the marginal likelihood directly each iteration.

Checklist

  • Define missing variables and conditional target.
  • Separate sampling, statistic, and parameter updates.
  • Track gamma and phase.
  • Check mixing before trusting accumulation.
  • Preserve traces and acceptance summaries.

Further reading

Next read the conditional target, then sufficient statistics.