Why Plot PD Residuals Against Time?
A dynamic pharmacodynamic model describes how a response changes over time, often after a dose or change in exposure. Its predictions may match the overall response range yet miss the timing or persistence of the response. A residual-versus-time plot makes that kind of discrepancy visible: it places residuals in chronological order instead of treating them as an unordered collection.
The purpose is not to decide from a picture which biological mechanism is wrong. A temporal pattern is evidence that the model, its error description, or the data-collection process may not account for something systematic over time. The plot helps distinguish that evidence from residuals that fluctuate around zero without an obvious temporal arrangement.
The model prediction used to calculate a residual matters. A conditional prediction uses subject-specific information, whereas a population prediction does not condition on that subject's estimated random effects. These choices answer different diagnostic questions. State which prediction and residual type produced the plot, and keep the choice consistent when comparing patterns. For this tutorial, \(e_{ij}\) denotes a raw residual unless a different scale is explicitly stated.
How to Read the Plot
A useful reference is a horizontal line at zero. If the residual scale has been appropriately standardized, reference bands can also help show the scale of typical variation; they do not turn visual inspection into a formal test. Look for arrangement over time, not merely whether a point is large. A single unusually large residual may be an isolated observation, while a sequence of moderate residuals on one side of zero can suggest persistent misfit.
| Visual feature | What it looks like | What it may indicate |
|---|---|---|
| Temporal run | Several neighboring residuals are on the same side of zero | The model may repeatedly overpredict or underpredict during that interval |
| Drift | Residuals move gradually upward or downward as time advances | A changing discrepancy, not captured by the fitted time course, may be present |
| Periodic pattern | Residuals repeatedly alternate or cycle through positive and negative values | A recurring temporal feature may be missing or poorly represented |
| Isolated scatter | Signs and magnitudes vary without an evident sequence | No clear temporal structure is apparent, though other forms of misfit can remain |
The sign gives the direction of discrepancy. A run of negative residuals means observations repeatedly fall below predictions over that interval; it does not, by itself, identify the cause. A drift could reflect a misspecified time course, a changing baseline, a protocol effect, or a data issue. A repeating pattern could be associated with a periodic feature, but visual periodicity alone does not establish a mechanism or a precise period.
For longitudinal data, begin with subject-level displays, such as separate panels or clearly distinguished subject traces. A pooled plot can be useful for seeing broad population-level structure, but it may hide opposing subject-specific patterns or create apparent structure because subjects contribute observations at different times. Where subjects have different dose times or schedules, define the horizontal axis meaningfully—for example, time since dose—rather than combining incompatible clock times without explanation.
A Short Justification: Why Runs Matter
A pattern of consecutive residual signs is noteworthy because random scatter and ordered signs are not the same arrangement. For illustration, suppose four residuals are independent, continuous, and symmetrically distributed around zero. Each sign is then positive or negative with probability one half, and all \(2^4=16\) sign sequences are equally likely. Exactly two sequences have all four signs alike: \(++++\) and \(----\). Thus:
This calculation is a justification for noticing runs, not a diagnostic test for a fitted PK/PD model. The assumptions are restrictive: residual signs may not be independent, may not be symmetric, and may be affected by parameter estimation. In addition, an analyst looking at many subjects, time windows, or plot variants has many opportunities to notice a striking sequence by chance. Treat a run as a prompt to investigate, not as a standalone significance claim.
Worked Examples
Worked Example: A Persistent Run of Negative Residuals
Consider hypothetical standardized residuals from one subject, calculated as observed minus predicted and divided by the applicable residual standard deviation. The values at hours 0, 2, 4, 6, and 8 are \(0.2,\ -0.3,\ -0.8,\ -1.0,\ -0.7\). Identify the pattern and interpret its direction.
The first residual is positive, but the next four are negative. The sequence from hour 2 through hour 8 is therefore a four-observation run below zero. The average of those four standardized residuals is:
During that interval, the observed responses are generally below the model predictions. Because the values are standardized, \(-0.700\) is an average in standardized-residual units, not a response difference in the original PD units. The run is more informative than a claim that one residual is “large”: several observations have the same directional discrepancy. It warrants checking the fitted trajectory and the observation context, but it does not prove a particular mechanism is missing.
Worked Example: Quantifying a Downward Drift
In a hypothetical study, standardized residuals for one subject at times 0, 2, 4, and 6 hours are \(1.0,\ 0.4,\ -0.2,\ -0.8\). To summarize the apparent linear drift, compute the least-squares slope of residual on time. This summary describes the displayed points; it is not a formal test.
The mean time is \(\bar{t}=(0+2+4+6)/4=3\) hours. The mean residual is \(\bar{r}=(1.0+0.4-0.2-0.8)/4=0.100\). The slope is the sum of cross-products divided by the sum of squared time deviations:
Substituting the values gives a numerator of \(({-3})(0.9)+({-1})(0.3)+(1)(-0.3)+(3)(-0.9)=-6.0\), and a denominator of \(9+1+1+9=20\) hours squared. Therefore:
The residuals decrease by 0.300 standardized-residual units per hour along this fitted straight-line summary. The ordered values also make the pattern clear directly: residuals decline from \(1.0\) to \(-0.8\), crossing zero. This suggests time-dependent discrepancy in this subject's predictions. Four observations cannot establish that the trend is linear, nor do they explain its cause.
Worked Example: Recognizing Alternation Without Overclaiming Periodicity
Suppose hypothetical residuals at equally spaced times 0, 1, 2, 3, 4, and 5 hours are \(0.6,\ -0.5,\ 0.7,\ -0.6,\ 0.5,\ -0.7\). Count the sign changes and describe what the plot supports.
The signs are \(+,-,+,-,+,-\). There is a change of sign between every pair of consecutive observations, giving five sign changes across five intervals. The magnitudes are also similar, from \(0.5\) to \(0.7\) standardized-residual units. This repeated alternation is unlike an isolated point and is a visible temporal pattern worth investigating.
The data support the description “alternating residuals at the observed sampling times.” They do not, on their own, establish a biological cycle or a reliable period. Six points may be too few to distinguish a true repeating process from chance alternation, sampling structure, or another source of error. Interpretation should include the schedule and the response context.
Practical Display and Diagnostic Checks
Before interpreting a time plot, verify that its construction preserves the temporal information of interest. Use the actual observation time for each residual, order observations within subject, and state whether time is measured from dose, study entry, or another origin. If time is irregularly spaced, show the actual times; placing observations at equal horizontal intervals would distort apparent timing. If several dosing occasions are present, make clear whether time resets at each dose or continues on a study clock.
Record whether the plotted quantity is raw, standardized, or simulation-based, and whether predictions are conditional or population-level.
Choose a time origin that matches the question; distinguish subjects or show separate panels when individual trajectories matter.
Assess runs, directional movement, and repetition across time. Compare those patterns with isolated deviations and with the planned sampling schedule.
Review missingness, timing deviations, measurement limits, residual scaling, and the fitted prediction before attributing a pattern to PD dynamics.
A pattern may also be an artifact of the residual scale. With heteroscedastic response error, raw residual spread can change over time simply because the expected variance changes. Standardized or otherwise appropriately scaled residuals can help compare deviations across time, provided their construction is suitable for the model. For non-Gaussian responses, use a residual definition appropriate to that outcome rather than assuming raw differences should have a constant scale.
Check whether a few observations dominate the visual impression. A single extreme value can stretch the vertical axis and make ordinary residuals look compressed; inspect a version that preserves the full scale and, when useful, a complementary view that makes the central pattern easier to see. Do not delete or suppress an observation simply because it disrupts a clean pattern. Investigate its measurement, timing, and model contribution.
How This Plot Relates to Other Diagnostics
The time plot answers a focused question: does residual direction or magnitude appear organized by time? A residual-versus-concentration or residual-versus-predicted-effect plot instead organizes discrepancies by exposure or model-predicted response. Those views can reveal patterns that a time plot does not, particularly when similar times correspond to different concentrations or effects. Conversely, a time plot can reveal a sequence of discrepancies even when residuals do not show a simple relationship to concentration.
A visual run is also distinct from a formal analysis of residual autocorrelation or serial dependence. The latter addresses dependence more directly and requires attention to its assumptions and design; the time plot is an exploratory display that helps identify where such a question may arise. Do not report the sign-run calculation above as a substitute for that analysis.
Finally, a residual pattern does not uniquely identify the source of model failure. Time-varying baselines, delayed response, turnover, tolerance, rebound, and other dynamic features can produce temporal discrepancies, but distinguishing those explanations requires targeted model assessment. The time plot can motivate those investigations without deciding among them.
Common Mistakes and Limitations
- Calling any large residual a temporal pattern. A single point is an isolated deviation; persistence requires an ordered pattern across observations.
- Pooling subjects without checking individual traces. Different schedules and opposing within-subject patterns can obscure or manufacture apparent structure in a pooled display.
- Ignoring the residual definition. Raw residuals with changing variance are not directly comparable in spread across time; state and justify the scale used.
- Treating a visual run as proof. Runs can occur by chance, especially when many plot windows are inspected, and residual assumptions may not match the simple sign calculation.
- Inferring mechanism from shape alone. Drift or alternation identifies a pattern to investigate, not its biological cause.
- Ignoring actual sampling times. Equal spacing in a graph when observations are irregular can misrepresent the duration and frequency of apparent patterns.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- A subject has residuals \(-0.4,\ -0.2,\ 0.6,\ -0.3\) at four successive times. Is there a three-point run on one side of zero?
- For four independent, continuous, symmetric residuals, what is the probability that all four signs match?
- At times 0, 2, and 4 hours, standardized residuals are \(0.8,\ 0.2,\ -0.4\). What is the slope of residual on time, and what are its units?
- Why can a pooled residual-versus-time plot conceal a pattern present within individual subjects?
- What conclusion is justified by repeated positive-negative alternation, and what conclusion is not justified by that pattern alone?
Solutions. (1) No. The first two values are negative, the third is positive, and the fourth is negative; there is no sequence of three consecutive residuals with the same sign. (2) There are \(2^4=16\) equally likely sign sequences under the stated assumptions, and two have all signs alike, so the probability is \(2/16=0.125\). (3) The mean time is 2 hours and the mean residual is 0.2. The cross-product sum is \((-2)(0.6)+(0)(0)+(2)(-0.6)=-2.4\), and the squared-time-deviation sum is \(4+0+4=8\). Thus the slope is \(-2.4/8=-0.300\) standardized-residual units per hour. The negative value describes a downward trend in these three points, not a formal test. (4) Subjects may contribute observations at different times, and positive patterns in some subjects may cancel negative patterns in others; subject-level displays reveal the within-subject ordering. (5) The justified conclusion is that residual signs alternate at the observed times, a temporal structure worth investigating. The pattern alone does not prove a biological cycle, establish its period, or identify the mechanism responsible.)