Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Judging a new robot from 3 tests
Your fleet’s robots succeed about 90% of the time. A brand-new robot succeeds in its first 3 tries. Is it perfect? Of course not: 3 tries tell you little, and you know robots of this model are usually around 90%. A sensible estimate sits between “3 out of 3” and “the fleet average”, much closer to the fleet average. After 300 tries, you’d trust its own record.
That’s a hierarchical model: each robot has its own rate, the rates come from a fleet-wide distribution, and each estimate leans on the fleet in proportion to how little data it has.
Fleets of robots or satellites, batches of components, many tasks in a benchmark, many users of a product: all are groups of similar units with uneven data. Hierarchical models give better estimates for every unit, and they stop you over-reacting to a lucky or unlucky start.
- 1. A new robot succeeds 3/3 times; the fleet averages 90%. A sensible estimate is…
- 2. With lots of data, a unit's estimate should…
- 3. Hierarchical models let units…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Three ways to estimate group means
For groups , the observed means are .
- No pooling: . Unbiased but noisy for small groups.
- Complete pooling: for all . Precise, but wrong if the groups really differ.
- Partial pooling with a population model :
The shrinkage factor is large for noisy groups (big ) and when the groups are similar (small ). The hyperparameters are learned from all the groups together.
Counts and proportions
- Fault counts over exposures , with : the posterior mean rate is .
- Success rates with : (A4.2-5).
- 1. B_j = s²/(s² + τ²) with s² = τ² equals…
- 2. If τ = 0 (all groups identical), partial pooling becomes…
- 3. If τ → ∞, partial pooling becomes…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.Estimating the population: empirical Bayes vs full Bayes
Marginally, . Empirical Bayes maximizes this marginal likelihood over , then plugs them in. The moment version is . Full Bayes puts a prior on (for example half-normal or half-Cauchy) and integrates over it, usually with MCMC (A5.2-7).
That matters when is small. In the classic eight schools data (Rubin, 1981), the marginal likelihood peaks at , so empirical Bayes pools completely. Full Bayes keeps meaningful uncertainty about , and with it the possibility that schools differ (Gelman, 2006).
Why it beats both extremes
Partial pooling is the James–Stein idea (A5.1-3) applied to groups: shrinking noisy estimates toward a learned common value reduces total MSE whenever there are several groups. In Exercise 1 with 12 cells, partial pooling cuts the MSE by about 70% compared with no pooling, and it also beats complete pooling.
Model structure
, , . Levels can nest further (measurements within runs within robots within sites) or cross (robot × task). Mixed-effects (random-effects) models in statistics are the same thing.
- 1. In the normal hierarchical model, y_j is marginally…
- 2. For eight schools, empirical Bayes gives τ̂ =
- 3. Moment estimate of τ² =
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Deriving the shrinkage formula
Given , the posterior of one combines the likelihood with the prior . Precisions add, and the mean is precision-weighted:
and . ∎
Exchangeability and de Finetti
Why model units as draws from a common distribution? If, before seeing data, you’d treat the units symmetrically (their labels carry no information), the parameters are exchangeable. De Finetti’s theorem says an infinite exchangeable sequence is a mixture of i.i.d. sequences. That’s exactly the hierarchical form . If units differ in known ways (age, site), put those covariates into the population model.
Funnels and parameterization
The joint posterior of has a “funnel”: when is small, the must be close together. MCMC samplers struggle there. The non-centred parameterization , fixes it (Papaspiliopoulos, Roberts and Sköld, 2007; Betancourt and Girolami, 2015).
Exercise 3.1: Compute the eight-schools estimate for school A with μ = 8, τ = 5
, so . A 28-point effect with SE 15 is mostly noise.
- 1. The weight on a group's own data is…
- 2. Hierarchical models are justified by…
- 3. The non-centred parameterization writes θ_j as…
Level 4: Expert
★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.Fault rates across a robot fleet
A fleet of 40 robots has logged anywhere from 50 to 2000 hours each. Raw rates are wild for new units: one fault in 50 hours looks like a terrible robot. With a gamma population prior estimated from the whole fleet (empirical Bayes), each rate becomes . New units are shrunk to the fleet rate, veterans keep their own. In this simulation the rate MSE drops about 7-fold. The same machinery ranks component suppliers, flags genuinely bad units, and sets per-unit maintenance intervals (Hamada et al., 2008). It’s also behind multi-task learning and meta-learning in ML.
Hierarchical models in AI, robotics and aerospace
- Multi-task and meta-learning. Task-specific parameters drawn from a shared prior. MAML has a hierarchical-Bayes interpretation (Grant et al., 2018).
- Fleet learning. Per-vehicle models with shared population structure for autonomous fleets and satellite constellations, such as battery degradation models per cell or pack.
- Reliability across lots and suppliers. Random-effects models for component strength or lifetime by batch (Hamada et al., 2008).
- Benchmark aggregation. Hierarchical models of algorithm performance across tasks and seeds separate task difficulty from algorithm skill.
- Small-area estimation and A/B tests across many segments use partial pooling to avoid over-reacting to tiny segments.
References
- A. Gelman, J. Hill (2007). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.
- D. Rubin (1981). “Estimation in parallel randomized experiments.” Journal of Educational Statistics, 6(4).
- A. Gelman (2006). “Prior distributions for variance parameters in hierarchical models.” Bayesian Analysis, 1(3).
- B. Efron, C. Morris (1975). “Data analysis using Stein’s estimator and its generalizations.” JASA, 70(350).
- B. de Finetti (1937). “La prévision: ses lois logiques, ses sources subjectives.” Annales de l’IHP, 7(1).
- O. Papaspiliopoulos, G. Roberts, M. Sköld (2007). “A general framework for the parametrization of hierarchical models.” Statistical Science, 22(1).
- M. Betancourt, M. Girolami (2015). “Hamiltonian Monte Carlo for hierarchical models.” In Current Trends in Bayesian Methodology with Applications. CRC Press.
- R. DerSimonian, N. Laird (1986). “Meta-analysis in clinical trials.” Controlled Clinical Trials, 7(3).
- E. Grant, C. Finn, S. Levine, T. Darrell, T. Griffiths (2018). “Recasting gradient-based meta-learning as hierarchical Bayes.” ICLR.
- M. Hamada, A. Wilson, C. S. Reese, H. Martz (2008). Bayesian Reliability. Springer.