Tutorials › Nonlinear Mixed-Effects Models (NLME) › Residuals Against Time Since Dose

Goodness-of-Fit Diagnostics and Their Pitfalls · Tutorial 543 of 797

Residuals Against Time Since Dose

Learn to read residual-versus-time-since-dose plots while separating within-subject temporal behavior from artifacts of pooling subjects.

Intermediate 10 min read

What You'll Learn

  • Choose a meaningful time-since-dose scale for residual diagnostics.
  • Identify time-localized underprediction and overprediction from residual signs.
  • Compare residual spread across time regions without over-interpreting small samples.
  • Recognize how unequal subject representation can create a pooled trend.
  • Use stratification and sampling checks to investigate apparent temporal patterns.
  • Understand the limits of this plot and when other diagnostics are needed.

Why Plot Residuals Against Time Since Dose?

A model can fit measurements reasonably well on average yet miss systematically at particular stages after a dose. For example, it might underpredict concentrations soon after dosing and overpredict them later. Plotting residuals against time since dose makes this kind of time-localized discrepancy visible. The plot can also suggest that residual variability changes over the dosing interval or that similar patterns recur across intervals.

The plot is a diagnostic, not a test that identifies a unique cause. A visible pattern may reflect a model mismatch, the residual definition, the way observations are distributed across subjects and times, or a feature of the data that the model does not represent. Interpretation therefore starts with the residual scale and the time variable, and checks whether the pattern occurs within subjects or only after pooling.

Definition: For observation \(i\) from subject \(j\), let \(t_{ij}\) be the elapsed time since the relevant dose and let \(r_{ij}\) be the selected residual. A residual-versus-time-since-dose plot places \(t_{ij}\) on the horizontal axis and \(r_{ij}\) on the vertical axis. The reference value \(r_{ij}=0\) marks no signed residual on that residual scale.

Set Up the Plot Before Reading It

Use a residual whose meaning is clear. A raw residual, a weighted residual, and a conditional residual do not have interchangeable scales or reference distributions. The earlier material on residual types, prediction variance, and reference distributions establishes how these quantities differ. In this plot, state which residual is shown and interpret its scale accordingly. For a residual defined as observed minus predicted, a positive value means the prediction is below the observation; a negative value means it is above. Standardization changes the scale, not this sign convention.

For a suitable standardized residual, values near zero are generally the visual target; residuals such as CWRES are often assessed against an approximate zero-centered, unit-spread reference under the conditions for their use. Do not impose that exact reference on every residual type. In particular, conditional residuals and their reference behavior depend on how individual effects enter their calculation. The reference distribution for the chosen residual should guide interpretation, rather than a generic rule that every residual must have variance exactly one.

Define time since dose consistently. In a single-dose setting, this may be time elapsed since that dose. In repeated dosing, the relevant dose and interval must be explicit: resetting time at each dose can be useful for comparing intervals, but may conceal accumulation or differences between occasions. If dose times, sampling times, or time origins are recorded incorrectly, the horizontal axis itself can mislead. Also check whether measurements at a given time are contributed by many subjects or by only a few.

Reading rule: A run of positive residuals suggests underprediction on an observed-minus-predicted scale; a run of negative residuals suggests overprediction. A changing vertical spread suggests time-varying residual dispersion. These are clues to investigate, not proof of a particular structural or error-model defect.

Worked Examples

Worked Example: Bias Localized to Parts of the Dosing Interval

Suppose a hypothetical analysis produces twelve standardized residuals, four in each of three time-since-dose regions. The values are:

Early: \(1.2, 1.0, 0.8, 1.0\). Middle: \(-0.2, 0.1, 0.0, 0.1\). Late: \(-1.0, -0.8, -1.2, -1.0\).

Calculate the mean residual in each region using \(\bar{r}=\sum r_i/n\). For the early region, \((1.2+1.0+0.8+1.0)/4=4.0/4=1.00\). For the middle region, \((-0.2+0.1+0.0+0.1)/4=0/4=0\). For the late region, \((-1.0-0.8-1.2-1.0)/4=-4.0/4=-1.00\).

The early residuals are predominantly positive, while the late residuals are predominantly negative. If these are observed-minus-predicted residuals, this pattern is consistent with early underprediction and late overprediction, with little average signed residual in the middle region. It raises a time-localized bias concern, but four observations per region do not establish a general pattern or explain its cause. Check the individual subjects and the distribution of their sampling times before treating the pooled pattern as a within-subject effect.

Worked Example: Comparing Residual Spread Across Time

In a separate hypothetical data set, four early standardized residuals are \(-0.1, 0.1, -0.2, 0.2\), and four late residuals are \(-\sqrt{1.22}, \sqrt{1.22}, -\sqrt{1.22}, \sqrt{1.22}\), approximately \(-1.105, 1.105, -1.105, 1.105\). Each group has mean zero. Compare the sample standard deviations using \(s=\sqrt{\sum(r_i-\bar{r})^2/(n-1)}\).

For the early group, the sum of squared deviations is \(0.01+0.01+0.04+0.04=0.10\). Thus \(s_{\text{early}}=\sqrt{0.10/3}=0.1826\). For the late group, the sum of squared deviations is \(4(1.22)=4.88\). Thus \(s_{\text{late}}=\sqrt{4.88/3}=1.2754\). The ratio, calculated from the unrounded values, is \(\sqrt{4.88/0.10}=6.9857\), or about \(6.99\). Using the displayed rounded standard deviations instead gives \(1.275/0.1826\approx6.9825\), about \(6.98\); the small difference is due to rounding.

The late observations have much greater sample spread in this small illustration, despite both groups having mean zero. This is a descriptive signal of changing dispersion, not a formal conclusion about the population variance: each group contains only four observations, and the groups may differ in which subjects contribute. Inspect subject composition and the full residual pattern before considering whether the model's residual variability is inadequate at later times.

Worked Example: A Pooled Trend Created by Subject Composition

Consider two hypothetical subjects whose residuals are constant over time: subject A has residual \(+0.8\) at every sampled time, and subject B has residual \(-0.8\) at every sampled time. Suppose the early region contains four observations from A and one from B, while the late region contains one observation from A and four from B.

The pooled early mean is \((4(0.8)+1(-0.8))/5=(3.2-0.8)/5=0.48\). The pooled late mean is \((1(0.8)+4(-0.8))/5=(0.8-3.2)/5=-0.48\). A pooled plot therefore appears to shift downward by \(0.96\) residual units from early to late.

Yet neither subject has a time trend: A remains at \(+0.8\), and B remains at \(-0.8\). The changing pooled mean arises because the mix of subjects changes across time. It would be misleading to conclude from the pooled means alone that the model increasingly overpredicts within subjects. Examine subject representation across the time range and compare the pattern within subjects where data allow.

Why Pooling Can Change the Picture

The composition issue has a general expression. Let \(m_j(t)\) denote the mean residual at time \(t\) for subject \(j\), where that subject has relevant observations. The pooled conditional mean can be represented as a weighted average:

$$ E(r\mid t)=\sum_j E(r\mid t,j)P(j\mid t). $$

Even if each subject's mean residual is constant over time, say \(E(r\mid t,j)=a_j\), the pooled mean becomes \(\sum_j a_jP(j\mid t)\). If the weights \(P(j\mid t)\), meaning the relative representation of subjects at time \(t\), change over the interval, the pooled mean can change too. This explains why a pooled trend is not automatically a within-subject trend. The same compositional issue can affect apparent spread if subjects have different residual levels or variability.

A practical check is to ask whether the subjects observed early are also observed later, and whether the apparent pattern is present in multiple subjects. If the data are too sparse to answer those questions, report that limitation rather than implying that the pooled plot resolves it. A smooth curve can help summarize a broad trend, but it cannot correct a changing subject mix and may be unstable where observations are sparse.

Diagnostics, Alternatives, and Limits

Inspect the point cloud as well as any summary curve. A broad shift above or below zero suggests a change in signed bias; a widening or narrowing cloud suggests changing spread; and a repeated rise-and-fall pattern may indicate that residuals vary systematically through the dose interval. Distinguish these visual features: a smooth trend through the centers of the points is not the same as a change in spread around zero. A few extreme points can also pull a smooth curve, so check whether a pattern is supported by many observations and subjects.

The plot is most informative when time has the same interpretation for all observations, there are enough measurements across the relevant time range, and subjects are not represented in a way that confounds time with subject. Uneven sampling, dose-time errors, multiple dosing intervals, and sparse late-time observations can all weaken interpretation. Standardized residuals are estimates based on a fitted model, so their apparent pattern is not independent evidence in the way a new data set would be. The plot also cannot by itself distinguish among competing biological explanations for a pattern.

Use complementary diagnostics to answer different questions. A residual-versus-time plot locates potential mismatch along the dose interval. Residuals against population predictions, covered in the following material, instead examine whether residual behavior changes with predicted response level. Individual-level displays can help expose subject-specific behavior, while residual runs and autocorrelation diagnostics address ordering and dependence more directly. These views complement one another; none makes the others unnecessary.

1
Confirm the axes.
Record the residual type, sign convention, time origin, and dose interval represented by time since dose.
2
Describe the visible feature.
Separate a shift in residual center from a change in vertical spread or a repeated time-shaped pattern.
3
Check subject composition.
Ask which subjects contribute in each region and whether the pattern is supported within subjects rather than only in the pooled cloud.
4
State the limitation.
Describe the pattern as a diagnostic signal and use other views or model checks before assigning a cause or changing the model.

A common mistake is to see a declining pooled smooth and conclude that the model overpredicts progressively later after every dose. That conclusion does not follow if early and late observations come from different subjects, as the third example demonstrates. The correction is to check subject representation and within-subject evidence, then describe only what the plot supports. Similarly, unequal point spread is a reason to investigate time-varying residual variability, not by itself proof that a particular error model is wrong.

Key takeaway: Residuals against time since dose are useful for locating when a model's residual behavior changes. Interpret the sign, center, and spread separately, and verify that a pooled pattern is not explained by changing subject composition.

Check Your Understanding

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

  1. On an observed-minus-predicted residual scale, what does a group of positive residuals at early times suggest?
  2. Why can a pooled time trend appear even when each subject has no within-subject time trend?
  3. Four residuals are \(0.5, -0.5, 0.5, -0.5\). What are their mean and sample standard deviation?
  4. Name two features of a residual-versus-time plot that should be distinguished rather than treated as the same signal.
  5. What is one reason a time-since-dose plot may be hard to interpret in a repeated-dose setting?

Solutions. (1) Positive observed-minus-predicted residuals indicate underprediction on average at those times. (2) The relative representation of subjects can change with time; subjects with different residual levels may then receive different weights in the pooled mean. (3) The mean is \((0.5-0.5+0.5-0.5)/4=0\). The sum of squared deviations is \(4(0.5^2)=1\), so \(s=\sqrt{1/(4-1)}=\sqrt{1/3}=0.5774\). (4) A shift in the residual center and a change in vertical spread are distinct features. (5) Time may be reset at each dose even when accumulation or differences between dosing intervals matter, so the horizontal axis may not capture all relevant timing structure.