- Introduced by
- Carlin and Chib
- Year
- 1995
- Type
- Bayesian model selection via MCMC
- Family
- Bayesian / computational
What does it do?
Gibbs sampling for model comparison, usually called the Carlin–Chib approach, is a Bayesian MCMC method that samples a discrete model index together with the parameters of every competing model.
Posterior model probabilities are estimated from the share of iterations the chain spends at each model index, so each model does not need a separate fit. Carlin and Chib (1995) introduced the framework for Bayesian model choice by MCMC, with an algorithm designed to avoid the convergence difficulties that can arise when comparing models.
The intuition behind the method
Think of all candidate models as parts of one augmented probability space, with a discrete index that records which model is currently active. The Gibbs sampler moves through this joint space, and the fraction of iterations spent at each index estimates that model's posterior probability. The parameters of inactive models are not discarded. They are updated from pseudo-priors, which keep them in plausible regions so the chain can switch back to those models. Because one chain visits every model, no separate fit per model is required.
History
Carlin and Chib (1995) introduced this approach in a paper on Bayesian model choice via MCMC, published in the Journal of the Royal Statistical Society, Series B. Their framework is an MCMC algorithm designed to avoid the convergence difficulties that arise when comparing models, and it applies to problems with integer-valued parameters, multiple changepoints and finite mixtures. Reversible-jump MCMC addresses a related model-comparison problem by a different route and is a separate method.
When to use it
Use Gibbs sampling for model comparison when you have a small set of clearly specified Bayesian models and want joint posterior probabilities for all of them from one run. It suits models that share parameters or have a conditional structure that allows Gibbs updates. Prefer it to reversible-jump MCMC when the candidate models have fixed, separate parameter spaces, since all parameter vectors are carried in the state. Do not use it when the number of candidate models is large, because each model needs pseudo-priors and the computation grows with the set. Avoid it when full conditionals cannot be sampled for the model parameters; Metropolis-Hastings or sequential Monte Carlo may then be more practical.
Limitations and considerations
- Mixing across models depends on the pseudo-priors; poorly chosen pseudo-priors make the chain switch models rarely.
- Every candidate model's parameter vector is kept in the state, so computation and storage grow with the number of models.
- Pseudo-prior calibration adds setup work and may require preliminary fits of each candidate model.
- The Gibbs scheme needs full conditionals that can be sampled for every model's parameters; if they cannot, the scheme does not apply directly.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Gives posterior probabilities for all candidate models from a single MCMC run.
- Model probabilities reflect parameter uncertainty within each model, because the parameters are sampled rather than optimised.
- Works efficiently when parameter blocks have closed-form or easily sampled full conditionals.
- Samples from the visited models can be pooled to form model-averaged quantities, such as predictions, without a separate averaging step.
- Avoids a separate numerical integration of the marginal likelihood for each candidate model.
Applications
- Comparing regression models with different covariate sets in biomedical or social science data when only a few candidates are plausible.
- Choosing between parametric families for survival or count data within one MCMC run.
- Bayesian variable selection when the candidate models form a small, pre-specified set of predictor subsets.
- Choosing the number of components in a finite mixture or the number of changepoints, problem types covered in the Carlin and Chib (1995) abstract.
- Model-averaged predictions in which weakly supported candidate models receive small posterior weight.
How it works
How it works
Specify K competing models M1, ..., MK, each with its own parameter vector theta_k and likelihood. Assign prior probabilities p(k) over models and priors p(theta_k | k) over each model's parameters.
For each model k, specify a pseudo-prior for the parameters of every other model j != k. Pseudo-priors are a free design choice: they do not change the target posterior over models, but they strongly influence how often the chain switches between models. Choices that approximate each model's own posterior, for example from a preliminary run, are often used in practice to improve switching. Check the detailed calibration procedure in Carlin and Chib (1995) before use.
Augment the state space with the model index k as a discrete variable, so the sampler moves over (k, theta_1, ..., theta_K). The joint target is p(k, theta_1, ..., theta_K | y) ∝ p(y | theta_k, k) p(theta_k | k) p(k) ∏_{j≠k} p_j(theta_j | k), where p_j is the pseudo-prior for model j's parameters when model k is active. All parameter vectors are kept in the state at every iteration. The pseudo-prior factors integrate out of the marginal posterior over models, so they affect mixing but not the target model probabilities.
Formula
p(k, \theta_k \mid y) \propto p(y \mid \theta_k, k)\, p(\theta_k \mid k)\, p(k)
Each iteration has two stages. First, the model index k is drawn from its full conditional under the joint target. For each candidate model, this weights the model prior, the likelihood and the parameter prior against the pseudo-prior terms for the other models' parameters. Second, the parameters of the active model are updated from their full conditionals, while the parameters of each inactive model are updated from its pseudo-prior. For example, with two normal regressions that use different covariates, the index draw compares the two weighted terms, and the inactive regression's coefficients are drawn from its pseudo-prior. These sweeps are repeated for a monitored sampling period after burn-in.
Posterior model probabilities are estimated by the empirical frequency with which the chain visits each model index k. The Bayes factor between two models is estimated as (P-hat1 / P-hat2) divided by (p(1) / p(2)). This requires nonzero prior mass on each model and is unreliable when either estimated probability rests on few visits. Estimates are stable only when the chain has visited each model many times; the Monte Carlo error of each P-hat can be assessed, for example, with batch means.
Formula
\hat{P}(M_k \mid y) = \frac{1}{T}\sum_{t=1}^{T}\mathbf{1}[k^{(t)}=k]Common pitfalls
- Using diffuse pseudo-priors for inactive models, which leads to very poor switching and unreliable model probability estimates.
- Reading model probabilities before the chain has mixed across models; check the model-index trace after burn-in.
- Changing the prior model probabilities p(k) and expecting the posterior model probabilities to stay the same, since they depend on p(k) directly.
- Confusing a check on pseudo-prior calibration with a check on model adequacy: the first concerns sampler mixing, while the second concerns whether the candidate models fit the data.
- Applying the method to a large candidate set without first reducing it, since calibration effort grows with the number of models.
- Trusting estimated probabilities or Bayes factors for models with very few visits; report Monte Carlo standard errors (for example from batch means) alongside the estimates.
Frequently asked questions
What is a pseudo-prior and why does it matter?
A pseudo-prior is a density placed on the parameters of a model while that model is inactive. Those parameters are still updated, so the state stays fully defined and the chain can switch back to the model. If the pseudo-prior is too diffuse, the inactive parameters often land in regions of low likelihood when the chain returns, so switching is rare. A pseudo-prior close to the marginal posterior of that model generally improves switching.
How does this differ from reversible-jump MCMC?
Reversible-jump MCMC (RJMCMC) handles models of different dimensionality by proposing jumps between model spaces and using Jacobian corrections. Carlin-Chib Gibbs sampling keeps all parameter vectors in the state at all times, which is simpler to implement when model dimensions are fixed and moderate but wasteful when there are many models with many parameters.
How many competing models can I realistically compare?
This approach is usually practical for a small set of candidate models. As the set grows, pseudo-prior calibration becomes more work, and the chain spends less time at each index, which increases Monte Carlo error in the probability estimates. For large model spaces, stochastic search or SMC-based approaches are usually considered instead.
Can I use this for Bayesian model averaging?
Yes. Once the chain has run, any posterior quantity, such as a prediction or an effect size, can be averaged across sampled models weighted by their visit frequency. This is a natural implementation of Bayesian model averaging, propagating both parameter and model uncertainty into the final estimate.
How do I check that the chain is switching models properly?
Plot the model-index trace over iterations. Good mixing shows frequent alternation among models. If the chain stays in one model for long stretches before switching, the pseudo-priors are probably poorly calibrated. You can also compute the effective sample size of the model-index sequence as a mixing diagnostic.
Related methods
Sources
Carlin, B. P. & Chib, S. (1995). Bayesian model choice via Markov chain Monte Carlo methods. Journal of the Royal Statistical Society, Series B, 57(3), 473-484.
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