Why Examine Calibration Within Subgroups?
An overall calibration summary compares the total number of observed outcomes with the total number predicted. That comparison is useful, but it can hide important differences across people or settings. A model may predict too few events in one prespecified subgroup and too many in another, with the errors canceling in the aggregate. Subgroup calibration makes those patterns visible.
The calculations are straightforward; their interpretation requires care. A subgroup observed-to-expected ratio describes agreement in event totals for that group. It does not by itself show why a discrepancy occurred, establish that it is statistically meaningful, or guarantee that every person in the subgroup received an accurate prediction.
Observed and Expected Totals Within a Subgroup
For binary outcomes, person \(i\) has observed outcome \(Y_i\in\{0,1\}\) and predicted risk \(p_i\). If \(G_g\) is the set of people in subgroup \(g\), then
The expected total is a sum of individual predicted risks, not the subgroup size multiplied by an arbitrary representative risk. For Poisson counts with predicted mean \(\mu_i\), use \(E_g=\sum_{i\in G_g}\mu_i\) and \(O_g=\sum_{i\in G_g}Y_i\). If person \(i\) contributes exposure \(T_i\) and has predicted rate \(\lambda_i\), then \(\mu_i=T_i\lambda_i\). The ratio of observed to expected counts is also the ratio of observed to model-expected rates when both rates use the same total exposure.
Subgroups should be specified before inspecting the outcome discrepancies, using clinically or scientifically meaningful covariates where possible. The cleanest overall decomposition uses groups that are mutually exclusive and exhaustive: every observation belongs to exactly one group. Overlapping subgroups, such as separate age and sex summaries, can still be assessed, but their totals cannot be added together as if they formed a partition.
Worked Example: Binary Risks in Two Prespecified Groups
A validation sample contains 100 people in each of two prespecified risk groups. In group A, every person has predicted risk \(0.10\), and 14 people experience the outcome. In group B, every person has predicted risk \(0.30\), and 26 experience it. Calculate the group and overall ratios.
For group A, the observed total is \(O_A=14\), and the expected total is \(E_A=100(0.10)=10\). Thus \(R_A=14/10=1.40\): the observed count is 40% above the model's expected count.
For group B, \(O_B=26\) and \(E_B=100(0.30)=30\), so \(R_B=26/30\approx0.867\). The observed count is about 13.3% below expectation.
Overall, \(O=14+26=40\) and \(E=10+30=40\), giving \(R=40/40=1\). The overall ratio is exactly one despite the contrasting subgroup results. A statement that the model is “calibrated overall” would therefore omit a meaningful description of these group-level errors.
How Subgroup Ratios Combine
When groups form a partition and all their expected totals are positive, the overall ratio is an expected-total-weighted average of the subgroup ratios. The weights are determined by each group's share of the total expected outcomes, not by its share of the sample size.
Proof. Since \(R_g=O_g/E_g\), we have \(O_g=E_gR_g\) for each group. Summing over the partition gives
Each weight \(E_g/E\) is nonnegative, and the weights sum to \(\sum_gE_g/E=E/E=1\). Therefore the overall ratio can equal one even when some subgroup ratios are above one and others below one. In the binary example, the weights were \(10/40=0.25\) and \(30/40=0.75\), so \(0.25(1.40)+0.75(0.867)\approx1\), with the exact value \(0.25(1.40)+0.75(26/30)=1\). □
This identity also explains why an unweighted average of subgroup ratios is generally not the overall ratio. Groups with larger expected totals contribute more to the overall event count and therefore receive more weight.
Worked Example: Poisson Counts With Unequal Expected Totals
Two prespecified regions have Poisson event counts, with expected totals calculated from their exposures and predicted rates. Region A has expected count \(E_A=20\) and observed count \(O_A=30\). Region B has \(E_B=60\) and \(O_B=50\). Find the subgroup ratios and verify the overall result.
For region A, \(R_A=30/20=1.50\). For region B, \(R_B=50/60=5/6\approx0.833\). The total observed count is \(O=80\), and the total expected count is \(E=80\), so the overall ratio is \(1\).
The expected-total weights are \(20/80=0.25\) for A and \(60/80=0.75\) for B. Their weighted average is \(0.25(1.50)+0.75(5/6)=0.375+0.625=1\). The simple, unweighted average of the subgroup ratios would instead be \((1.50+5/6)/2\approx1.167\); it is not the overall observed-to-expected ratio.
If the regions have total exposures \(T_A\) and \(T_B\), their observed rates are \(30/T_A\) and \(50/T_B\), while their model-expected rates are \(20/T_A\) and \(60/T_B\). The corresponding rate ratios are still \(1.50\) and \(5/6\), because the same exposure appears in each numerator-denominator comparison.
Sampling Variation and Interpretation
A ratio differing from one is a descriptive discrepancy, not automatically evidence of systematic model failure. Even under a correctly specified model, observed counts vary. One useful reference calculation is available when predictions are fixed for an independent validation sample. Suppose the outcomes are conditionally independent given the covariates, and the model gives the correct conditional means.
Derivation. In the binary case, linearity of conditional expectation gives \(E[O_g\mid X]=\sum_{i\in G_g}p_i=E_g\). Conditional independence gives
For independent Poisson outcomes, each conditional mean and variance is \(\mu_i\), so summing gives \(E[O_g\mid X]=\sum_i\mu_i=E_g\) and \(\operatorname{Var}(O_g\mid X)=\sum_i\mu_i=E_g\). In both cases \(E_g\) is fixed after conditioning on the covariates and predictions. Dividing the conditional mean by \(E_g\) gives \(E[R_g\mid X]=1\); dividing the conditional variance by \(E_g^2\) gives the stated variance of the ratio. □
These results explain why ratios from groups with small expected totals can fluctuate substantially: dividing by a small \(E_g\) magnifies count variation. They are not, on their own, a complete uncertainty analysis for predictions estimated on the same outcomes, nor do they account for uncertainty from a complicated subgroup search. Treating model predictions as fixed in those situations can understate uncertainty.
Worked Example: A Large Ratio With a Small Expected Count
A prespecified subgroup has an expected binary outcome total of \(E_g=2\), based on fixed predictions in an independent validation set. Three outcomes are observed. The ratio is \(R_g=3/2=1.5\), which is 50% above expectation.
For independent binary outcomes with correct fixed risks, the conditional variance of the observed total is \(\sum_{i\in G_g}p_i(1-p_i)\). Since \(p_i(1-p_i)\leq p_i\) for each \(p_i\in[0,1]\), this variance is at most \(\sum_i p_i=2\). Consequently, the conditional variance of the ratio is at most \(2/2^2=0.5\). This is a substantial scale of variation for a ratio, illustrating why a value of 1.5 based on only two expected events is not, by itself, persuasive evidence of a subgroup-specific problem.
The comparison does not establish that the model is adequate in the subgroup. It shows why the ratio should be reported with its observed and expected counts and interpreted in light of its limited information. A much larger expected total with the same ratio may carry a different level of precision.
Practical Reporting and Common Pitfalls
A useful subgroup summary reports the group definition, sample size or exposure, observed total, expected total, and \(O_g/E_g\). For a binary outcome, the observed and expected totals can be fractional only on the expected side; for counts, they are usually count totals and model means. Showing both totals prevents a ratio from obscuring whether it is based on substantial information.
- Do not average ratios without weights. The overall ratio uses expected-total weights, as derived above.
- Do not interpret an overall ratio of one as proof of subgroup calibration. Positive and negative subgroup discrepancies can cancel.
- Do not treat every observed subgroup difference as a confirmed interaction or model defect. Sampling variation, especially with small expected totals, can be considerable.
- Do not select many cutpoints after examining the outcomes and then interpret the largest discrepancy as if the subgroup had been prespecified. Such searching makes chance extremes more likely.
- Do not calculate a ratio when \(E_g=0\). The ratio is undefined. Report the observed and expected totals and inspect why the model assigns no expected events; if \(E_g\) is merely very small, flag the ratio as unstable.
Subgroup calibration is valuable because it asks where the aggregate agreement comes from. It can reveal that predictions systematically understate outcomes for one group and overstate them for another, while keeping the interpretation appropriately bounded: subgroup ratios describe event-total agreement at the chosen level of grouping, not exact calibration for every individual or a causal explanation for the errors.
Check Your Understanding
Work through these questions using the definitions and calculations above.
- A binary-risk subgroup has 12 observed outcomes and an expected total of 15. Calculate its observed-to-expected ratio and interpret it.
- Two exhaustive groups have ratios 1.4 and 0.8, with expected totals 10 and 30. Calculate the overall ratio using expected-total weights.
- Why can an overall observed-to-expected ratio of one coexist with substantial subgroup discrepancies?
- For Poisson counts with exposure \(T_i\) and predicted rate \(\lambda_i\), write the subgroup expected count and observed-to-expected ratio.
- Why should a ratio based on a very small expected total be interpreted cautiously?