Tutorials › Pharmacometric Workflows and Reproducible Modeling › Interpreting Residuals Versus Time

Automating Diagnostics and Reports · Tutorial 286 of 399

Interpreting Residuals Versus Time

Learn to construct and interpret residual-versus-time-after-dose plots, including what temporal patterns can suggest and what they cannot establish.

Intermediate 11 min read

What You'll Learn

  • Define time after dose consistently for each observation.
  • Interpret persistent positive or negative residual trends over time.
  • Recognize possible oscillatory patterns without overcalling a cycle.
  • Compare residual spread across time regions and consider the residual scale.
  • Identify sampling, dosing, and dependence issues that can mislead interpretation.
  • Use worked calculations to describe patterns without treating a diagnostic plot as a formal test.

Why Plot Residuals Against Time After Dose?

A pharmacometric model describes how observations are expected to change over time, including their response to dosing. A residual-versus-time-after-dose plot asks whether the remaining prediction errors also show a systematic temporal pattern. Persistent runs above or below zero, a repeating up-and-down shape, or a spread that changes over time can indicate that some feature of the model or its observation-error assumptions deserves review.

This is a diagnostic display, not a test that identifies a unique cause. A pattern can arise from model misspecification, but also from sampling design, incorrectly recorded dose times, observations clustered by subject, or a residual scale that changes with the magnitude of the observation. The plot is most informative when its time origin, residual definition, and data inclusion rules are stated clearly.

Definition: For observation \(j\) from subject \(i\), let \(t_{ij}\) be the observation time and \(t^{\mathrm{dose}}_{ij}\) the time of the dose used as the reference. Time after dose is \(u_{ij}=t_{ij}-t^{\mathrm{dose}}_{ij}\), reported in a stated time unit. If \(y_{ij}\) is the observed value and \(\hat{y}_{ij}\) is the chosen model prediction, the residual is \(e_{ij}=y_{ij}-\hat{y}_{ij}\). A positive residual means the observation exceeds that prediction; a negative residual means it is below it.

The prediction and residual type must be consistent across the display. For example, a plot may use residuals based on population predictions or residuals based on individual conditional predictions; those answer related but not identical diagnostic questions. Raw residuals retain the units of the observation, such as mg/L. A weighted or standardized residual has been rescaled, so its vertical axis and interpretation differ. The earlier material on choosing residuals for standard diagnostics establishes why the selected residual should match the question and the model’s error structure.

Constructing and Reading the Display

Put time after dose on the horizontal axis and the selected residual on the vertical axis. Include a horizontal reference line at zero. Label both axes with units, identify the prediction and residual type, and make clear which observations were included. If repeated doses create repeated post-dose intervals, specify whether time is measured from the most recent dose, a dose at the start of a particular occasion, or another defined reference.

A useful first read is qualitative: do points fluctuate around zero without a visible pattern, or do they form runs, curves, cycles, or bands with different widths? A few practical checks help prevent overinterpretation:

  • Check that dose and observation times use the same time origin and units. A timing offset can create a misleading apparent shift in a post-dose pattern.
  • Inspect how densely each part of the time range is sampled. A smooth-looking pattern supported by only one or two observations is weak evidence.
  • Look for repeated observations from the same subject or occasion. They are not automatically independent, and a pooled cloud can hide distinct subject-level patterns.
  • Compare like with like when dose histories, regimens, or occasions differ. The same elapsed time after a dose need not imply the same concentration or pharmacologic state under different histories.
  • Check whether the residual scale is appropriate for comparing vertical spread across the range. Raw residuals can naturally widen when the observation scale or variance changes.
Interpretation: Under a correctly specified conditional mean model, residuals should not have a systematic conditional mean pattern over time after dose: ideally, \(E(e_{ij}\mid u_{ij},\text{relevant modeled history})=0\). If standardized residuals are appropriate for the assumed variance model, their spread should also be broadly compatible with that model. These are diagnostic expectations, not guarantees that a finite sample will look pattern-free.

Why Temporal Patterns Are Informative

The basic justification follows from the definition of a residual. Write the observation as \(Y_{ij}=m_{ij}+\varepsilon_{ij}\), where \(m_{ij}\) is its true conditional mean under the relevant history and \(\varepsilon_{ij}\) is an error with conditional mean zero. If the model prediction equals that conditional mean, then

$$ E(e_{ij}\mid u_{ij},\text{history}) =E(Y_{ij}-m_{ij}\mid u_{ij},\text{history}) =m_{ij}-m_{ij}=0. $$

If the fitted prediction systematically misses the conditional mean at some post-dose times, the residual mean can instead vary with \(u_{ij}\). For example, suppose the model prediction is \(\hat{m}_{ij}\) and the true mean is \(m_{ij}\). Then

$$ E(e_{ij}\mid u_{ij},\text{history}) =m_{ij}-\hat{m}_{ij}. $$

Thus a smooth trend or repeated sign pattern can reveal time-localized lack of fit. A changing residual variance is a different signal: it concerns the conditional spread, not necessarily the conditional mean. Estimated predictions and repeated measurements complicate these ideal relationships, so a visual pattern is a prompt for investigation rather than proof of a specific defect.

Worked Example: A Residual Trend Across the Post-Dose Interval

Suppose a hypothetical concentration model gives these four residuals, in mg/L, at times after dose of 1, 2, 4, and 5 hours: \(0.4,\ 0.2,\ -0.2,\ -0.4\). The residual is observed concentration minus the selected prediction. Calculate the straight-line trend as a compact description of the pattern.

The mean time is \(\bar{x}=(1+2+4+5)/4=3\) h, and the mean residual is \(\bar{e}=(0.4+0.2-0.2-0.4)/4=0\) mg/L. The least-squares slope is

$$ b=\frac{\sum (x_j-\bar{x})(e_j-\bar{e})}{\sum (x_j-\bar{x})^2} =\frac{(-2)(0.4)+(-1)(0.2)+(1)(-0.2)+(2)(-0.4)} {(-2)^2+(-1)^2+(1)^2+(2)^2} =\frac{-2.0}{10}=-0.2000\ \text{mg/L per hour}. $$

The fitted line has intercept \(\bar{e}-b\bar{x}=0-(-0.2000)(3)=0.6000\) mg/L, so its predicted residual is \(0.6000-0.2000x\). In this small hypothetical set, residuals are positive early and negative late, with a descriptive downward trend of 0.2000 mg/L per hour. That is a reason to check time-dependent fit, timing, and the selected prediction; four points do not establish the cause or the generality of the trend.

Trends, Oscillations, and Changes in Spread

A persistent positive residual region means observations tend to exceed predictions there; a persistent negative region means they tend to fall below predictions. A smooth transition between the two may be more informative than isolated points. Possible explanations include a time-dependent component that is absent or misspecified, an inaccurate dose or sample time, or a mismatch in how observations from different histories have been combined. The plot alone cannot distinguish these possibilities.

Alternating residual signs can suggest an oscillatory pattern, but a visually wavy sequence is not automatically a biological cycle. Repetition over several comparable intervals, adequate observations at relevant phases, and a consistent time origin make the interpretation more credible. Even then, the pattern identifies a feature to investigate, not a specific mechanism.

Worked Example: A Repeating Residual Pattern

In a hypothetical diagnostic summary, the mean residuals across three subjects at successive half-hour-centered time bins are as follows. The units are mg/L.

Time after dose (h)Mean residual (mg/L)
0.50.30
1.50.10
2.5-0.30
3.5-0.10
4.50.30
5.50.10
6.5-0.30
7.5-0.10

For the first bin, suppose the three subject residuals are \(0.20,\ 0.30,\ 0.40\) mg/L. Their mean is \((0.20+0.30+0.40)/3=0.30\) mg/L. The other displayed values are calculated in the same way from their bin observations. The sequence of four means repeats once: positive, less positive, negative, then less negative. The repeated shape is consistent with an oscillatory residual pattern over this hypothetical interval.

The pattern warrants checking whether the model captures the time course and whether the observations truly represent comparable dose histories. It does not by itself show that a four-hour biological cycle exists: binning can smooth individual variation, and limited repetition can make chance or sampling structure look periodic. The underlying points and subject identities should remain available when interpreting the summary.

Spread is assessed separately from the residual mean. If raw residuals fan out at later times, the change may reflect a time-dependent error variance, a scale effect, or differences in the observations represented at those times. Weighted residuals can help make observations with different modeled variances more comparable, but only if the variance model and weighting are appropriate. Standardization cannot repair a misspecified mean model.

Worked Example: Comparing Residual Spread at Early and Late Times

Consider two hypothetical groups of raw concentration residuals. At early times, the four values are \(-0.2,\ 0.2,\ -0.2,\ 0.2\) mg/L. At later times, they are \(-1.0,\ 1.0,\ -1.0,\ 1.0\) mg/L. Both group means equal zero. Use the sample standard deviation to compare their observed spread.

For the early group, the sum of squared deviations from zero is \(4(0.2^2)=0.16\ (\text{mg/L})^2\). With \(n=4\), its sample standard deviation is

$$ s_{\mathrm{early}}=\sqrt{\frac{0.16}{4-1}} =\sqrt{0.05333}=0.2309\ \text{mg/L}. $$

For the late group, the sum of squared deviations is \(4(1.0^2)=4.00\ (\text{mg/L})^2\), giving

$$ s_{\mathrm{late}}=\sqrt{\frac{4.00}{4-1}} =\sqrt{1.333}=1.155\ \text{mg/L}. $$

The late group’s sample standard deviation is about \(1.155/0.2309=5.00\) times the early group’s. This describes a much wider raw-residual spread in these hypothetical data. It does not establish a variance change in the underlying population: each group has only four observations, and the groups may differ in concentration level, subject mix, or dose history. Check whether the model’s observation-error scale predicts such a difference before treating it as a failure.

Diagnostics, Alternatives, and Limitations

A useful follow-up is to verify the construction before revising a model: confirm the dose-time reference, units, residual sign, prediction type, and included observations. Then inspect the points and subject or occasion structure behind any apparent pooled pattern. Sparse regions, heavy overplotting, and unequal sampling density can conceal or exaggerate trends. If observations are repeatedly measured within subjects, a cloud of many points should not be read as though every point were an independent replicate.

Residuals against time after dose focus on post-dose timing. A plot against elapsed study time instead asks whether errors vary over the broader course of an observation period; those time axes are not interchangeable. A residual-versus-prediction display focuses on whether residual behavior changes with the predicted level, rather than on when after a dose it occurs. These views can complement one another, but each answers a different diagnostic question. Summaries in time bins can clarify a dense display, although they can hide within-bin structure and should not replace the underlying points.

A common mistake is to conclude, “The late residuals are mostly negative, so the model underpredicts late concentrations.” That reverses the sign: because \(e=y-\hat{y}\), negative residuals mean observations tend to be below predictions, so the model tends to overpredict in that region. The correction is to state the residual definition and check its sign before interpreting any pattern. Another mistake is to label a changing raw-residual spread as a time trend in the mean; inspect location and spread separately.

No residual plot proves a model is correct, and a pattern-free plot is not proof that all assumptions hold. A diagnostic can have little power when data are sparse, when the relevant times were not sampled, or when subject-level patterns cancel in a pooled display. Interpret the plot as evidence about where the model may need scrutiny, in conjunction with the design and the model’s stated assumptions.

Key takeaway: Read residuals versus time after dose by asking two distinct questions: does the residual location vary with post-dose time, and does its spread vary? State the residual sign and scale, check the dose-time alignment, and treat any pattern as a diagnostic clue rather than a unique explanation.

Check Your Understanding

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

  1. A residual is defined as observed minus predicted concentration. What does a residual of \(-0.6\) mg/L mean?
  2. Residual means are \(0.2,\ 0.1,\ -0.1,\ -0.2\) mg/L at successive post-dose times. What pattern should you describe, and what should you avoid concluding?
  3. Why might a pooled residual plot against time after dose be misleading when subjects have different dose histories?
  4. Raw residual spread increases over time, while the residual mean remains near zero. Which feature has changed, and name one check before calling this model failure.
  5. What is the main interpretive difference between plotting residuals against time after dose and against elapsed study time?

Solutions. (1) The observation is 0.6 mg/L below the prediction, so the model prediction exceeds the observation by 0.6 mg/L. (2) The residuals show a gradual shift from positive to negative, suggesting a downward time-related pattern; the four means do not identify its cause or establish that it generalizes. (3) Equal time after dose can correspond to different prior dosing and concentration histories, so pooled observations may not be comparable; inspect dose histories and subject or occasion structure. (4) The spread has increased while the mean remains near zero. Check whether the assumed observation-error scale or the concentration range predicts wider raw residuals. (5) Time after dose describes position relative to a dose, whereas elapsed study time describes position along the broader observation period; a pattern on one axis need not appear on the other.

Clinical Biostats