Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Bootstrap Optimism Correction

Calibration and Prediction Validation · Tutorial 571 of 697

Bootstrap Optimism Correction

Learn to estimate a metric’s optimism by refitting the full prediction procedure in bootstrap samples, then correct its apparent performance on the development data.

Advanced 12 min read

What You'll Learn

  • Define bootstrap optimism for metrics where larger or smaller values indicate better performance.
  • Calculate optimism-corrected concordance and Brier scores from bootstrap resamples.
  • Choose a meaningful loss when assessing calibration, whose ideal values depend on the metric.
  • Identify the resampling unit and parts of a joint-model workflow that must be repeated.
  • Diagnose unstable bootstrap corrections and recognize when they may mislead.

Why Correct Apparent Performance?

A prediction model is fitted to data, and its performance is often assessed on those same data. This apparent performance is usually optimistic: fitting has adapted the model to features of the development sample, including random variation that will not recur in new patients. The earlier material on apparent performance and optimism distinguishes this training-set advantage from the performance the model would achieve in new data.

Bootstrap optimism correction estimates that advantage by repeatedly drawing bootstrap samples, refitting the prediction procedure in each sample, and comparing its performance in the sample where it was fitted with its performance in the original development data. The difference estimates optimism; averaging those differences gives a correction to the apparent estimate. The procedure is an internal validation method, not an independent test of transportability to another population.

Definition: Let \(Q\) be a performance metric calculated using a specified prediction procedure and evaluation protocol. For bootstrap resample \(b\), calculate \(Q_{b,\mathrm{boot}}\) by fitting and evaluating the procedure in that resample, and \(Q_{b,\mathrm{orig}}\) by applying the fitted procedure to the original development data and evaluating it there. If larger values of \(Q\) indicate better performance, estimated optimism is $$ \widehat{O}=\frac{1}{B}\sum_{b=1}^{B} \left(Q_{b,\mathrm{boot}}-Q_{b,\mathrm{orig}}\right), $$ and the optimism-corrected estimate is \(Q_{\mathrm{app}}-\widehat{O}\), where \(Q_{\mathrm{app}}\) is apparent performance on the original data. If smaller values indicate better performance, define \(\widehat{O}=B^{-1}\sum_{b=1}^{B}(Q_{b,\mathrm{orig}}-Q_{b,\mathrm{boot}})\) and use \(Q_{\mathrm{app}}+\widehat{O}\).

The sign convention matters. A concordance measure is generally better when larger, whereas a Brier score is generally better when smaller. Calibration measures require extra care: a slope near 1, a calibration-in-the-large near 0, and an observed-to-expected ratio near 1 are desirable, so a raw value does not have a single “better when larger” direction. For calibration, it is often clearer to define a loss measuring distance from the ideal value, or an overall calibration error, and correct that loss.

Assumptions and the Bootstrap Procedure

The ordinary case resampling procedure assumes that the sampled individuals are independent and representative of the target development population, and that the empirical distribution of those individuals is a useful approximation to that population. For longitudinal and time-to-event data, the resampling unit is ordinarily the patient: resample patients with replacement and carry along each selected patient’s complete longitudinal record, event or censoring time, and relevant baseline information. Resampling individual visits would break the within-patient structure.

The prediction target and evaluation protocol must be fixed before resampling. For example, specify the prediction horizon and landmark, the risk prediction being evaluated, the censoring-aware metric and its weighting method, and the model-fitting procedure. The same procedure is applied in every replicate. If the original workflow estimates a joint model, chooses among candidate predictors, tunes a penalty, imputes missing values, or selects a prediction rule, those steps must be repeated inside each bootstrap sample. Otherwise the bootstrap does not account for the optimism introduced by those steps.

1
Calculate apparent performance.
Fit the prespecified procedure on all \(n\) development patients and calculate \(Q_{\mathrm{app}}\) using the chosen evaluation protocol.
2
Draw and refit.
For each \(b=1,\ldots,B\), sample \(n\) patients with replacement and refit the entire procedure in that bootstrap sample.
3
Evaluate in both data sets.
Calculate performance in the bootstrap sample and, using the fitted bootstrap model, in the original development data. Apply the same defined metric protocol to both evaluations.
4
Average the optimism and correct.
Compute the replicate differences with the sign appropriate to the metric, average them, and subtract optimism from higher-is-better performance or add it to a lower-is-better loss.

In a survival setting, “same evaluation protocol” does not mean ignoring censoring. If the metric uses inverse censoring weights, for instance, those weights must be computed according to the prespecified evaluation procedure. Any estimation of the censoring distribution that is part of the metric estimator should be handled consistently in the bootstrap and original-data evaluations. The target estimand and horizon should not shift from replicate to replicate.

Why the Difference Estimates Optimism

A bootstrap sample plays two roles: it is the data used to fit a model, and it is the data used to evaluate that fitted model. Its performance is therefore subject to the same training-set advantage as apparent performance. Evaluating that fitted model on the original data provides a comparison that is less adapted to the particular bootstrap sample. The average gap between the two evaluations estimates the average advantage attributable to fitting and evaluating on the same sample.

More formally, imagine a training sample \(D\) from a population \(F\), and let \(A(D)\) denote the fitted prediction procedure. For a higher-is-better metric, the generalization optimism of the fit is the difference between expected performance on its training data and expected performance on new data:

$$ O_F(D)=Q\{A(D),D\}-E_{D^*\sim F} \left[Q\{A(D),D^*\}\mid D\right]. $$

The bootstrap substitutes the empirical distribution of the observed patients for \(F\). A bootstrap data set is used as the fitting sample, and the original data act as the comparison evaluation sample. Averaging the within-bootstrap-minus-original differences therefore estimates the training-set advantage under this empirical approximation. Subtracting that estimated advantage from apparent performance yields the correction. This is a justification for the estimator, not a guarantee that the empirical distribution perfectly represents the population.

Worked Example: Correcting a Concordance Estimate

Suppose a hypothetical joint-model prediction procedure has apparent Uno concordance of \(0.72\) in a development set. Uno concordance is higher-is-better. Four bootstrap refits give the following values:

ResampleBootstrap-sample concordanceOriginal-data concordanceOptimism
10.780.700.08
20.750.690.06
30.800.700.10
40.740.700.04

The estimated optimism is

$$ \widehat{O}=\frac{0.08+0.06+0.10+0.04}{4} =\frac{0.28}{4}=0.070. $$

Thus the corrected estimate is \(0.72-0.070=0.650\). In this hypothetical example, the correction indicates that the apparent concordance is about 0.07 higher than the bootstrap estimate of performance after accounting for fitting optimism. It does not establish that concordance in a new population is exactly 0.650.

Worked Example: Correcting a Brier Score

Consider a hypothetical two-year Brier score evaluated with a prespecified censoring-aware estimator. The apparent score is \(0.160\), and smaller values are better. In four bootstrap replicates, the scores are:

ResampleBootstrap-sample scoreOriginal-data scoreOptimism in loss
10.1200.1700.050
20.1300.1600.030
30.1100.1800.070
40.1400.1500.010

For a lower-is-better score, optimism is original-data score minus bootstrap-sample score. Its average is

$$ \widehat{O}=\frac{0.050+0.030+0.070+0.010}{4} =\frac{0.160}{4}=0.040. $$

The corrected Brier score is \(0.160+0.040=0.200\). The estimate is worse than the apparent score, as expected when apparent performance is optimistic for a loss. Both values are dimensionless scores; the prediction horizon is two years.

Calibration Requires a Meaningful Error Measure

A calibration slope does not improve by simply increasing: values below and above 1 can both indicate miscalibration. One option is to use the absolute distance from the ideal slope, \(|\widehat{\gamma}-1|\), as a loss. Another is an integrated calibration error that summarizes disagreement between predicted and observed risks over a defined range. For these lower-is-better losses, the correction is apparent loss plus estimated optimism. If the corrected loss exceeds a practically meaningful threshold, that signals error; it is not itself a corrected calibration slope.

Worked Example: Correcting an Integrated Calibration Error

Suppose a hypothetical two-year risk model has an apparent integrated calibration error of \(0.035\), where smaller is better and zero is ideal. Four bootstrap fits produce calibration errors in the bootstrap sample of \(0.018, 0.020, 0.016,\) and \(0.022\); evaluating those same fitted models in the original data gives \(0.038, 0.030, 0.041,\) and \(0.035\). The replicate optimism values are \(0.038-0.018=0.020\), \(0.030-0.020=0.010\), \(0.041-0.016=0.025\), and \(0.035-0.022=0.013\). Therefore,

$$ \widehat{O}=\frac{0.020+0.010+0.025+0.013}{4} =0.017, \qquad \text{corrected error}=0.035+0.017=0.052. $$

Under this defined error measure, the corrected estimate suggests more calibration error than the apparent value. It does not say that the calibration slope is 0.052, nor does it identify whether predicted risks are systematically too high or too low; those questions require the relevant calibration summaries and plots.

Diagnostics, Comparisons, and Limitations

An optimism correction should be accompanied by checks on the resampling and fitting process. Inspect the distribution of replicate differences, not only their average. Large variation, strong skew, or a few extreme values can make the mean correction unstable. Also monitor convergence failures, boundary estimates, and bootstrap samples with too few events to support the planned model fit. A high failure rate is evidence that the procedure is unstable; silently dropping difficult replicates can distort the correction. Report failures and investigate whether the fitting algorithm, model complexity, or resampling design is responsible.

  • Preserve the analysis pipeline. Repeating only the final coefficient fit while leaving predictor selection, tuning, or preprocessing fixed misses optimism introduced by those steps.
  • Preserve the data structure. Resample complete patients for longitudinal records. If observations are clustered by center and the target concerns new centers, patient-level resampling alone does not represent center-to-center variation; the resampling design must match the sampling structure and target.
  • Check metric stability. At a fixed survival horizon, heavy censoring may leave little information for a censoring-adjusted score or calibration estimate. Bootstrap correction cannot create information absent from the data.
  • Use enough resamples. A small \(B\) can make the estimated average noisy. Increase \(B\) until the correction is reasonably stable for the intended use, and report \(B\) and the fitting failure rate.

Bootstrap optimism correction is computationally demanding because the full procedure is refitted many times. Compared with reporting apparent performance alone, it explicitly estimates and adjusts for the training-set advantage, but it still relies on the development sample as the source of resampling information. Cross-validation uses a different split-based internal validation design; external validation evaluates predictions in an independent cohort and addresses performance in that cohort rather than estimating optimism from the development data. These approaches answer related but not identical questions.

A correction can be negative or can yield an implausible value, especially with a small sample, unstable fitting, or noisy performance metric. Do not truncate such a result automatically: first check the sign convention, code, resampling unit, evaluation protocol, and replicate distribution. Even a numerically plausible correction remains an estimate with uncertainty. It does not quantify that uncertainty by itself, and it cannot guarantee performance under a changed case mix, measurement process, or clinical setting.

Common mistake: Subtracting the average bootstrap difference from every metric. This is correct only for a metric where larger is better and optimism is defined as bootstrap-sample performance minus original-data performance. For a lower-is-better loss such as the Brier score, define optimism as original-data loss minus bootstrap-sample loss and add it to the apparent loss. For calibration summaries, first define a loss with an explicit ideal value.

Check Your Understanding

Answer each question using the sign convention and interpretation appropriate to the metric.

  1. A higher-is-better discrimination metric has apparent value 0.68 and mean bootstrap optimism 0.05. What is the corrected estimate?
  2. A lower-is-better loss has apparent value 0.12 and mean optimism 0.025, defined as original-data loss minus bootstrap-sample loss. What is its corrected estimate?
  3. Why should bootstrap resampling ordinarily be done by patient rather than by longitudinal visit?
  4. A calibration slope is 0.8. Why is it not appropriate to treat a larger slope as automatically better?

Solutions. (1) \(0.68-0.05=0.63\). (2) \(0.12+0.025=0.145\). (3) Patient-level resampling retains each person’s longitudinal and event-time record, whereas visit-level resampling breaks within-patient dependence and does not reproduce the data structure. (4) The ideal slope is 1; values either below or above 1 can indicate miscalibration, so use distance from 1 or another explicitly defined calibration loss.

Clinical Biostats