Tutorials › Nonlinear Mixed-Effects Models (NLME) › Diagnosing External Calibration

External Validation and Model Averaging · Tutorial 666 of 797

Diagnosing External Calibration

Learn how calibration summaries and plots reveal systematic bias, overly variable predictions, and patterns that a single summary can miss.

Advanced 10 min read

What You'll Learn

  • Define continuous-outcome calibration-in-the-large on a prespecified concentration scale.
  • Estimate and interpret the intercept and slope from observed-versus-predicted regression.
  • Distinguish systematic bias from predictions that are too dispersed or too compressed.
  • Read observed-versus-predicted plots for patterns hidden by a single slope.
  • Account for repeated records and define whether calibration summaries weight records or subjects.
  • Recognize uncertainty, scale, and sampling limitations in external calibration.

What Calibration Adds to External Prediction Assessment

A model can produce predictions that are, on average, close to external observations yet still be poorly calibrated. For example, it may systematically underpredict low concentrations and overpredict high concentrations. A single average error can conceal that pattern. Calibration assessment asks whether predictions agree with observations in level and spread across the prediction range.

Here, \(Y_{ij}\) denotes the observed concentration for subject \(i\) at record \(j\), and \(\hat{Y}_{ij}\) denotes the corresponding external prediction, generated according to the prespecified prediction target. Calibration concerns the agreement between these paired quantities in the external validation sample. The prediction target, outcome scale, and analysis set must be fixed before examining the validation results.

Definition: For continuous outcomes on a chosen scale, calibration-in-the-large is the average observed-minus-predicted difference, \(\overline{Y-\hat{Y}}\). A positive value indicates average underprediction; a negative value indicates average overprediction. Calibration slope and intercept are the slope and intercept in a regression of observed values on predicted values. Ideal calibration has mean difference 0, intercept 0, and slope 1. These summaries describe different aspects of agreement and should be interpreted together.

The chosen scale matters. On the concentration scale, differences and offsets are in concentration units, such as mg/L. On a log-concentration scale, differences represent log ratios: a positive mean difference indicates that observed concentrations tend to exceed predictions multiplicatively. Use a log scale only when observations and predictions are positive and that scale is appropriate to the scientific question. Do not mix scales within a calibration analysis or add arbitrary constants to make zero values log-transformable.

Calibration-in-the-Large

For \(N\) paired records, define the residual as observed minus predicted. Calibration-in-the-large is the mean of these residuals. It answers a focused question: if the predictions were shifted by one constant amount, what average shift would align them with the observations in this validation sample? It does not show whether the error changes across the prediction range.

$$ r_{ij}=Y_{ij}-\hat{Y}_{ij}, \qquad \widehat{\Delta}_{\mathrm{CIL}}=\frac{1}{N}\sum_{i,j}r_{ij} $$

This mean is also the fitted intercept in a regression with the coefficient of prediction fixed at 1: \(Y_{ij}=\Delta+\hat{Y}_{ij}+\epsilon_{ij}\). It is not generally the same as the intercept from an unconstrained regression, because the unconstrained regression estimates both intercept and slope. The result depends on the weighting: a record-level mean gives more weight to subjects with more records. If the target is an average subject rather than an average record, define a subject-weighted summary instead.

Worked Example: Estimating Average Bias

Suppose a hypothetical external validation set has six paired concentrations, all measured in mg/L. The prediction values are 5, 10, 15, 20, 25, and 30; the corresponding observations are 6, 11, 14, 22, 24, and 32.

Prediction (mg/L)Observation (mg/L)Observed minus predicted (mg/L)
561
10111
1514-1
20222
2524-1
30322

The residuals sum to \(1+1-1+2-1+2=4\) mg/L. Therefore,

$$ \widehat{\Delta}_{\mathrm{CIL}}=\frac{4\ \mathrm{mg/L}}{6} =0.667\ \mathrm{mg/L} $$

The predictions understate the observed concentrations by an average of 0.667 mg/L across these six records. This is a descriptive result for this sample; it does not imply that every prediction is low, nor does it establish how well the model performs at particular concentration levels.

Calibration Intercept and Slope

Fit the descriptive regression of observed concentration on predicted concentration:

$$ Y_{ij}=a+b\hat{Y}_{ij}+\epsilon_{ij} $$

Here \(a\) is the calibration intercept, \(b\) is the calibration slope, and \(\epsilon_{ij}\) is the regression residual. Perfect calibration corresponds to \(a=0\) and \(b=1\). The intercept represents the fitted observed value when the prediction is zero, so it may have little practical meaning if zero lies far outside the prediction range. The slope describes how the observed values change across the prediction range relative to the predicted values.

A slope below 1 means that observed values vary less across the range than the predictions do: predictions are too spread out, or over-dispersed, relative to observations. A slope above 1 indicates predictions are too compressed, or under-dispersed. These interpretations are conditional on the fitted linear relationship and should be checked against a plot. An intercept can offset the line without correcting an incorrect slope.

The ordinary least-squares slope is the centered cross-product of observations and predictions divided by the centered sum of squares of predictions. This expression also shows why the slope describes relative spread.

$$ \hat{b}= \frac{\sum_{k=1}^{N}(\hat{Y}_k-\overline{\hat{Y}})(Y_k-\bar{Y})} {\sum_{k=1}^{N}(\hat{Y}_k-\overline{\hat{Y}})^2}, \qquad \hat{a}=\bar{Y}-\hat{b}\,\overline{\hat{Y}} $$

To see the spread interpretation, suppose the observations follow \(Y=a+b\hat{Y}+\epsilon\), where the regression residual has mean zero and is uncorrelated with the predictions. Then the covariance of prediction and observation is \(b\) times the variance of prediction. Dividing that covariance by the prediction variance gives slope \(b\). Thus a slope below 1 indicates a smaller observed range per unit of predicted range, under these conditions.

Worked Example: Interpreting a Calibration Slope

Consider five hypothetical external pairs in mg/L. The predictions are 1, 2, 3, 4, and 5; the observations are 2, 3, 3, 4, and 5. The prediction mean is 3, and the observation mean is 3.4.

The centered prediction values are \(-2,-1,0,1,2\), and the centered observation values are \(-1.4,-0.4,-0.4,0.6,1.6\). Their cross-products sum to \(2.8+0.4+0+0.6+3.2=7\), while the squared centered predictions sum to \(4+1+0+1+4=10\). Hence,

$$ \hat{b}=\frac{7}{10}=0.700,\qquad \hat{a}=3.4-(0.700)(3)=1.30\ \mathrm{mg/L} $$

The fitted line is \(\hat{Y}_{\mathrm{obs}}=1.30+0.700\hat{Y}\), with slope units of mg/L per mg/L (numerically unitless). The slope below 1 indicates predictions that are too spread out relative to these observations: at higher prediction values, the fitted observed values rise less rapidly. The positive intercept partly offsets that pattern. It would be incorrect to conclude that the positive intercept alone means the model underpredicts everywhere; the fitted difference is \(1.30-0.300\hat{Y}\), which changes with the prediction.

Reading the Observed-Versus-Predicted Plot

Plot observed values on the vertical axis and predictions on the horizontal axis, using the same scale and units on both axes. Add the identity line \(Y=\hat{Y}\). Points consistently above the line indicate underprediction; points below it indicate overprediction. A fitted calibration line helps summarize overall level and slope, but the point cloud can show departures that a line conceals.

Worked Example: A Slope That Hides a Pattern

In a hypothetical dataset, the four prediction values are 2, 4, 8, and 16 mg/L, and the paired observations are 3, 6, 10, and 12 mg/L. The residuals are \(1,2,2,-4\) mg/L, which sum to 1 mg/L. The calibration-in-the-large is therefore \(1/4=0.250\) mg/L.

Despite this small average difference, the residuals are positive at the first three prediction values and negative at the largest. On an observed-versus-predicted plot, the points would lie above the identity line at the lower and middle predictions, then below it at the highest prediction. The average bias does not capture this change in direction. A single fitted slope would also compress this pattern into a summary; the plot is needed to notice that one straight-line description may be inadequate.

A calibration plot is a diagnostic summary, not a substitute for checking the data and prediction process. Mark or otherwise distinguish repeated records from the same subject when useful, and avoid treating a dense cluster of records from one subject as if it were many independent subjects. If the plot is curved or shows systematic concentration-dependent departures, report that the linear calibration summaries are incomplete rather than claiming that a slope near 1 establishes calibration.

Assumptions, Uncertainty, and Common Failure Modes

The arithmetic definitions of mean residual and fitted regression do not require normally distributed outcomes. However, inferential standard errors and confidence intervals require an appropriate sampling and dependence treatment. NLME validation data often contain repeated observations within subjects; records from one subject are generally not independent. Ordinary regression standard errors that treat all records as independent can therefore be too small.

For inference, resample subjects rather than individual records in a subject-level bootstrap, retaining each selected subject's paired observations and predictions. Alternatively, use a variance estimator appropriate to the clustering and design. The point estimate still needs a clear target: record-weighted calibration gives each record equal weight, while subject-weighted calibration first summarizes within subject and then gives each subject equal weight. These answer different questions when subjects contribute unequal numbers of records.

The validation sample must represent the intended external prediction setting, and observed outcomes must be paired with predictions generated for the same individuals, times, dosing histories, and covariates. Calibration diagnostics do not repair mismatched data or a changed prediction target. In particular, population predictions and individual predictions are distinct targets; using information from an individual's validation outcomes to construct an ostensibly external individual prediction would compromise the assessment.

  • Scale mismatch: Comparing a log-scale prediction with an untransformed observation makes the summaries uninterpretable. Transform both consistently and state the scale and units.
  • Reading slope without intercept: A slope near 1 can coexist with a large constant offset. Assess calibration-in-the-large and the fitted intercept as well.
  • Reading average bias as universal bias: A mean residual near zero can result from positive and negative errors that cancel. Inspect the observed-versus-predicted plot.
  • Ignoring clustering: Many records do not necessarily provide the same information as many independent subjects. Account for within-subject dependence when quantifying uncertainty.
  • Extrapolating beyond the data: The fitted intercept at prediction zero may be scientifically irrelevant when zero is outside the observed prediction range. Interpret the fitted line within the range represented by validation data.

Calibration summaries complement, rather than replace, predictive scoring. Scores summarize prediction errors according to their chosen loss function; calibration asks whether observed levels and spread align with predicted levels and spread. Neither alone establishes that a model will predict well in every subgroup or setting. A calibration slope is a descriptive relationship, not a causal effect and not a guarantee of future performance.

Key takeaway: Report calibration-in-the-large, the observed-on-predicted intercept and slope, and a plot against the identity line. State the outcome scale and weighting, account for repeated subjects in uncertainty calculations, and do not let a favorable average conceal structured disagreement.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. Observed concentrations average 0.40 mg/L below predictions. What is the calibration-in-the-large, and what direction of average bias does it indicate?
  2. A calibration slope is 0.75. What does this suggest about prediction spread relative to observed spread?
  3. Why might ordinary regression standard errors be unsuitable when each subject contributes several validation records?
  4. A plot has points above the identity line at low predictions and below it at high predictions, while the mean residual is close to zero. What does this indicate?
  5. When might record-weighted and subject-weighted calibration-in-the-large differ?

Solutions. (1) The mean observed-minus-predicted difference is \(-0.40\) mg/L, indicating average overprediction by 0.40 mg/L. (2) The observed range changes less than the predicted range; predictions appear over-dispersed relative to observations. (3) Within-subject outcomes can be correlated, so treating every record as independent can understate uncertainty. (4) Errors change systematically across the prediction range and cancel in the overall mean; the near-zero average does not establish calibration across that range. (5) They can differ when subjects contribute unequal record counts and their average residuals differ; record weighting gives more influence to subjects with more records.