Why Review Diagnostics by Subgroup?
A model can look satisfactory overall while predicting poorly for a clinically important part of the population. For example, overprediction in one group and underprediction in another can cancel in a pooled mean residual. A pooled error measure can also be dominated by the largest group, leaving weak performance in a smaller group hard to see. Reviewing diagnostics by subgroup is a way to look for these masked patterns, not a substitute for the overall review.
The subgroups should have a clinical or design rationale: examples include age bands, renal-function categories, body-size ranges, dose levels, formulation, or study site. Where a covariate is continuous, clinically justified ranges can make a comparison interpretable, but categorizing it discards information and results may depend on the chosen cut points. Define groups before examining the diagnostic pattern when possible; selecting cut points after seeing the results can make chance differences look persuasive.
This review builds on residual diagnostics, individual and population prediction diagnostics, and visual predictive checks. The goal here is narrower: compare the relevant diagnostic summaries across groups, check whether group sizes support those comparisons, and decide whether a pattern merits investigation.
Choose Comparable Diagnostics
For observation \(j\) from individual \(i\), let \(y_{ij}\) be the observed outcome and \(\hat y_{ij}\) the prediction being reviewed. State which prediction is used. A population prediction and a prediction informed by an individual's observations answer different questions, so results based on them should not be silently combined. Define the signed residual as
A positive residual means the observation exceeds the prediction; a negative residual means the prediction exceeds the observation. Its units are the same as the outcome. Within subgroup \(g\), useful summaries include the mean signed residual, mean absolute error, and root mean squared error:
Here \(n_g\) is the number of observations in subgroup \(g\). The mean signed residual indicates direction of average error; MAE and RMSE describe error magnitude, with RMSE more affected by large errors. These are not interchangeable. Opposing errors may make \(\bar e_g\) small even when MAE is large. Always retain the outcome units when interpreting these summaries.
When outcomes span a wide range, relative errors or observed-to-predicted ratios may help compare scale, but they need care: ratios become unstable when predictions are near zero, and a relative error is not directly comparable to an absolute error. Prediction-interval coverage is another useful diagnostic. If an interval is intended to contain a specified proportion of outcomes under the model, calculate the fraction of observed outcomes inside it for each group. Coverage summaries should state the nominal target and the number of observations used.
Worked Example: Opposing Bias Hidden by the Pooled Mean
In a hypothetical review, predictions and observations are compared for two equally sized renal-function groups. In the lower-function group, the five residuals, in mg/L, are \(2, 2, 2, 2, 2\). In the higher-function group, they are \(-2, -2, -2, -2, -2\). Calculate the subgroup and pooled mean residuals, MAE, and RMSE.
For the lower-function group, \(\bar e_g=(2+2+2+2+2)/5=2\) mg/L. Every absolute residual is 2 mg/L and every squared residual is 4 \((\mathrm{mg/L})^2\), so \(\operatorname{MAE}_g=2\) mg/L and \(\operatorname{RMSE}_g=\sqrt{20/5}=2\) mg/L.
For the higher-function group, \(\bar e_g=(-2-2-2-2-2)/5=-2\) mg/L. Its MAE and RMSE are also 2 mg/L, because absolute values and squares remove the sign.
Across all ten observations, the pooled mean residual is \((5(2)+5(-2))/10=0\) mg/L. The pooled MAE is \((10\times2)/10=2\) mg/L, and the pooled RMSE is \(\sqrt{(10\times4)/10}=2\) mg/L. Thus, the pooled mean suggests no average signed error, even though each subgroup has a consistent bias in the opposite direction. The subgroup pattern is a reason to investigate; by itself, it does not identify the model component responsible.
Why Pooled Summaries Can Mislead
The masking in the example follows directly from the weighted mean. If subgroups partition the observations, the pooled mean residual is the subgroup-size-weighted average of the subgroup means:
To verify this, write the sum of all residuals as the sum within each subgroup. By definition, the residual sum in group \(g\) is \(n_g\bar e_g\). Dividing the sum of those group totals by the total number of observations gives the equation above. Consequently, a large subgroup can dominate the pooled result, and subgroup means with opposite signs can cancel. An overall mean is therefore not evidence that every subgroup is adequately predicted.
This identity also explains why raw counts belong beside each diagnostic summary. An unweighted average of subgroup means answers a different question from the pooled observation-level mean when group sizes differ. Neither summary is universally preferable: report the one that matches the review question and make the weighting explicit.
Worked Example: Unequal Group Sizes Change the Pooled Summary
In a hypothetical dataset, a common outcome is measured in mg/L. Group A has 30 observations with mean residual \(0.5\) mg/L; Group B has 10 observations with mean residual \(-1.5\) mg/L. Calculate the pooled mean and compare it with the unweighted average of the two subgroup means.
The pooled mean weights each subgroup by its number of observations: \[ \bar e=\frac{30(0.5)+10(-1.5)}{30+10} =\frac{15-15}{40}=0\ \mathrm{mg/L}. \] The unweighted average of subgroup means is \((0.5-1.5)/2=-0.5\) mg/L. The two values differ because the first gives each observation equal weight, while the second gives each subgroup equal weight. Neither calculation removes the need to show the subgroup results: one group averages positive residuals and the other negative residuals.
Check Counts, Clustering, and Coverage
The count \(n_g\) alone may not describe how much information a subgroup contains. In longitudinal pharmacometric data, many observations can come from a small number of individuals. If one individual contributes numerous measurements, an observation-level summary may primarily reflect that individual’s record. Report both the number of observations and the number of individuals, and inspect whether the pattern is concentrated in one or two individuals. If the review question concerns performance for a typical individual, consider summaries at the individual level as well as observation-level summaries. State how those individual summaries were formed.
Prediction-interval coverage has a simple definition: count an observation as covered if it falls between the lower and upper bounds of its stated prediction interval. Divide the covered count by the number of eligible observations in that subgroup. Coverage can reveal a group with too many outcomes outside the intervals even when average residuals look modest. It is a descriptive comparison, not proof that the interval-generating procedure is correct. The nominal coverage, interval construction, and whether the intervals were intended for individual outcomes must be clear.
Worked Example: Interpreting Coverage With a Small Subgroup
A hypothetical model provides 90% prediction intervals. In a subgroup with 12 observations from 4 individuals, 8 observations fall inside their intervals. A second subgroup has 40 observations, of which 36 are covered. Calculate the observed coverage in each group and interpret the comparison.
For the first group, coverage is \(8/12=0.667\), or 66.7%. For the second, it is \(36/40=0.900\), or 90.0%. The first group’s observed coverage is 23.3 percentage points below the second group’s and 23.3 percentage points below the nominal 90% target. This is a signal to inspect that subgroup, not a precise estimate of its long-run coverage: the group contains only 12 observations, and those observations come from just 4 individuals. In particular, they may not provide 12 independent pieces of information. The calculation does not establish that the model’s true coverage in this subgroup is 66.7%.
A Practical Review Sequence
Specify the prediction type, outcome scale, diagnostic, and clinical reason for each subgroup before interpreting patterns.
Report observations and individuals per group, along with missing or excluded observations. Check whether repeated measurements are concentrated in a few individuals.
Review signed residuals for directional bias and MAE or RMSE for error magnitude. Use prediction-interval coverage when it addresses the review question.
Check whether differences occur across the clinically relevant range or are driven by a few extreme observations, particular individuals, doses, or times.
Describe the observed pattern and its uncertainty, note sparse-group limitations, and identify what should be checked next without asserting a cause from the diagnostic alone.
Diagnostics, Alternatives, and Limitations
A subgroup table is compact and makes counts and numerical summaries easy to compare. Plots can reveal structure that a table obscures: for example, residuals consistently increasing with time in one group, or one extreme observation accounting for a large RMSE. A useful review often pairs a table of counts and summaries with a plot that preserves the underlying observations. Do not rely on a single summary statistic to describe a complex pattern.
The main alternative to subgrouping is to inspect diagnostics continuously against a covariate such as age or body weight. This avoids dependence on arbitrary category boundaries and can show gradual trends, but it can be harder to summarize and can obscure a clinically meaningful threshold. Subgroup summaries are easier to communicate but discard within-group variation. These approaches complement each other: use clinically justified groups for focused comparison and retain continuous diagnostic displays when the underlying covariate is continuous.
Common failure modes include interpreting a small group’s unstable summary as a reproducible model defect; treating repeated observations from the same individual as independent evidence; pooling incompatible prediction types; and searching many subgroup definitions until a striking pattern appears. A subgroup with only a few observations may show extreme MAE, RMSE, or coverage because one observation changes the result substantially. Conversely, a reassuring mean can coexist with substantial individual errors or errors at particular times.
Subgroup diagnostics are descriptive and do not automatically supply a formal test of subgroup differences. A large number of comparisons increases the chance of finding an unusual pattern by chance. Nor can the diagnostic alone distinguish model misspecification from data-processing errors, differences in observation timing, sparse sampling, or other study features. Review the pattern against the model’s intended use and the recorded data, and communicate uncertainty. A subgroup review can identify where further examination is needed; it cannot, by itself, establish causation or guarantee performance for future patients.
Check Your Understanding
For each question, work through the calculation or interpretation before reading the solution immediately below it.
- A subgroup has residuals \(-1, 1, 1\) mg/L. Calculate its mean signed residual and MAE. What does their difference illustrate?
- Group A has 8 observations and mean residual \(1\) mg/L; Group B has 2 observations and mean residual \(-3\) mg/L. Calculate the pooled mean residual.
- A group has 20 observations from 2 individuals. Why is it misleading to describe the coverage result as based on 20 independent individuals?
- A 95% prediction interval covers 17 of 20 observations in one subgroup and 45 of 50 in another. Calculate both observed coverage percentages and state one caution.
Solutions. (1) The mean is \((-1+1+1)/3=0.333\) mg/L; the MAE is \((1+1+1)/3=1\) mg/L. The small signed mean reflects cancellation, not small errors. (2) The pooled mean is \([8(1)+2(-3)]/10=(8-6)/10=0.2\) mg/L. (3) Measurements from the same individual can be related, so 20 observations from 2 individuals do not represent 20 independent individuals; show both counts and inspect the concentration of measurements. (4) The first coverage is \(17/20=85.0\%\); the second is \(45/50=90.0\%\). Both are below the nominal 95% target, but the observed percentages are descriptive and their precision depends on the data, including how observations are distributed across individuals.