Modelcore
Hierarchical Bayesian model
Also called multilevel Bayesian model, Bayesian hierarchical model.
A model whose group parameters share a prior with its own hyperparameters, so groups borrow strength from each other and estimates shrink toward the common mean.
A hierarchical Bayesian model has parameters in levels. Each group of data has its own parameter ; the are drawn from a common distribution with a hyperparameter ; and has a prior of its own. Because the groups share , the data of every group inform the estimate of every other group, and each estimate is pulled toward the common center by an amount that the data decide. This partial pooling lies between fitting each group alone and treating all groups as one.
The machine
There are groups with data . The model has three levels:
The joint density is , and the posterior is proportional to it. More levels (students in classes in schools) and covariates at any level (a regression for the mean of ) fit the same pattern.
Why this prior. Before the data, the groups are exchangeable: nothing tells them apart, so the joint prior of is symmetric. By de Finetti's theorem, an exchangeable sequence that can be extended without limit is a mixture of i.i.d. sequences, and the mixing variable is . So the second level is not an extra assumption, only a choice of form for the mixture.
The normal model. The main example, used below, is
Here is the estimate from group and its standard error, as in a random effects meta-analysis.
Conditions. The model needs exchangeability of the groups given the covariates that are in the model, and a posterior that is proper. If the hyperprior is improper, propriety must be checked; the last known result below shows that the common prior fails.
What it counts
- The group parameters. The posterior of each , its mean, its credible interval and the posterior probability that one group is ahead of another.
- The population. The posterior of , for example the center and the spread of the group effects.
- A new group. The predictive law of and of its data, , which a model without the second level cannot give.
- Model checks and comparisons. Posterior predictive checks at either level, and the marginal likelihood .
With conjugate choices at each level, Gibbs sampling draws each block from its full conditional in closed form. In general, Hamiltonian Monte Carlo is used, usually in the non-centred form below.
Relation to other models
- Complete pooling and no pooling. In the normal model, forces all , one parameter for all groups. makes the groups unrelated, and each is estimated by alone. The hierarchical model estimates and so chooses between the two from the data.
- Empirical Bayes. Fixes at an estimate , usually by maximizing the marginal likelihood, and then uses . The full model integrates over instead. The answers agree when is large; with few groups the plug-in hides the uncertainty in , and the eight schools below are a case where .
- James-Stein estimator. For equal and , the posterior mean with estimated from the data is a James-Stein type estimator, and its frequentist risk results apply to the shrinkage that this model does.
- Linear mixed model. The same structure with the group effects as random effects and a regression at the first level. The frequentist analysis estimates the variance components by REML and predicts the effects; the Bayesian analysis puts a prior on them.
- Bayesian linear regression. Lindley and Smith (1972) wrote the normal linear model with normal priors in stages, which is a hierarchical model with a linear second level.
- Shrinkage priors. A horseshoe prior is a hierarchical model with one local scale per coefficient and a global scale; there the aim is sparsity rather than pooling.
Known results in the model
All results are for the normal model with a flat prior on , unless stated.
1. The group parameters given the hyperparameters. Given and , the are independent with
Proof. The full conditional of is proportional to , a normal density whose precision is the sum of the two precisions and whose mean is the precision-weighted average.
The posterior mean is with the shrinkage factor , so it lies between and , and a group with a larger standard error is pulled further toward .
2. The center given the spread. Integrating out the gives independently, so with ,
Proof. The log density in is , a quadratic with minimum at and curvature .
3. The marginal posterior of the spread. With and as functions of ,
Proof. . Write ; the Gaussian integral over gives .
So the posterior can be computed by a one-dimensional grid over , then draws of from result 2 and of from result 1, with no Markov chain.
4. Propriety. As , , the product is , and the exponential factor goes to 1, so the likelihood factor of result 3 decays like . At it is finite and positive. Hence:
- a uniform prior on gives a proper posterior if and only if ;
- the prior , or a uniform prior on , gives an improper posterior for every data set, because diverges at 0.
For the eight schools () the log of the likelihood factor has slope in between and , as the formula says. Gelman (2006) made this point and recommended a half-Cauchy prior on as a default.
5. The eight schools. Rubin (1981) analysed coaching effects on a test in eight schools. The estimates are with standard errors . Results 1 and 2 give, for fixed :
| posterior means of given | |||
|---|---|---|---|
| 0 | 7.69 | 4.07 | all 7.7 (complete pooling) |
| 5 | 7.85 | 4.49 | 9.9, 7.9, 6.9, 7.7, 5.8, 6.7, 9.9, 8.1 |
| 10 | 8.13 | 5.52 | 14.2, 8.1, 5.0, 7.6, 3.1, 4.9, 13.1, 9.0 |
| 25 | 8.55 | 9.89 | 22.9, 8.1, 0.4, 7.3, 0.1, 2.2, 16.7, 10.8 |
| 100 | 8.73 | 35.65 | 27.6, 8.0, -2.7, 7.0, -0.9, 1.1, 17.9, 11.9 |
With a uniform prior on (on , which holds all but a negligible part of the mass), result 3 on a grid of step gives , posterior median and 95% quantile . Averaging over gives and
School A's raw shrinks to , because its standard error is large and the other schools suggest that effects that large are rare. The maximum of the marginal likelihood is at , so empirical Bayes would pool completely; the full posterior keeps a real chance that is 10 or more.
6. Centred and non-centred forms. In the centred form above, when is small the must all be close to , and when is large they are free. The posterior of then has the shape of a funnel, with a narrow neck that Gibbs samplers and Hamiltonian Monte Carlo explore poorly. The non-centred form writes with a priori, which removes the prior dependence between and . Papaspiliopoulos, Roberts and Sköld (2007) show that the centred form mixes better when the data are informative about each (small relative to ), and the non-centred form when they are not, as in the eight schools.
References
- Andrew Gelman, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari and Donald B. Rubin, Bayesian Data Analysis, 3rd edition, CRC Press, 2013, Chapter 5 (hierarchical models, the normal model with exchangeable parameters, the eight schools example and priors for the group-level variance)
- D. V. Lindley and A. F. M. Smith, Bayes estimates for the linear model, Journal of the Royal Statistical Society B 34(1), 1972, pages 1 to 41, with discussion (normal priors in stages and exchangeability of the group parameters; general locator)
- Rubin 1981, pages 377 to 401 (the eight coaching experiments; general locator)
- Andrew Gelman, Prior distributions for variance parameters in hierarchical models, Bayesian Analysis 1(3), 2006, the improper posterior under the prior 1/tau, the problems of the inverse gamma prior with small parameters, and the half-Cauchy prior (general locator)
- Papaspiliopoulos, Roberts and Sköld 2007, centred and non-centred parametrizations and their effect on Gibbs samplers (general locator)
Where this leads
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 | W4 complete |
|
Tag 0A2RZM Edit this page History Report an error Markdown