Why alignment diagnostics matter
A pharmacokinetic model can be mathematically correct and still give misleading predictions if the data place a dose or covariate change at the wrong time. A sample recorded as occurring after a dose may actually have been drawn before it; a dose may have been entered at its scheduled rather than administered time; or a covariate may have been carried forward after a newer measurement was available. In each case, the model is asked to explain observations using a history that did not occur as represented.
The diagnostic task is not to declare that a timestamp is wrong whenever residuals look unusual. It is to find patterns that make a particular alignment error plausible, check those patterns against the recorded event history and source information, and distinguish them from ordinary variability or a problem with the model itself.
A useful starting point is to put all relevant records for one individual on a common time axis: dose administrations, samples, covariate measurements, and any derived covariate values used by the model. Check units, time origins, and whether times are elapsed time or clock time before interpreting distances between events. A dose, a sample, and a covariate measurement can share a numerical time but still have a meaningful order; the recorded or documented order must agree with the actual sampling and administration circumstances.
Residuals provide a second view of alignment. Define the raw residual as \(e_{ij}=y_{ij}-\widehat{y}_{ij}\). When a residual standard deviation \(\sigma_{ij}\) is specified for the observation, a standardized residual is \(r_{ij}=e_{ij}/\sigma_{ij}\). A positive residual means the observation is above the prediction; a negative residual means it is below. These signs describe the discrepancy, not its cause. For the simple numerical examples below, assume additive residual error with a constant \(\sigma\); other error models require the corresponding observation-specific scale.
Reading residuals around dose events
A dose-time plot can reveal an apparent lag between an event and the subsequent response. Residuals plotted against time, with dose events marked, can show whether the discrepancy changes direction around a dose. The direction matters: a dose entered too late can produce positive residuals before the recorded dose, followed by negative residuals after it, if the model predicts no dose-related response before the recorded event and an excessive response afterward.
Worked Example: A Dose Recorded Later Than It Was Given
Suppose, hypothetically, that a 100 mg intravenous bolus is actually administered at time 0 h. A one-compartment model has \(V=20\) L and \(k=0.10\) h\(^{-1}\), with no other doses or baseline concentration. The database records the dose at 2 h. Measurements are taken at 1 h and 3 h. Assume additive residual error with \(\sigma=0.50\) mg/L.
At 1 h, the actual-history concentration is \(100/20 \times e^{-0.10(1)}=5e^{-0.1}=4.524\) mg/L. Under the recorded history, the dose has not yet occurred, so the model prediction is 0 mg/L. The raw residual is \(4.524-0=+4.524\) mg/L, and the standardized residual is \(4.524/0.50=+9.048\).
At 3 h, the actual-history concentration is \(5e^{-0.10(3)}=3.704\) mg/L. The recorded history treats this as 1 h after the dose, so its prediction is \(5e^{-0.10(1)}=4.524\) mg/L. The raw residual is \(3.704-4.524=-0.820\) mg/L, and the standardized residual is \(-0.820/0.50=-1.640\).
The residual is strongly positive before the recorded event and negative afterward, consistent with a dose timestamp entered too late. The plot does not establish that explanation by itself: the dose record, sample times, and model assumptions should be checked before changing the history.
Checking shared times and covariate timelines
An observation and a dose can have the same recorded time. The correct ordering depends on what happened, not on a universal rule that dose records must always precede or follow observations. If a sample was drawn immediately before an intravenous bolus, a model that applies the bolus before predicting the sample uses the wrong state. Conversely, a post-dose sample should not be treated as predose merely because the records share a time value. The ordering convention must be explicit and consistent with the event documentation.
Covariates require the same attention to time. For a time-varying covariate, compare the measurement timeline with the value actually assigned to each prediction. A value may be stale if it remains in use after a newer measurement that should apply under the model's prespecified covariate rule. The rule might use stepwise values or interpolation; whichever is intended, the diagnostic is whether the values supplied to the model follow that rule and the observed measurement times. A timeline can expose a mismatch, but it cannot determine which value should apply without knowing the intended rule and relevant measurement context.
Worked Example: A Stale Renal-Function Covariate
In a hypothetical model, the elimination rate is \(k(t)=0.10\{\mathrm{CrCL}(t)/80\}\) h\(^{-1}\), where CrCL is in mL/min. At 8 h the concentration is 4.00 mg/L. CrCL is measured as 80 mL/min at 0 h and 40 mL/min at 8 h. Assume the intended rule is stepwise updating at the measurement time, and consider a sample at 12 h. For this calculation, assume no intervening dose and constant \(k\) over each interval.
Using the updated covariate, \(k=0.10(40/80)=0.0500\) h\(^{-1}\) from 8 h to 12 h. The predicted concentration is \(4.00e^{-0.0500(12-8)}=4.00e^{-0.2}=3.275\) mg/L. Suppose the hypothetical measured concentration is 3.30 mg/L. Its raw residual under the updated history is \(3.30-3.275=+0.0250\) mg/L.
If the data-processing step instead carries the 0 h value forward, it uses \(k=0.10\) h\(^{-1}\) for the interval. The prediction becomes \(4.00e^{-0.10(4)}=4.00e^{-0.4}=2.681\) mg/L, and the residual is \(3.30-2.681=+0.619\) mg/L. The discrepancy is compatible with a stale covariate value, since the timeline contains a newer measurement and the supplied history did not update. Whether the newer value should apply must still be checked against the model's covariate rule and measurement records.
Worked Example: A Sample Ordered After an Intravenous Bolus
Suppose, hypothetically, that a sample is collected immediately before a 100 mg intravenous bolus at 6 h. The predose concentration is 2.00 mg/L and the model has \(V=20\) L. The records share the time 6 h, but an event-ordering error makes the model apply the bolus before predicting the sample. Assume an instantaneous bolus and additive residual error with \(\sigma=0.25\) mg/L.
The correct predose prediction is 2.00 mg/L, so the raw residual should be \(2.00-2.00=0.00\) mg/L. If the model applies the dose first, the predicted concentration becomes \(2.00+100/20=7.00\) mg/L. The resulting raw residual is \(2.00-7.00=-5.00\) mg/L, and the standardized residual is \(-5.00/0.25=-20.0\).
A large negative residual at the shared time, together with a documented predose sample, points to incorrect event ordering. It would not be appropriate to interpret this example as a general rule that a sample at dose time is always predose; the documented sequence determines the correct prediction.
A practical diagnostic workflow
Use the timeline and residuals together. First inspect records and their units; then evaluate whether the model's predictions use the intended history. Finally, check whether the observed residual pattern is localized around the suspected event or persists more broadly. The following sequence keeps a visual clue from becoming an unsupported data correction.
For one individual, display dose times and amounts, observation times, covariate measurement times and the covariate values actually used by the model. Confirm the time origin and units.
At shared times, compare event order with sample collection and administration records. For each covariate, check that the model input follows the intended stepwise or interpolated history.
Overlay observations and model predictions over time, mark dose and covariate events, and inspect raw or appropriately scaled residuals. Look for abrupt, event-aligned discrepancies and their signs.
Check source records, sample timing, units, and data processing. A visually plausible shift is a hypothesis to investigate, not permission to move records until the fit improves.
A dose-event plot is especially useful for localizing a suspicious response relative to administrations. A covariate timeline is more direct for detecting stale values or implausible update timing. Residual-versus-time plots show the direction and persistence of prediction errors, while residuals against predictions can reveal broader patterns that are not confined to a particular event. These displays are complementary: a residual plot alone does not identify which record is wrong, and a timeline alone does not show whether a mismatch materially affects predictions.
Interpretation, alternatives, and limitations
The main alternative to an alignment explanation is that the event history is correct but the model does not describe the response adequately. For example, systematic residuals could reflect an incorrect structural model, an unsuitable residual-error model, or an individual whose observed response is unusual. A pattern restricted to the period around a specific dose or covariate update increases the relevance of checking that history, but does not rule out these alternatives. Conversely, residuals without a clear event-linked pattern do not prove that the history is correct.
Source-record review is the strongest way to resolve a suspected timing discrepancy when reliable administration and sampling records are available. Timeline plots and residuals help identify what to review and where. A model-based comparison of histories can show whether predictions are sensitive to an encoding, but improved fit alone cannot verify which history occurred. Do not treat a smaller residual after moving a dose or changing a covariate value as evidence that the revised record is true.
Diagnostics can also be weak when observations are sparse, events are close together, concentrations are noisy, or dose effects are delayed or prolonged. Multiple explanations may yield similar residual patterns. In those settings, report the ambiguity, preserve the original recorded data, and seek independent documentation where possible. These checks diagnose possible data-history problems; they do not replace the model's assumptions or establish causation between a covariate and a response.
Check Your Understanding
Answer each question using the assumptions stated. Brief solutions follow the questions.
- In a simple bolus model, a dose actually given at 0 h is recorded at 1 h. What residual-sign pattern may occur before and after 1 h, and why?
- A sample is measured at exactly the recorded time of a bolus. What information determines whether the model should apply the dose before predicting the sample?
- A covariate is measured again at 10 h, but the model continues using its 0 h value. What two checks are needed before calling this stale-value misalignment?
- For an observation of 3.0 mg/L, the model predicts 3.6 mg/L and the additive residual SD is 0.30 mg/L. Calculate the raw and standardized residuals and state their signs.
- Why does a better fit after shifting an event not, by itself, establish that the shifted time is correct?
Solutions. (1) Under the stated instantaneous-bolus assumptions, residuals may be positive before the recorded dose because the actual dose has occurred but the model predicts none; after the recorded time, residuals may be negative because the model's delayed dose prediction is too high relative to the actual-history prediction. (2) The documented order of sample collection and dose administration determines the order; shared timestamps alone do not. (3) Check the intended covariate update rule and confirm that the 10 h measurement is valid and should apply to subsequent predictions. (4) The raw residual is \(3.0-3.6=-0.60\) mg/L. The standardized residual is \(-0.60/0.30=-2.00\), so both are negative. (5) Different histories or model errors can produce similar improvements in fit. Independent event documentation, not fit improvement alone, is needed to establish what occurred.