- Introduced by
- Metropolis et al. (1953); missing-data extension formalised by Tanner & Wong (1987)
- Year
- 1953 / 1987
- Type
- MCMC sampler with latent-variable augmentation
- Family
- Bayesian / computational
What does it do?
Metropolis-Hastings with missing data treats unobserved values as latent variables and samples them together with the model parameters in one MCMC chain.
The missing values are added to the target distribution, so the posterior reflects uncertainty about what was not observed. Incomplete cases are not discarded, and no separate imputation stage is run before the analysis.
The intuition behind the method
Imagine the missing values as unknown parameters that need to be estimated alongside the model coefficients. At each MCMC iteration the algorithm proposes new parameter values, decides whether to accept them using the Metropolis-Hastings ratio, and then draws plausible values for the missing observations given the current parameters. Over many iterations the chain explores the joint posterior of parameters and missing values, so the uncertainty about what was not observed is carried into the parameter summaries.
History
The Metropolis et al. (1953) algorithm, from which Metropolis-Hastings derives, was introduced for sampling from distributions known only up to a constant. Its generalisation to asymmetric proposals is the form used today. Tanner and Wong (1987) introduced data augmentation, an iterative scheme that alternates between imputing the missing or latent data given the parameters and drawing the parameters given the completed data. Embedding a Metropolis-Hastings parameter update inside this loop, as described on this page, is a later generalisation of that scheme.
When to use it
Use this method when a Bayesian model has missing observations, such as outcomes or covariates, and the posterior should include the uncertainty about those values. It is useful when the model is non-conjugate or hierarchical, so that closed-form updates are not available for every block. It fits data that are missing at random (MAR), where the missingness mechanism is ignorable, and it can be extended to missing not at random (MNAR) when the missingness mechanism is modelled explicitly. Do not use it when missingness is negligible, because the added cost is hard to justify. Pure Gibbs sampling is simpler and more efficient when closed-form conditionals exist for all blocks. A very large dataset with many missing cells can also make the per-iteration cost prohibitive.
Limitations and considerations
- Each iteration updates every missing cell as well as the parameters, so the cost grows with the number of missing values and not only with the sample size.
- The parameter proposal is tuned for the parameter block only. When the missing values carry much of the information about a parameter, parameters and imputations are strongly coupled and the chain can mix slowly.
- Convergence must be checked for the imputed values as well as for the parameters.
- When a large share of the data is missing, the posterior can be dominated by the prior, so prior sensitivity analysis is essential.
- MNAR models require a correctly specified missingness mechanism. This is usually not identifiable from the observed data alone without strong assumptions.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The target is the joint posterior of parameters and missing values, so parameter intervals already include uncertainty about the missing cells and no separate variance correction is needed.
- The acceptance step uses only ratios of posterior densities, so the normalising constant never has to be computed. This allows non-conjugate likelihoods and hierarchical structures.
- Missing values are sampled at every iteration, so their marginal posterior distributions are returned alongside the parameter summaries.
- Under MAR the missingness mechanism is ignorable and does not need to be modelled; under MNAR an explicit missingness model can be added to the augmented target.
- Posterior predictive checks and model comparison with WAIC or LOO-CV can be applied directly, because full posterior draws are available.
Applications
- Clinical trials and epidemiological cohort studies where item nonresponse or dropout creates missing outcome or covariate data.
- Longitudinal studies with intermittent measurement, where Bayesian state-space models are fitted with imputed latent states.
- Social-science surveys with partial responses, using hierarchical Bayesian models that impute missing items jointly.
- Ecological occupancy models where species detection is imperfect, treating undetected occurrences as missing data.
- Financial time-series models with trading halts or reporting gaps, imputing unobserved returns inside an MCMC loop.
- Genetic association studies with missing genotypes, where haplotype phase uncertainty is resolved through data augmentation.
How it works
How it works
The key idea, formalised by Tanner and Wong (1987), is data augmentation: the missing data Z_mis are introduced as additional unknowns. The target becomes the joint posterior of parameters theta and Z_mis given observed data Y_obs. Because this joint density is proportional to the complete-data likelihood times the prior, standard MCMC machinery can be applied to the augmented space.
Formula
p(\theta, Z_{\text{mis}} \mid Y_{\text{obs}}) \propto p(Y_{\text{obs}}, Z_{\text{mis}} \mid \theta)\, p(\theta)At each iteration a parameter proposal theta* is drawn from a proposal distribution q(theta* | theta). Common choices are a random-walk Gaussian centred on the current state, or an adaptive proposal whose covariance is tuned to the empirical posterior during warm-up. This step updates only the parameter block, with Z_mis held at its current value.
The proposed parameters are accepted with probability alpha, the minimum of 1 and the Metropolis-Hastings ratio. The ratio compares posterior densities at theta* and theta, corrected for the asymmetry of the proposal. Because Z_mis is held fixed during this step, the densities are conditional on the current Z_mis; the conditional posterior is proportional to the joint target at that fixed Z_mis, so the factor depending only on Z_mis cancels. If the proposal is accepted the chain moves to theta*, otherwise it stays at theta.
Formula
\alpha = \min\!\left(1,\, \frac{p(\theta^* \mid Y_{\text{obs}}, Z_{\text{mis}})\, q(\theta \mid \theta^*)}{p(\theta \mid Y_{\text{obs}}, Z_{\text{mis}})\, q(\theta^* \mid \theta)}\right)After the parameter update, missing values Z_mis are drawn from their conditional distribution p(Z_mis | Y_obs, theta) given the current parameters. This happens inside the same iteration, so imputation is part of the MCMC loop rather than a one-off stage before it. If no closed-form conditional is available, this draw can itself be a Metropolis-Hastings proposal, which makes the overall scheme a Metropolis-within-Gibbs hybrid. Each sampled Z_mis is a complete dataset consistent with the current parameter values.
After a burn-in period, posterior summaries are computed from the retained samples. Parameter estimates are posterior means or medians with 95% credible intervals. Because missing values are sampled at every iteration, their marginal posterior distribution is also available, and predictions can propagate uncertainty about what was unobserved.
Common pitfalls
- Too few iterations: the chain may not have mixed across the joint space of parameters and imputed values, so the summaries are unreliable.
- Taking a single sampled set of imputations as fixed data and analysing it, which understates the uncertainty about the missing values.
- Assuming the data are MCAR when they are MAR or MNAR, which can bias the posterior.
- A random-walk proposal that is too wide or too narrow without adaptive tuning, which produces very low acceptance rates or slow exploration.
- An imputation model that is incompatible with the analysis model, which can induce systematic bias in the parameters.
Frequently asked questions
How is this different from multiple imputation followed by pooled analysis?
Multiple imputation (MI) separates imputation from analysis: m imputed datasets are created, analysed independently, and the results are pooled with Rubin's rules. Metropolis-Hastings with data augmentation integrates both steps into a single MCMC chain. This is more coherent for complex or hierarchical models, where the imputation and analysis models must be compatible. For simpler models the two approaches often give similar results.
Do I need to model the missingness mechanism explicitly?
Only if the data are missing not at random (MNAR). If missingness depends only on observed variables (MAR), the mechanism is ignorable and you need only model the complete-data likelihood. For MNAR you must specify and fit a joint model for the data and the missingness, which is rarely identifiable without strong assumptions.
How do I diagnose convergence when missing values are also being sampled?
Run multiple chains from dispersed starting values and compute R-hat and effective sample size (ESS) for the model parameters and for summaries of the imputed values, such as the imputed means and tail quantiles. R-hat values near 1.01 or below and an ESS above a few hundred are common conventions rather than hard criteria, and the adequate ESS depends on the quantity. ESS for imputed values can be much lower than for parameters, so each monitored quantity should be checked separately.
Can Stan or JAGS handle this automatically?
JAGS handles missing data natively by treating NA nodes as additional unknowns sampled within the MCMC loop. Stan requires explicit declaration of the missing-data parameters and an augmented likelihood. Both approaches implement the same statistical principle: data augmentation inside MCMC.
What acceptance rate should I target?
For a random-walk Metropolis-Hastings proposal, theoretical results for high-dimensional targets suggest acceptance rates near 23%, and rates near 44% for a single scalar parameter. These are asymptotic guidelines. Adaptive MCMC schemes adjust the proposal covariance during warm-up to move toward these targets.
Related methods
Sources
Tanner, M. A. & Wong, W. H. (1987). The calculation of posterior distributions by data augmentation. Journal of the American Statistical Association, 82(398), 528-540.
Open DOI referenceGelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A. & Rubin, D. B. (2013). Bayesian Data Analysis (3rd ed.). CRC Press.
ISBN: 978-1439840955