Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Subgroup Calibration of Joint-Model Predictions

Calibration and Prediction Validation · Tutorial 584 of 697

Subgroup Calibration of Joint-Model Predictions

Estimate horizon-specific calibration within clinically meaningful subgroups and interpret its uncertainty, especially when only a few events occur.

Advanced 11 min read

What You'll Learn

  • Define subgroup-specific observed risk, mean predicted risk, and calibration difference at a fixed horizon.
  • Estimate observed risk with Kaplan–Meier methods when follow-up is censored.
  • Use Greenwood uncertainty and understand why sparse events produce wide intervals.
  • Compare subgroup calibration differences with uncertainty rather than relying on point estimates alone.
  • Recognize when subgroup analyses, censoring patterns, or small event counts make conclusions unreliable.

Why Examine Calibration Within Subgroups?

A prediction model can appear well calibrated overall while systematically overpredicting risk in one clinical group and underpredicting it in another. For example, overprediction in a lower-risk subgroup can offset underprediction in a higher-risk subgroup when results are pooled. Subgroup calibration asks a focused question: at a specified prediction horizon, do predicted risks agree with observed risks among patients in a clinically defined group?

The horizon and subgroup must be specified before interpreting results. A risk prediction for the next 12 months is not the same quantity as a prediction for the next 5 years, and a subgroup defined by a baseline clinical characteristic is not interchangeable with one defined after observing future outcomes. Subgroup analyses are most interpretable when the groups are clinically motivated and defined using information available at prediction time.

Definition: Consider a validation sample of \(n_g\) eligible subjects in subgroup \(g\), with predictions made at a common landmark and for a fixed horizon \(\tau\). Let \(p_i(\tau)\) be subject \(i\)'s predicted event risk by \(\tau\). The subgroup's mean predicted risk is \(\bar p_g(\tau)=n_g^{-1}\sum_{i\in g}p_i(\tau)\). Let \(\hat R_g(\tau)\) be an estimate of the subgroup's observed event risk by \(\tau\). The subgroup calibration difference is \(\hat D_g(\tau)=\hat R_g(\tau)-\bar p_g(\tau)\). A positive difference means observed risk is higher than mean predicted risk; a negative difference means it is lower.

The difference is an absolute risk difference, usually reported in percentage points. It summarizes calibration at one horizon and within one group; it does not describe discrimination or explain why a discrepancy occurs. Predictions should be evaluated in data not used to fit or select the model, or with a validation procedure that accounts for model development. Otherwise, apparent agreement can be optimistic.

Estimating Observed Risk With Censoring

If every subject's event status through \(\tau\) is known, the observed risk can be estimated by the event proportion. With right censoring before \(\tau\), however, subjects censored before the horizon have unknown event status at \(\tau\). Treating them as non-events biases the estimate when censoring occurs. For a single event type, a standard subgroup estimate is the complement of the Kaplan–Meier estimate.

Definition: Within subgroup \(g\), let \(Y_i\) be the observed follow-up time and \(\Delta_i\) indicate whether the event was observed. The Kaplan–Meier estimate at \(\tau\) is \(\hat S_g(\tau)=\prod_{t_j\leq\tau}(1-d_j/r_j)\), where \(t_j\) are distinct event times, \(d_j\) is the number of events at \(t_j\), and \(r_j\) is the number at risk just before \(t_j\). The estimated event risk is \(\hat R_g(\tau)=1-\hat S_g(\tau)\).

This estimate requires appropriate handling of the risk set and, for the usual interpretation, censoring that is independent of event time within the subgroup (or conditionally independent given variables used to account for censoring). If follow-up differs substantially by subgroup, or censoring is informative, a simple Kaplan–Meier estimate may not be valid. The model's predictions and the observed-risk estimate must also target the same population, landmark, endpoint, and horizon.

Worked Example: A Subgroup With Complete Follow-Up

Suppose a hypothetical subgroup has 20 validation subjects, all followed through a 1-year horizon. Four experience the event by 1 year. Their predicted 1-year risks sum to 3.40. Calculate the observed risk, mean predicted risk, and calibration difference.

Because all subjects have known event status at 1 year, the observed risk is \(4/20=0.200\), or 20.0%. The mean predicted risk is \(3.40/20=0.170\), or 17.0%. Thus \( \hat D_g(1\text{ year})=0.200-0.170=0.030 \).

In this hypothetical group, observed 1-year risk is 3.0 percentage points higher than mean predicted risk. This is a point estimate, not evidence by itself that the model is miscalibrated: with only four events, substantial sampling uncertainty is plausible.

For reference, the Kaplan–Meier estimate here equals the event proportion. Greenwood's estimated variance for \(\hat S_g\) is \(\hat S_g^2\sum_j d_j/[r_j(r_j-d_j)]\). With one event time, \(r_1=20\), \(d_1=4\), and \(\hat S_g=0.800\), the sum is \(4/(20\cdot16)=0.0125\), giving \(\widehat{\mathrm{Var}}(\hat S_g)=0.800^2(0.0125)=0.00800\). This illustrates why the uncertainty is substantial; the risk estimate's standard error is \(\sqrt{0.00800}=0.0894\), or about 8.94 percentage points.

Uncertainty When Events Are Few

A subgroup calibration result should report the number of subjects, the number of observed events by the horizon, mean predicted risk, observed risk, and an uncertainty interval. A subgroup with few events can have a similar point estimate to another subgroup but much less precise evidence. The event count matters alongside the subgroup sample size: a large group with very few events can still provide limited information about risk.

For Kaplan–Meier estimates, Greenwood's formula estimates the variance of \(\hat S_g(\tau)\). A common interval construction uses the complementary log-log transformation. Define \(G=\sum_{t_j\leq\tau}d_j/[r_j(r_j-d_j)]\). The estimated standard error of \(\log[-\log\{\hat S_g(\tau)\}]\), by the delta method, is approximately \(\sqrt{G}/[-\log\{\hat S_g(\tau)\}]\). An interval on this transformed scale can be converted back to an interval for event risk. This respects the risk range from 0 to 1 better than a simple normal interval for risk, though it does not make a sparse-data estimate precise.

Worked Example: Kaplan–Meier Risk With Censoring

In a hypothetical subgroup of 12 subjects, two events occur while all 12 are at risk. Two additional subjects are then censored before the next event time, at which one event occurs among the eight still at risk. Assume censoring is independent of event time within this subgroup. Estimate 1-year risk if both event times are before 1 year and no later event occurs before that horizon.

The Kaplan–Meier survival estimate is \( \hat S_g(1)= (1-2/12)(1-1/8)=(10/12)(7/8)=70/96=0.7292 \). Therefore the estimated 1-year event risk is \(1-0.7292=0.2708\), or 27.1%. The crude proportion \(3/12=25.0\%\) treats the two censored subjects as if their 1-year status were known to be event-free; that is not the Kaplan–Meier calculation.

For uncertainty, \(G=2/(12\cdot10)+1/(8\cdot7)=0.01667+0.01786=0.03452\). Thus \(\sqrt G=0.1858\), and \(-\log(0.7292)\) is approximately 0.3158. The transformed estimate is \(\log(0.3158)\approx-1.153\), with estimated standard error \(0.1858/0.3158=0.5883\). A 95% normal interval on this transformed scale is \(-1.153\pm1.96(0.5883)\), approximately \([-2.306,0.000]\). Transforming back gives an approximate event-risk interval of 0.0949 to 0.6323.

Only three events occurred, and the resulting interval is wide. If the 12 predicted risks averaged 0.250, the calibration difference would be \(0.2708-0.250=0.0208\), or 2.08 percentage points. The point estimate is close to zero, but the observed-risk interval shows that the subgroup data are compatible with a broad range of risks. A narrow-looking difference should not be mistaken for precise calibration evidence.

Comparing Calibration Across Subgroups

To ask whether calibration differs between two groups, compare their calibration differences, not just their observed risks. Define the contrast as \(\hat D_A(\tau)-\hat D_B(\tau)\). Its uncertainty depends on both groups' observed outcomes and predicted risks. A visual or numerical difference between point estimates is not, on its own, evidence that calibration differs.

With complete follow-up and fixed predictions, a direct way to estimate uncertainty for a subgroup's mean residual is to use subject-level residuals \(Y_i-p_i(\tau)\), where \(Y_i=1\) if the event occurs by \(\tau\) and \(0\) otherwise. Their average equals the calibration difference when observed risk is the event proportion. The sample variance of these residuals divided by \(n_g\) estimates the variance of that average under independent subject sampling. For two independent subgroups, estimated variances of the subgroup differences add to estimate the variance of their contrast. Censoring requires an estimator that accounts for incomplete event status; the complete-follow-up calculation should not be applied unchanged.

Worked Example: Is a Difference Between Subgroups Convincing?

Consider two hypothetical groups with complete 1-year follow-up. In group A, 8 of 40 subjects have an event and every subject's predicted risk is 0.15. In group B, 9 of 30 have an event and every predicted risk is 0.28. Calculate both calibration differences and a rough interval for their contrast using the subject-level residual variance.

For group A, observed risk is \(8/40=0.200\), so \(\hat D_A=0.200-0.150=0.050\). Residuals are 0.85 for each of the 8 events and -0.15 for each of the 32 non-events. Their mean is 0.05. The sum of squared deviations from that mean is \(8(0.85-0.05)^2+32(-0.15-0.05)^2=8(0.64)+32(0.04)=6.40\). The residual sample variance is \(6.40/39=0.1641\), so the estimated standard error of \(\hat D_A\) is \(\sqrt{0.1641/40}=0.0641\).

For group B, observed risk is \(9/30=0.300\), so \(\hat D_B=0.300-0.280=0.020\). The residuals are 0.72 for 9 events and -0.28 for 21 non-events. Their mean is 0.02, and the sum of squared deviations is \(9(0.72-0.02)^2+21(-0.28-0.02)^2=9(0.49)+21(0.09)=6.30\). The sample variance is \(6.30/29=0.2172\), giving standard error \(\sqrt{0.2172/30}=0.0851\).

The estimated contrast is \(0.050-0.020=0.030\), or 3.0 percentage points. Assuming independent groups, its estimated standard error is \(\sqrt{0.0641^2+0.0851^2}=0.1065\). A rough 95% Wald interval is \(0.030\pm1.96(0.1065)\), or approximately \([-0.179,0.239]\). This interval is wide and includes zero; these data do not provide clear evidence of a difference in calibration between the groups. With limited events, the normal approximation is only a rough summary, not a guarantee of accurate coverage.

Justification for the Uncertainty Calculation

For complete follow-up, write the residual for subject \(i\) as \(e_i=Y_i-p_i(\tau)\). Its sample mean is \(\bar e_g=n_g^{-1}\sum_{i\in g}Y_i-n_g^{-1}\sum_{i\in g}p_i(\tau)=\hat D_g(\tau)\). Under independent sampling of subjects, the variance of a sample mean is the variance of an individual residual divided by \(n_g\). Replacing that unknown variance with the residual sample variance \(s_{e,g}^2\) gives the estimated standard error \(s_{e,g}/\sqrt{n_g}\). For independent groups A and B, the variance of the difference of their sample means is the sum of their variances, yielding the standard error used in the example. This derivation relies on independent subjects and a sufficiently adequate approximation for the sampling distribution; sparse events can make that approximation poor.

Practical Choices, Diagnostics, and Limitations

There are several reasonable ways to summarize subgroup calibration, but they answer related rather than identical questions. A mean-risk difference is an absolute measure at the chosen horizon. A ratio of observed to mean predicted risk is relative, but can be unstable when predicted or observed risk is near zero. A calibration curve shows risk patterns across a range of predictions, but dividing a small subgroup into further prediction bins can leave very few events per bin. Subgroup-specific recalibration parameters provide another summary, but are often unstable with sparse data and should not replace reporting observed and predicted risks.

ApproachUseful forMain caution
Observed risk versus mean predicted riskSummarizing average agreement at a specified horizonCan hide miscalibration within a subgroup's range of predictions
Subgroup calibration curveSeeing whether agreement varies across predicted risksSmall event counts make curves and bins unstable
Subgroup calibration parametersSummarizing systematic shifts or scaling differencesParameters may be imprecise and can obscure absolute risk differences

Check subgroup sample sizes and event counts before interpreting estimates. Also examine numbers at risk over time, censoring patterns, and whether a few subjects dominate the estimate. If groups differ in follow-up or censoring, apparent differences in observed risk may reflect estimation problems rather than calibration. If the interval is wide, report that uncertainty plainly instead of treating a nonsignificant comparison as proof of equivalence. Multiple subgroup comparisons increase the chance of finding an apparently large difference by chance; prespecification and cautious interpretation help.

A common mistake is to say, “The subgroup estimates differ, so the model is less calibrated in one group.” The correction is to quantify uncertainty in the difference itself, using a method appropriate to censoring and the data structure. Another mistake is to treat everyone censored before \(\tau\) as event-free. Their horizon status is unknown; use a suitable survival estimator and state its censoring assumptions. Finally, subgroup calibration is not subgroup discrimination: agreement between average predicted and observed risk does not tell whether the model ranks individuals well within that subgroup.

These estimates are limited by the validation sample, the selected horizon, subgroup definitions, and the assumptions used to handle censoring. Results from small or highly selected groups may not generalize. A subgroup gap can flag a question for further validation, but by itself it cannot establish why predictions differ from outcomes or justify causal claims.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. In a fully observed subgroup, mean predicted 2-year risk is 0.12 and 6 of 30 subjects experience the event by 2 years. What is the calibration difference, and how should its sign be interpreted?
  2. Why should a subject censored before the prediction horizon not automatically be counted as event-free at that horizon?
  3. Two subgroups have estimated calibration differences of 0.04 and -0.02. What quantity should be examined to assess whether their calibration differs?
  4. Why is a subgroup estimate based on two events generally less conclusive than a similar estimate based on many events?

Solutions. (1) Observed risk is \(6/30=0.20\); the difference is \(0.20-0.12=0.08\), so observed risk is 8 percentage points higher than mean predicted risk. (2) Censoring leaves the subject's event status after censoring unknown; counting the subject as event-free can bias the estimate. (3) Examine the contrast \(0.04-(-0.02)=0.06\) and its uncertainty, using an estimator suited to the censoring and sampling design. (4) Few events provide limited information about horizon-specific risk and usually produce greater uncertainty, so a point estimate alone can be misleading.

Clinical Biostats