Hierarchical models are one of the most important advantages of Bayesian statistics. They allow information sharing across groups while preserving group-level differences.
After this module, learners should be able to:
- Explain complete pooling, no pooling, and partial pooling.
- Build a hierarchical model for grouped data.
- Interpret group-level variation.
- Understand centered and non-centered parameterizations.
Suppose we measure average waiting time at 20 bus stops. Some stops have many observations and others have few. We want to estimate the mean waiting time for each stop.
Three options:
| Approach | Description | Weakness |
|---|---|---|
| Complete pooling | Treat all stops as identical | Ignores stop differences |
| No pooling | Estimate each stop separately | Noisy for small groups |
| Partial pooling | Estimate groups with shared information | Requires hierarchical model |
Partial pooling is usually the most defensible option.
For observation i in group j:
y_ij ~ Normal(mu_j, sigma)
mu_j ~ Normal(mu_global, tau)
mu_global ~ Normal(0, 10)
tau ~ HalfNormal(5)
sigma ~ HalfNormal(5)
Interpretation:
mu_jis the group-specific mean.mu_globalis the overall mean.taudescribes how much groups differ from each other.sigmadescribes within-group variation.
Hierarchical estimates are pulled toward the overall mean. This is called shrinkage.
Shrinkage is strongest when:
- A group has little data.
- Group observations are noisy.
- The estimated group-level variation is small.
Shrinkage is weaker when:
- A group has much data.
- Group observations are precise.
- Groups genuinely differ a lot.
The centered form is:
mu_j ~ Normal(mu_global, tau)
The non-centered form is:
z_j ~ Normal(0, 1)
mu_j = mu_global + z_j * tau
Non-centered parameterization often improves MCMC sampling for hierarchical models.
Hierarchical models are useful for:
- Schools, classrooms, and students
- Roads, intersections, and cities
- Hospitals, doctors, and patients
- Survey respondents nested in regions
- Repeated measures over time
- Multi-site experiments
- Give an example of grouped data from your field.
- Explain why no pooling can overfit.
- Explain why complete pooling can underfit.
- Write a hierarchical model for crash counts across road segments.
Complete Lab 5: Hierarchical modeling.
Continue to Module 8: Bayesian Regression.