MCMC for Model Comparison

Statistics
Introduced by
Peter J. Green (reversible-jump MCMC); Meng & Wong (bridge sampling)
Year
1995
Type
Bayesian computational method
Family
Bayesian / computational

What does it do?

MCMC for model comparison uses Markov chain Monte Carlo algorithms to estimate the marginal likelihoods and Bayes factors needed to compare competing statistical models formally.

Reversible-jump MCMC samples across models of different dimensionality within a single run, while bridge sampling estimates the marginal likelihood of each model separately. Both routes yield posterior model probabilities that can support fully Bayesian model averaging.

The intuition behind the method

To compare models under the Bayesian framework you need the marginal likelihood — the probability of the data averaged over all plausible parameter values under each model. This integral is rarely tractable analytically. MCMC-based methods solve this by drawing samples either within each model (to estimate its marginal likelihood) or simultaneously across models (jumping between them), so the relative support for each model emerges from the proportion of time the chain spends there. The resulting Bayes factor gives a principled measure of evidence that automatically penalises unnecessary complexity.

History

The marginal likelihood as a model-comparison criterion is usually traced to Jeffreys' work on Bayesian hypothesis testing. Green (1995) introduced reversible-jump MCMC, which allowed MCMC to move between models of different dimensionality. Meng and Wong (1996) described bridge sampling for estimating ratios of normalizing constants. Support for these estimators differs across Bayesian software, so availability should be checked for the specific tool and model.

When to use it

Use MCMC for model comparison when you need a fully Bayesian comparison of models that differ in structure or dimensionality, such as regression models with different covariate sets, mixture models with different numbers of components, or competing dynamic specifications. It is most useful when you need posterior model probabilities for model averaging, or when approximate criteria such as AIC, BIC or WAIC may not reflect the comparison you care about. Avoid it when the number of candidate models is too large to handle, since the size of the model space makes the computation infeasible, or when computing time is the binding constraint and an approximate criterion answers the question adequately. The parameter priors must be proper for the comparison to be defined, because improper priors leave the marginal likelihood undefined.

Limitations and considerations

  • Marginal likelihoods are difficult to estimate; the harmonic-mean shortcut is unstable and should be replaced by more robust estimators.
  • Reversible-jump proposals between models of different dimension are hard to design; poorly chosen bijections give low acceptance rates and slow mixing across models.
  • Computationally demanding, because each candidate model needs its own sampling and marginal likelihood estimation, and reversible-jump runs add trans-dimensional moves on top.
  • Results depend on the prior placed on parameters, because the marginal likelihood integrates over that prior.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Targets posterior model probabilities directly, rather than the asymptotic approximations used by information criteria such as AIC and BIC.
  • Reversible-jump MCMC explores models of different dimensionality within a single run, with the acceptance ratio preserving detailed balance across the joint model space.
  • Posterior model probabilities feed directly into Bayesian model-averaged predictions, weighted by each model's posterior probability.
  • Complexity is penalised through the marginal likelihood, which integrates over the prior, so no separate penalty term is added.
  • Any likelihood and prior that can be evaluated within the sampler can be used, so the method is not restricted to exponential family models.

Applications

  • Variable selection in regression — comparing models that include different subsets of predictors.
  • Mixture model order selection — determining the number of components in a finite mixture.
  • Phylogenetic model comparison in evolutionary biology — choosing substitution models for DNA data.
  • Comparing structural equation models or latent variable specifications in psychology and social science.
  • Signal detection and change-point problems where the number of change-points is unknown.
  • Model comparison for state-space and hidden Markov models in econometrics and finance.

How it works

How it works

1

For each candidate model M_k the marginal likelihood integrates out all parameters: p(y | M_k) = integral p(y | theta, M_k) p(theta | M_k) d(theta). This quantity is the normalising constant of the posterior and is typically intractable in closed form, motivating MCMC-based approximations.

Formula
p(\mathbf{y} \mid M_k) = \int p(\mathbf{y} \mid \theta_k, M_k)\, p(\theta_k \mid M_k)\, d\theta_k
2

The Bayes factor BF_12 is the ratio of marginal likelihoods for two models. Values greater than one favour model 1; values less than one favour model 2. Verbal labels such as Jeffreys' scale run from weak to decisive evidence; they are descriptive conventions rather than decision thresholds, so a Bayes factor should not be the sole basis for choosing a model. Bayes factors automatically penalise over-parameterised models through the prior predictive weighting.

Formula
BF_{12} = \frac{p(\mathbf{y} \mid M_1)}{p(\mathbf{y} \mid M_2)}
3

Reversible-jump MCMC (Green 1995) extends standard MCMC by allowing trans-dimensional moves: the chain can jump between models with different numbers of parameters by proposing parameter-dimension-matching bijections. The acceptance ratio is constructed so that detailed balance holds across the joint model space, so the stationary distribution covers all models simultaneously. In finite mixture models, for example, jumps add or delete components or split and merge existing ones, and the posterior of the number of components can be estimated from the relative frequency with which the chain visits each model.

4

Bridge sampling (Meng & Wong 1996) estimates the ratio of two marginal likelihoods from posterior samples drawn separately for each model, combined through a bridging density. It compares models pairwise by estimating each normalising constant, rather than moving between models, so it is not itself a trans-dimensional sampler. Because it relies on posterior draws from each model, the accuracy of each estimate depends on how well that model's sampler has explored its posterior. Thermodynamic integration is an alternative that estimates log marginal likelihoods from a sequence of temperature-tempered chains.

5

Dividing each model's marginal likelihood by the sum across all candidates — after weighting by prior model probabilities p(M_k) — yields the posterior model probabilities p(M_k | y). These can feed directly into Bayesian model averaging, where predictions are averaged across models proportionally to their posterior probability.

Formula
p(M_k \mid \mathbf{y}) \propto p(\mathbf{y} \mid M_k)\, p(M_k)

Common pitfalls

  • Using the harmonic mean estimator for marginal likelihoods: it can have infinite variance, so its estimates are often unstable.
  • Poorly designed trans-dimensional proposal distributions in RJMCMC that prevent the chain from mixing across models.
  • Ignoring prior sensitivity: the Bayes factor depends heavily on the prior placed on parameters, especially diffuse or improper priors.
  • Confusing model-selection posterior probabilities with frequentist p-values or treating them as fixed truths rather than summaries of uncertainty.
  • Failing to check MCMC convergence diagnostics (R-hat, trace plots) separately within each model.
  • Trusting an RJMCMC run without checking how often the chain visits each candidate model and the acceptance rates of the dimension-changing moves; a model that is rarely visited may reflect poor mixing rather than low support.
  • Reporting a Bayes factor or posterior model probability without an estimate of its Monte Carlo error; repeating the run with different seeds shows whether the reported values are stable.

Frequently asked questions

What is a Bayes factor and how do I interpret it?

A Bayes factor BF_12 is the ratio of marginal likelihoods: how much more likely the data are under model 1 than under model 2. Verbal labels such as Jeffreys' scale run from weak to decisive evidence; they are descriptive conventions rather than decision thresholds, so a Bayes factor should not be the sole basis for choosing a model. Values close to one indicate that the data do not discriminate well between the models.

Why is the harmonic mean estimator of the marginal likelihood unreliable?

The harmonic mean estimator computes the reciprocal of the average inverse likelihood over MCMC samples. Although it can converge in principle, its variance can be infinite, so estimates may be unstable even with long chains. Bridge sampling or thermodynamic integration should be used instead.

Is RJMCMC the same as Bayesian model averaging?

They are related but distinct. RJMCMC is an algorithm that samples across a joint model space simultaneously, estimating posterior model probabilities as a byproduct. Bayesian model averaging is the downstream inference step: combining predictions from multiple models weighted by their posterior probabilities. RJMCMC is one way to obtain those weights; bridge sampling estimates within each model separately are another.

When should I prefer information criteria (AIC, BIC, WAIC) over MCMC-based Bayes factors?

Information criteria are much cheaper to compute and work well when the sample size is large and models are not too complex. WAIC is a fully Bayesian predictive criterion that is easier to compute than a Bayes factor and often adequate for predictive model comparison. Full MCMC-based Bayes factors are most valuable when models differ structurally, when the sample is small, or when you need coherent posterior model probabilities for model averaging rather than a single winning model.

How sensitive are Bayes factors to the prior on model parameters?

Highly sensitive, especially with diffuse priors. Improper priors make Bayes factors undefined. Even proper but very vague priors can heavily favour simpler models (the Lindley-Jeffreys paradox). Best practice is to use weakly-informative priors grounded in the problem and to report a sensitivity analysis showing how the Bayes factor changes with reasonable prior variations.

Related methods

Sources

  1. Green, P. J. (1995). Reversible jump Markov chain Monte Carlo computation and Bayesian model determination. Biometrika, 82(4), 711–732.

    Open DOI reference
  2. Meng, X.-L., & Wong, W. H. (1996). Simulating ratios of normalizing constants via a simple identity: A theoretical exploration. Statistica Sinica, 6(4), 831–860.

    Open publication reference