Tutorials › Population Pharmacokinetics › Residuals Versus Predictions On Linear And Log Scales

Diagnostics: Goodness of Fit and Shrinkage · Tutorial 337 of 599

Residuals Versus Predictions On Linear And Log Scales

Learn to distinguish systematic residual trends from changing residual spread and to choose scales that make prediction-dependent patterns visible without distorting their meaning.

Intermediate 10 min read

What You'll Learn

  • Define residuals relative to population predictions and distinguish raw, weighted, and log-ratio residuals.
  • Interpret residual location and spread across the prediction range.
  • Compare linear prediction axes with logarithmic prediction axes.
  • Recognize how additive and proportional error patterns appear on different scales.
  • Identify when log transformations are invalid or can change the interpretation.
  • Use diagnostic plots as evidence for model assessment, not as automatic tests.

Why Plot Residuals Against Predictions?

A residual-versus-prediction plot asks whether model errors depend on the magnitude of the concentration the model predicts. It can reveal a systematic tendency to overpredict or underpredict in part of the prediction range, or residual variability that increases or decreases as predictions change. These questions complement residual-versus-time diagnostics: time can reveal a misshapen concentration-time profile, while prediction magnitude can show whether the model behaves differently at low and high predicted concentrations.

The earlier material on population predictions, individual predictions, and residuals distinguishes prediction types and residual constructions. Here, the key is to keep the prediction and residual definitions consistent throughout a plot. For example, a residual calculated from a population prediction should not be paired with an individual prediction as though both represented the same model comparison.

Definition: For observation \(j\) on subject \(i\), let \(DV_{ij}\) be the observed concentration and let \(PRED_{ij}\) be the corresponding population prediction. The raw residual is \(e_{ij}=DV_{ij}-PRED_{ij}\). A positive residual means the observation exceeds the prediction; a negative residual means it falls below the prediction. A residual-versus-prediction plot places residuals on the vertical axis and the matching predictions on the horizontal axis.

The residual's units depend on its definition. A raw concentration residual has concentration units, such as mg/L. A weighted residual is scaled by an estimate of its uncertainty and is dimensionless. A log-ratio residual, \(\ln(DV_{ij}/PRED_{ij})\), is also dimensionless and requires both values to be positive. These are not interchangeable quantities: changing the residual definition changes what the vertical distance represents.

If a model adequately describes the conditional mean and residuals are appropriately constructed, the residuals should not show a systematic location trend with prediction: their average should be near zero across the prediction range. Their spread need not be constant. The expected spread depends on the observation-error model, and weighted residuals are designed to account for specified differences in uncertainty. A visible pattern is a prompt to investigate, not proof of a particular model defect.

Scale Choice Changes What Is Visible

On a linear horizontal axis, equal distances represent equal concentration differences. On a logarithmic horizontal axis, equal distances represent equal multiplicative changes: for example, the distances from 1 to 10 and from 10 to 100 are equal. A logarithmic prediction axis can therefore make the low-prediction region easier to inspect when predictions span several orders of magnitude. It does not change the residual values or their signs; it changes their horizontal spacing.

A log transformation of the residual axis is different. Raw residuals can be positive, zero, or negative, so they cannot all be placed on an ordinary logarithmic axis. One can instead plot an appropriate positive quantity, such as absolute residual magnitude, or use a signed transformation, but the resulting plot answers a different question and may conceal direction. For multiplicative discrepancies, a log-ratio residual retains direction while expressing error on a relative scale.

Consider two common error structures. Under an additive error model, observations fluctuate around predictions by roughly a constant absolute amount. Under a proportional error model, deviations tend to grow with prediction magnitude. The following calculations show why a residual cloud that fans out on a linear residual scale may be consistent with proportional error rather than worsening mean bias.

$$ \text{Additive: } DV=PRED+\epsilon,\quad Var(DV\mid PRED)=\sigma^2 $$
$$ \text{Proportional: } DV=PRED(1+\epsilon),\quad Var(DV\mid PRED)=PRED^2\sigma^2 $$

In the proportional expression, \(\epsilon\) is a relative error with mean zero and variance \(\sigma^2\). This simple form is an approximation: it can produce negative observations if errors are large. A lognormal error model instead ensures positive observations, but then the interpretation depends on whether the prediction is a conditional median or a mean. In particular, centered log errors imply a centered log-ratio residual, not necessarily a raw residual with mean zero.

Worked Example: A Proportional Error Pattern on a Logarithmic Prediction Axis

Suppose hypothetical observations have population predictions of 2, 20, and 200 mg/L. The observed values are 2.4, 24, and 240 mg/L. Calculate raw residuals and log-ratio residuals, then compare what each displays.

For the first observation, the raw residual is \(2.4-2=0.4\) mg/L, and the log-ratio residual is \(\ln(2.4/2)=\ln(1.2)=0.1823\). For the second, the raw residual is \(24-20=4\) mg/L and the log-ratio residual is \(\ln(24/20)=0.1823\). For the third, the raw residual is \(240-200=40\) mg/L and the log-ratio residual is \(\ln(240/200)=0.1823\).

The raw residuals rise from 0.4 to 40 mg/L, so their spread increases greatly with prediction. Yet each observation is 20% above its prediction, and the log-ratio residual is the same for all three. This is a consistent proportional discrepancy, not evidence that the relative error grows with concentration. A logarithmic prediction axis spaces 2, 20, and 200 mg/L equally; it helps compare the same multiplicative change across the range but does not by itself make raw residuals constant.

The three points alone cannot establish a general variance pattern. The example demonstrates the scale interpretation; real diagnostics require enough observations across the range and consideration of the fitted error model.

Worked Example: An Additive Offset Can Look Large on a Relative Scale

Consider hypothetical predictions of 1, 10, and 100 mg/L, with observations of 3, 12, and 102 mg/L. Find the raw residuals and log-ratio residuals.

The raw residuals are \(3-1=2\) mg/L, \(12-10=2\) mg/L, and \(102-100=2\) mg/L. Thus, the absolute discrepancy is constant and positive. The log-ratio residuals are \(\ln(3/1)=1.099\), \(\ln(12/10)=\ln(1.2)=0.1823\), and \(\ln(102/100)=\ln(1.02)=0.01980\).

The log-ratio residual is much larger at the low prediction because an additive 2 mg/L difference is a larger fraction of 1 mg/L than of 100 mg/L. A plot using log-ratio residuals would therefore emphasize relative error, while the raw-residual plot shows the constant absolute offset. Neither view is inherently wrong: the appropriate one depends on the scientific question and the observation-error model.

All three observations and predictions are positive, so the log ratios are defined. If an observed concentration were zero or below the limit of quantification and recorded as zero, this calculation could not be applied to that recorded value without an explicit censoring or data-handling approach.

Reading Location and Spread

A useful first reading separates two features. Location concerns whether residuals are centered around zero at different prediction levels. A smooth upward or downward trend, or a sustained region mostly above or below zero, suggests prediction-dependent bias. Spread concerns how widely residuals vary around that center. A widening or narrowing cloud suggests prediction-dependent variability. A plot can show one feature without the other: the proportional-error example has increasing raw-residual magnitude without a changing relative discrepancy.

A logarithmic horizontal axis is most helpful when predictions are positive and span a broad range. It allocates more visual space to small predictions and compresses the largest values. If predictions include zero or negative values, the ordinary log axis is undefined; do not quietly discard those points or replace them with an arbitrary small constant. A linear axis, a clearly justified alternative transformation, or separate diagnostic displays may be more appropriate.

A logarithmic horizontal scale also does not make residuals normally distributed, remove dependence among repeated observations, or correct a misspecified error model. Points from the same subject are often related. Treating every point as independent evidence can make a visual cluster seem more decisive than it is. Examine the plot alongside subject-level context and the other diagnostics relevant to the analysis.

Worked Example: Distinguishing Mean Trend From Changing Spread

Suppose a hypothetical model has predictions near 5, 50, and 500 mg/L. At each level, several raw residuals are observed. Their approximate centers are 0, 0, and 0 mg/L, while their typical spreads are 1, 10, and 100 mg/L, respectively. What does the pattern suggest?

The centers do not show an obvious directional trend: there is no indication in these summaries that predictions are consistently too high or too low at one of the three levels. The spreads, however, increase by a factor of about 10 each time the prediction increases by a factor of 10. This is compatible with variability that scales with prediction, as in a proportional-error structure.

For a scale comparison, divide the typical spread by the prediction: \(1/5=0.20\), \(10/50=0.20\), and \(100/500=0.20\). The relative spread is about 20% at each level. A relative or suitable weighted residual may therefore be more stable than the raw residual. This is a descriptive check, not a formal estimate of the error model; a full assessment should use all observations and the model's stated variance assumptions.

How to Make and Assess the Plot

1
Choose a matched residual and prediction.
State whether the residual is raw, weighted, or another defined residual, and use the prediction corresponding to that construction. Label units where applicable.
2
Start with an interpretable scale.
Use a linear prediction axis to assess absolute concentration differences. Consider a logarithmic prediction axis when positive predictions cover a wide multiplicative range.
3
Inspect location and spread separately.
Look for a nonzero center, a changing center, curvature, or a fan-shaped cloud. Compare patterns with the assumptions of the residual and error model.
4
Check scale sensitivity and context.
Compare the linear and log prediction views when valid. Investigate notable patterns in context rather than deciding from one display or automatically removing observations.

A smooth curve can help reveal a gradual location trend, but it should not replace the point cloud or be treated as a formal test. Binning can summarize local behavior, yet bins can hide sparse regions and results can depend on bin boundaries. The most useful diagnostic keeps the original observations visible and makes clear which scale and residual are being shown.

Common Mistakes and Alternatives

  • Calling every fan-shaped cloud bias. A widening raw-residual cloud can reflect increasing variance while the residual center remains near zero. Inspect location separately from spread.
  • Confusing a log prediction axis with log residuals. Transforming the horizontal coordinate changes spacing, not residual values. A log-ratio residual changes the vertical quantity and its interpretation.
  • Taking logarithms of signed raw residuals. Negative and zero residuals have no ordinary real logarithm. Use a justified alternative rather than silently dropping them.
  • Interpreting a constant absolute discrepancy as a constant relative discrepancy. An offset of 2 mg/L is 200% of a 1 mg/L prediction but only 2% of a 100 mg/L prediction.
  • Assuming a visual pattern identifies its cause. Several model features can create similar patterns. A plot diagnoses where behavior changes; it does not by itself identify which structural or error-model change is correct.

A residual-versus-prediction plot differs from a plot of observations against predictions: the former directly displays signed discrepancies around a zero reference, while the latter displays observed and predicted values together. It also differs from a residual-versus-time plot, which is designed to reveal temporal structure. These displays answer related but distinct diagnostic questions, so one should not be treated as a substitute for all the others.

Key takeaway: Use residual location to assess prediction-dependent bias and residual spread to assess prediction-dependent variability. A log prediction axis can clarify patterns across orders of magnitude, but it does not transform the residual or change the assumptions behind it.

Check Your Understanding

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

  1. A raw residual is \(-0.8\) mg/L. What does its sign say about the observation relative to its matched population prediction?
  2. Predictions are positive and span from 0.5 to 500 mg/L. What does a logarithmic horizontal axis change, and what does it leave unchanged?
  3. At increasing predictions, raw-residual spread grows but the residual centers remain near zero. Is this necessarily prediction-dependent bias? Explain.
  4. Why can a log-ratio residual not be calculated from an observed concentration recorded as zero?
  5. Hypothetical predictions are 4 and 40 mg/L, and both observations are 25% above prediction. Calculate the raw residuals and log-ratio residuals.

Solutions. (1) The observation is 0.8 mg/L below its matched population prediction because \(e=DV-PRED<0\). (2) It changes horizontal spacing so equal multiplicative changes are equally spaced; it leaves residual values, signs, and units unchanged. (3) No. Increasing spread with centers near zero is compatible with prediction-dependent variability, such as proportional error, without a clear mean bias trend. (4) The ratio \(DV/PRED\) is zero and \(\ln(0)\) is undefined; the recorded zero also requires appropriate consideration of how it arose. (5) The predictions are 4 and 40 mg/L; the observations are \(4(1.25)=5\) and \(40(1.25)=50\) mg/L. The raw residuals are 1 and 10 mg/L, and both log-ratio residuals are \(\ln(1.25)=0.2231\).

Clinical Biostats