Techniqueadvanced
Bayesian model averaging
Also called BMA.
Average predictions or estimates over a set of models, each weighted by its posterior probability, instead of choosing one model.
Bayesian model averaging (BMA) handles uncertainty about the model in the same way that Bayesian inference handles uncertainty about a parameter: it puts a prior on the models, computes their posterior probabilities from the marginal likelihoods, and averages over them. A prediction or an estimate is the average of the answers of the separate models, each weighted by the posterior probability of its model. In contrast to fitting one selected model, the answer keeps the uncertainty about which model is right. When the set of models and the priors are correct, the averaged predictive distribution has the best expected log score of all predictive distributions.
In plain words
Suppose several models could explain your data, and none is clearly best. If you pick one and report its answer, you act as if you were sure of that model, and your intervals are too narrow. Model averaging asks each model for its answer and mixes the answers. A model that predicted the data well gets a large weight, and a model that predicted them badly gets a small one. The weight also includes how plausible you thought the model was before. The mix is wider than any single answer when the models disagree, which is the honest result.
When it applies
- A list of models for the same data. Models , each with a sampling density and a proper prior , and prior model probabilities that sum to 1.
- A quantity with the same meaning in every model. The target is a future observation, a prediction, or a parameter that every model defines in the same way. A regression coefficient whose meaning depends on the other regressors in the model is not such a quantity.
- Marginal likelihoods that can be computed. Exactly with conjugate priors, approximately with a Laplace approximation, the BIC, bridge sampling or nested sampling, or implicitly with a sampler that moves between models.
- The true model, or a good approximation to it, is in the list. This is the M-closed case. If no model in the list is close to the truth, the weights still converge to one model, and stacking is a better way to combine predictions.
The template
The holes are the list of models M, the priors P(M_k) and π_k, the method ML that computes or approximates each marginal likelihood, and the quantity Δ.
BAYESIAN-MODEL-AVERAGING(x, M₁, ..., M_K, P, π, ML, Δ)- 1
for k ← 1 to K do - 2
ℓ_k ← log P(M_k) + log ML(x; f_k, π_k) ▷ log m_k(x) = log ∫ f_k(x | θ_k) π_k(θ_k) dθ_k - 3
c ← max_k ℓ_k - 4
for k ← 1 to K do - 5
w_k ← exp(ℓ_k − c) / Σ_j exp(ℓ_j − c) ▷ P(M_k | x), computed on the log scale - 6
p(Δ | x) ← Σ_k w_k · p(Δ | x, M_k) ▷ mixture of the posteriors of Δ under each model - 7
return p(Δ | x), (w₁, ..., w_K)
Line L5 is Bayes's theorem on the models, , and the ratio of two weights is the prior odds times the Bayes factor. Line L6 is the law of total probability. From L6, the posterior mean and variance of a real are
with . The second sum is the part of the uncertainty that comes from not knowing the model; selecting one model sets it to zero.
Why average: the log score. Let be the averaged predictive distribution of a future observation from L6. For any other predictive density ,
by Gibbs's inequality: by Jensen's inequality, with equality only if almost everywhere. Here is the expectation under the joint model, that is, with the model, the parameter and drawn from the prior and the sampling densities given the data . So under its own assumptions, the averaged predictive scores at least as well in expectation as the predictive of any single model, and strictly better unless that model has all the weight. This is Madigan and Raftery's argument. It is a statement about expectations under the prior over models; it does not say that BMA wins when the data come from outside the list.
Classic examples
A coin, exact. Toss a coin times and see heads. and Beta, with prior odds 1. The Bayes factor is , so . The probability that the next toss is a head is under (Laplace's rule, ) and under , and the average is
For itself, the averaged posterior has mean and variance : within the models plus between them. Model alone gives the variance , so selecting almost halves the reported variance. If the next toss is drawn from the averaged predictive, its expected log score is for the average, for alone and for alone, in line with the inequality above.
Variable selection in linear regression. With candidate regressors there are models. Under Zellner's prior on the coefficients, or a mixture of priors (Liang et al. 2008), each marginal likelihood is a closed form function of the of the model, so L2 is cheap. Raftery, Madigan and Hoeting (1997) average over the subsets, and the posterior inclusion probability of regressor is the sum of over the models that contain it. A spike-and-slab prior on the coefficients of one Bayesian linear regression is the same thing written as one model: its posterior is the model average.
Model composition by Markov chain (MC³). When is too large to list, Madigan and York (1995) run a Metropolis-Hastings chain on the models. A proposal adds or removes one regressor or edge, and the move from to is accepted with probability . The visit frequencies estimate the . When the marginal likelihoods have no closed form, reversible jump MCMC moves between models and parameters at once.
BIC weights. If each is replaced by , the weights become . This is a large-sample approximation to BMA that ignores the priors . Weights from the Akaike information criterion look similar but aim at the predictive Kullback-Leibler risk, not at posterior model probabilities, and they are not BMA.
Variations
- Occam's window. Madigan and Raftery (1994) drop the models whose posterior probability is below a fraction of the best one, and the models that have a simpler submodel with higher probability. The average is over the much smaller set that remains.
- Stacking. Stacking chooses the weights that maximize the leave-one-out log score of the mixture, with the leave-one-out densities from PSIS-LOO. Yao et al. (2018) show that it predicts better than BMA when no model in the list is true. Pseudo-BMA uses weights proportional to instead.
- Median probability model. If one model must be reported, the model with the regressors whose inclusion probability is at least is optimal for prediction under squared error in some normal linear models (Barbieri and Berger, 2004).
- Averaging inside one model. A continuous mixture over a model index, such as a prior on the degree of a polynomial or on the number of components of a mixture, is BMA over an infinite list.
Pitfalls
- Prior sensitivity of the weights. The marginal likelihoods depend on how diffuse the priors are, and they do not forget them as grows. A very wide prior on the extra parameters of a model drives its weight to 0, as the Lindley paradox shows. Improper priors give undefined weights.
- The model prior is not neutral. A uniform prior on regression models puts most of its mass on models with about regressors. A prior on the model size, such as a beta-binomial prior, gives a multiplicity correction (Scott and Berger, 2010).
- Weights collapse. As grows, the weights concentrate on one model, even when no model is true. Then BMA is model selection with extra steps, and it does not express that the models are all wrong.
- Averaging quantities that differ between models. The coefficient of a regressor in a model with a correlated second regressor is not the same quantity as its coefficient in a model without it. Average predictions, or define so that it has one meaning.
- Bad marginal likelihood estimates. The harmonic mean of the likelihood over posterior draws has infinite variance in common cases. Errors of a few units in change the weights by large factors.
Exercises
- Prove the variance decomposition after the template from the law of total variance.
- In the coin example, compute the averaged predictive probability that the next two tosses are both heads, and check that it is not the square of .
- Show that for two models with prior odds 1, the weight of is , and compute it for , and .
- Write the MC³ acceptance probability for a proposal that adds one of the absent regressors or removes one of the present ones with probability each, chosen uniformly. Show that the proposal is not symmetric in general and correct the acceptance probability.
- Let the data come from while and with . Argue that the weight of goes to 1 when , and explain why the averaged predictive is still too narrow.
References
- Jennifer A. Hoeting, David Madigan, Adrian E. Raftery and Chris T. Volinsky, Bayesian model averaging: a tutorial, Statistical Science 14(4), 1999, the definition, the computation by Occam's window and MC³, and the predictive performance (general locator)
- David Madigan and Jeremy York, Bayesian graphical models for discrete data, International Statistical Review 63(2), 1995, the Markov chain Monte Carlo model composition (MC³) sampler on the space of models (general locator)
- Madigan and Raftery 1994, Occam's window and the log score argument for averaging (general locator)
- Raftery, Madigan and Hoeting 1997, model averaging over subsets of regressors (general locator)
- Liang, Paulo, Molina, Clyde and Berger 2008, closed form marginal likelihoods for regression models under g priors (general locator)
- Yao, Vehtari, Simpson and Gelman 2018, stacking of predictive distributions and its comparison with model averaging when no model is true (general locator)
- Barbieri and Berger 2004, the median probability model (general locator)
- Scott and Berger 2010, priors on the model size and the multiplicity correction they give (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag B3884J Edit this page History Report an error Markdown