- Introduced by
- Tanner & Wong (data augmentation), Gelfand & Smith (Gibbs sampler)
- Year
- 1987–1990
- Type
- Bayesian computational method
- Family
- Bayesian / computational
What does it do?
Gibbs sampling with missing data treats unobserved values as additional unknowns alongside the model parameters and samples both within a Markov chain Monte Carlo loop.
The sampler alternates between drawing the missing values given the current parameters and drawing the parameters given the completed data, so the output is a joint posterior over the missing values and the parameters.
The intuition behind the method
Imagine a dataset with some cells erased. You do not know the true values, but you have a model that describes how the data were generated. Each iteration first fills the blanks using the current parameter values, then updates the parameters as if the filled-in data had been observed. Unlike an optimiser, this procedure does not settle on a single answer: the chain keeps moving, and after a burn-in period its saved draws are treated as samples from the joint posterior of parameters and missing values. Because the missing values are redrawn at every iteration, uncertainty about them carries into the parameter draws rather than being hidden behind one filled-in value.
History
The underlying idea is Tanner and Wong's 1987 data augmentation algorithm, which augments the observed data with latent values and alternates between sampling those values and the parameters. This alternation is the scheme described on this page. Little and Rubin's Statistical Analysis with Missing Data is the standard reference for missing-data methods of this kind. Later software such as BUGS and JAGS let missing values be declared as unknown nodes in the model, which made the approach routine. Stan can also fit such models, with missing continuous values treated as parameters, although it uses Hamiltonian Monte Carlo rather than Gibbs updates.
When to use it
Choose this method when you are fitting a Bayesian model to data with missing values and want the missingness handled inside that model, rather than by discarding incomplete cases or running a separate imputation step first. It is most useful when the missing-data pattern is complex, when predictors of missingness are available and should enter the model, or when uncertainty from the missing values must propagate into the parameter posterior. Do not choose it when missingness is plausibly MNAR and no model for the mechanism can be justified, when only a small amount of missingness needs quick handling before a standard analysis, or when computing time is the binding constraint and a simpler multiple-imputation procedure would suffice.
Limitations and considerations
- Requires a joint model for all partially observed variables, which becomes harder to specify and check as the number of variables grows.
- Valid under MAR or MCAR; under MNAR an additional model for the missingness mechanism is required, and the results depend on that model.
- Computational cost grows with the number of missing values and the complexity of the model.
- Mixing can be slow when the missing-data rate is high or when parameters are strongly correlated, so long chains and convergence checks are needed.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Handles missing data and parameter estimation in one probabilistic model, with no separate imputation stage.
- Propagates uncertainty from both the missing values and the parameter estimation into the posterior credible intervals.
- Accommodates structured or multivariate missing-data patterns, provided the joint model can be written down and each full conditional can be sampled.
- Auxiliary variables that predict missingness can be included directly in the joint model.
- Produces multiple completed datasets as a by-product of the chain, usable for secondary analyses.
Applications
- Epidemiological cohort studies where patient records have partially missing covariates.
- Longitudinal panel data with dropout or intermittent non-response.
- Multivariate Bayesian structural equation models with incomplete outcome measures.
- Survey data analysis where item non-response affects several variables simultaneously.
- Clinical trials with informative censoring modelled under a sensitivity analysis.
- Educational testing with partially administered item banks (missing by design).
How it works
How it works
Write the joint distribution of observed data, missing data and parameters. This requires a likelihood for the complete data and priors for all parameters. The standard approach treats the missing-data mechanism as ignorable, which holds under missing at random (MAR) or missing completely at random (MCAR); if data are missing not at random (MNAR), the mechanism itself must be modelled.
Formula
p(Y_{obs}, Y_{mis}, \theta) = p(Y_{obs}, Y_{mis} \mid \theta)\, p(\theta)At each iteration, draw the missing values from their full conditional distribution given the current parameters and the observed data. This is the imputation (I) step of Tanner and Wong's data augmentation. Because the missing values are drawn rather than fixed at a point estimate, their uncertainty carries into later steps.
Formula
Y_{mis}^{(t+1)} \sim p(Y_{mis} \mid Y_{obs}, \theta^{(t)})Using the completed dataset from the previous step, draw new parameter values from their full conditional distribution. With conjugate priors these conditionals have closed forms (for example Normal, Gamma or Dirichlet), so each draw is cheap. Non-conjugate conditionals typically require a Metropolis-within-Gibbs step.
Formula
\theta^{(t+1)} \sim p(\theta \mid Y_{obs}, Y_{mis}^{(t+1)})Repeat the imputation and parameter steps for many cycles. The early draws (burn-in) are discarded so that the chain can move away from its starting values. Convergence is checked with diagnostics such as R-hat across several chains and inspection of trace plots, because successive draws are correlated and the chain only converges in distribution to the target.
Posterior summaries for parameters (means, medians, credible intervals) are computed from the post-burn-in draws. Completed datasets for downstream analyses can be formed by thinning the chain and saving the imputed values at retained iterations.
Common pitfalls
- Assuming MAR without a sensitivity analysis when missingness may depend on the unobserved values.
- Replacing imputed values with posterior means instead of drawing them from the full conditional, which understates uncertainty.
- Reporting results without convergence diagnostics (R-hat, effective sample size) or using draws taken before burn-in ends.
- Leaving out variables that predict missingness from the imputation model, which can bias estimates.
- Analysing one completed dataset as if its imputed values were observed, which ignores the remaining imputation uncertainty.
- Relying on default or weakly informative priors without checking their influence on the posterior, particularly for variance parameters when data are sparse.
- In mixture-type models, label switching across chains can make parameter summaries meaningless unless identifiability constraints are imposed.
Frequently asked questions
How does this differ from multiple imputation by chained equations (MICE)?
MICE imputes each variable sequentially using a series of regression models and then fits the substantive model on the completed datasets, combining estimates with Rubin's rules. Gibbs sampling with missing data performs imputation and model fitting simultaneously within a single Bayesian model, giving coherent uncertainty propagation without a separate combination step. The Bayesian approach is more principled but requires specifying a full joint model.
Do I need to worry about the missing-data mechanism?
Yes. The standard approach is valid when data are missing at random (MAR), meaning missingness depends only on observed quantities. If missingness depends on the unobserved values themselves (MNAR), you must model the missing-data mechanism explicitly or conduct sensitivity analyses. Complete-case analysis and standard imputation methods also rely on assumptions about the mechanism and should be judged on the same basis.
Can the method handle mixed variable types (continuous, binary, ordinal)?
Yes. Each variable type is given an appropriate conditional model, such as Normal for continuous, logistic for binary and ordered logit for ordinal, and a sampling step is derived for each. For non-conjugate conditionals such as the logistic, a Metropolis-within-Gibbs step is typically used. In practice, software such as JAGS and Stan lets you specify the likelihood for each observed node and treat missing nodes as unknowns. Whether a missing discrete value can be sampled directly depends on the software: some samplers require discrete unknowns to be marginalised out of the model, so the available sampling options should be checked before the model is built.
How many iterations are typically needed?
The number depends on the model, the amount of missing data and how quickly the chain mixes, so no fixed count can be prescribed. Run several chains from dispersed starting values, discard an initial burn-in, and extend the run until convergence diagnostics such as R-hat and effective sample size are satisfactory for the quantities being reported. If the diagnostics fail, the run should be lengthened or the model reparameterised.
What software supports this approach?
JAGS and Stan allow missing values to be declared as unknowns and sample them during the Gibbs or HMC sweep. The R packages rjags, R2jags, rstan, and brms all support this workflow. In Python, PyMC and NumPyro offer equivalent functionality.
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 referenceLittle, R. J. A. & Rubin, D. B. (2002). Statistical Analysis with Missing Data (2nd ed.). Wiley.
ISBN: 978-0471183860