Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Partial pooling: stabilize small-group estimates without hiding variation

Last updated: 7 Oct 20265 min read
tutorial
AdvancedBy AITrove Editorial

A hierarchical estimate blends a noisy group mean with a shared mean according to their relative information.

Name the population of groups

A service network reports average handling time for each depot. One depot has three observed shifts while another has forty-eight; treating the two raw averages as equally reliable invites a ranking dominated by noise. Under a simple normal model, depot means vary around a common center with between-depot variance, and observed shift times vary around each depot mean with within-depot variance. Partial pooling uses both sources of information. The sampling frame determines whether these depots represent the operating network.

Make the shrinkage weight visible

For a group with n independent observations and known variances, the group mean receives weight n times between-group variance divided by that quantity plus within-group variance. The remainder weights the common center. A three-shift group is pulled more toward the center than a forty-eight-shift group under the same model. The code computes this conditional blend only; fitting variance components and uncertainty intervals is additional work. The shared-prior lesson shows why a common center can harm groups that do not exchange information plausibly.

Do not mistake shrinkage for truth

Pooling helps against noisy extremes when the exchangeability model is credible. It can also erase a real depot problem if staffing, shipment class or equipment differs systematically. Inspect residuals and group-specific observed counts, then fit important predictors or separate incompatible groups before ranking. A group with zero observations receives the common mean as a model prediction, not a measured result. Variance and new-group behavior need a separate report from fitted averages.

Report what was borrowed

For each depot show raw average, pooled estimate, count, estimated between- and within-depot variation and uncertainty. Explain that an estimate pulled toward the center is conditional on the model and covariates, not an instruction to ignore a local complaint. Validate pooling by predicting held-out periods and checking whether small and large depots have credible errors. The depot project catches a shifted operation that should not be smoothed into a healthy benchmark.

Implementation

python
def pooled_depot_mean(depot_mean, shift_count, network_mean,
                      between_depot_variance, within_depot_variance):
    if shift_count < 0 or between_depot_variance <= 0 or within_depot_variance <= 0:
        raise ValueError("valid count and positive variances required")
    information = shift_count * between_depot_variance
    depot_weight = information / (information + within_depot_variance)
    return depot_weight * depot_mean + (1 - depot_weight) * network_mean

assert pooled_depot_mean(22, 3, 16, 4, 36) == 17.5
assert pooled_depot_mean(22, 48, 16, 4, 36) > 21

Performance and operating cost

The conditional blend is O(1) per depot; all g depots cost O(g) time and output space. Fitting variance components and checking group predictors are the substantial modeling steps. A cheap average of all shifts can overrepresent large depots, while an unweighted average of depot means can overrepresent tiny ones.

Common Mistakes

  • Presenting a pooled estimate as the raw depot average.
  • Treating a zero-observation prediction as measured performance.
  • Assuming all depots are exchangeable despite equipment differences.
  • Ranking small depots without counts and interval uncertainty.

Read next

ai-data
applied-statistics
Storage details