Tutorials › Population Pharmacokinetics › Prevent Look-Ahead in Time-Varying Imputation

Dataset Construction and Quality Control · Tutorial 50 of 599

Prevent Look-Ahead in Time-Varying Imputation

You will learn to distinguish valid past-only information from future measurements and to evaluate how different imputation rules affect a time-varying covariate.

Intermediate 10 min read

What You'll Learn

  • Define the information set available at a PK sample time.
  • Distinguish a measurement’s event time from the time its value became available.
  • Explain why interpolation between past and future measurements can create temporal leakage.
  • Work through past-only carry-forward and trend-based imputation examples.
  • Compare common imputation approaches and identify their limitations.
  • Check an imputation workflow for future-information leakage.

Why Timing Matters in Imputation

A time-varying covariate is intended to describe a subject’s state at a particular time: for example, body weight at a concentration sample or a laboratory value at a dosing occasion. If that covariate is missing, a value can be imputed only after the analysis specifies what information is allowed to inform it. A rule that uses a measurement made after the target time may produce a plausible estimate, but it does not represent information available at the target time.

This distinction matters whenever the covariate is meant to represent what was known at a particular occasion, including when constructing an analysis dataset or evaluating a prediction made at that time. Using later information can make an analysis appear to have better information than it actually had. The issue is not whether the later measurement is accurate; it is whether it was available for the time-specific task.

Definition: For subject \(i\), let \(C_i(t)\) be the covariate value intended to represent the subject at target time \(t\). Let measurement \(j\) have value \(C_{ij}\), measurement (event) time \(u_{ij}\), and availability time \(a_{ij}\), the time at which the value was recorded or otherwise became available for use. The information available at \(t\) consists of values and other inputs whose availability times are no later than \(t\). A point-in-time imputation is past-only if it uses only that information, along with any prespecified rules or parameters legitimately available at \(t\).

The measurement time and availability time are often the same, but they need not be. For example, a blood sample may be collected before a PK sample while its laboratory result is reported later. If the task is to reconstruct what was known at the PK time, collection before that time does not make the result available before it. Establishing this distinction is a data-timing decision, not a numerical imputation decision.

Information Sets and a Simple Leakage Check

For a target time \(t\), a measurement can inform a past-only imputation only when it is available by \(t\). In notation, a measurement is eligible when \(a_{ij}\leq t\). If the imputation is intended to describe the state at \(t\), its measurement time should also be relevant to that state; a value from a later event time does not become a past observation merely because it appears in the completed dataset.

A useful audit question is: Could this value have been accessed at the target time, using the information sources and timestamps defined for this analysis? If not, an imputation that depends on it has look-ahead. The check applies not only to individual measurements but also to quantities calculated from them. For example, a subject-specific rate of change estimated from observations on both sides of \(t\) uses future information even if the final imputed value is labelled as occurring at \(t\).

The condition can be written compactly. If \(\mathcal{F}_i(t)\) denotes the information available for subject \(i\) by time \(t\), then a point-in-time imputation has the form

$$ \widehat{C}_i(t)=g\{\mathcal{F}_i(t)\}, $$

where \(g\) is a specified imputation rule. This notation is a constraint on the inputs to the rule, not a guarantee that the estimate is accurate. A rule can be past-only and still be a poor approximation to the covariate at \(t\).

Worked Example: Interpolation That Uses a Future Measurement

Suppose a hypothetical subject has a body weight of 60 kg measured at day 0 and 66 kg measured at day 24. Weight is missing at day 12. A straight-line interpolation between the two recorded values would give

$$ \widehat{C}(12)=60+\frac{12-0}{24-0}(66-60) =60+\frac{12}{24}\times 6=63\text{ kg}. $$

The arithmetic is correct for interpolation between those two measurements. But the 66 kg value is from day 24, so it was not available at day 12. The estimate of 63 kg therefore uses future information and is not a past-only, point-in-time imputation.

If the prespecified rule is to carry forward the latest eligible observation, the only eligible weight here is 60 kg from day 0. The past-only result is 60 kg, subject to whatever maximum age or clinical-use rule has been specified for carrying a value forward. It may be a less accurate estimate of day-12 weight than 63 kg; that possibility does not make the future-dependent estimate valid for a task restricted to information available by day 12.

Past-Only Rules and Their Assumptions

A past-only rule must be chosen to suit the covariate and the intended use. The earlier material on carrying longitudinal covariates forward addresses when a prior value may reasonably stand in for a later one. Here the additional requirement is to verify that the value being carried forward was actually available by the target time. If there is no eligible prior value, or if the last value is too old under the prespecified rule, the workflow should not quietly substitute a future value.

One alternative, when a locally linear change is scientifically plausible, is to estimate a trend from two or more prior measurements and extrapolate forward. For two prior observations at times \(t_1<t_2\leq t\), a simple linear rule is

$$ \widehat{C}_i(t) =C_i(t_2)+ \frac{C_i(t_2)-C_i(t_1)}{t_2-t_1}(t-t_2). $$

This rule uses no future measurement if both prior values were available by \(t\). Its interpretation depends on an assumption: the recent rate of change is a reasonable approximation over the extrapolation interval. The formula does not establish that assumption. It can be unreliable when the covariate changes abruptly, has a nonlinear trajectory, or is measured with substantial error.

Worked Example: Extrapolating a Past Trend

In a hypothetical record, body weight is 68.0 kg at day 0 and 69.0 kg at day 4. The value at day 6 is missing. Assume the stated imputation rule uses the linear trend from these two prior measurements and that both values were available by day 6.

The estimated daily change is

$$ \frac{69.0-68.0}{4-0} =\frac{1.0\text{ kg}}{4\text{ days}} =0.25\text{ kg/day}. $$

Extrapolating from day 4 to day 6 gives

$$ \widehat{C}(6)=69.0+(0.25)(6-4)=69.5\text{ kg}. $$

The inputs are both from times before day 6, so this calculation avoids look-ahead. Its 69.5 kg estimate is conditional on a constant local rate of increase over those two days. It should not be treated as an observed measurement or as a certainty about the subject’s true weight.

Availability Timestamps Can Change the Answer

A reliable rule needs consistent timestamp definitions. When source systems record several times for a value, retain the times needed to determine whether it was usable at the target occasion. A collection time alone may not be enough if the value is released, verified, or entered later. Conversely, if the analysis’s defined information set is based on collection rather than result availability, that choice must be explicit and appropriate to the task.

Worked Example: A Prior Collection With a Later Result

At a hypothetical PK sampling time of day 10, weight is missing. The source contains two other weight records: 70 kg collected at day 4 and available in the record at day 5; and 72 kg collected at day 8 but not reported until day 13. Under a rule based on information actually available by day 10, which record can be used?

For the first record, the availability time is day 5, and \(5\leq10\), so the 70 kg value is eligible. For the second record, the availability time is day 13, and \(13>10\), so the 72 kg value is not eligible for a day-10 point-in-time imputation, even though its collection occurred on day 8.

If the prespecified rule is last eligible observation carried forward, the day-10 imputed value is therefore 70 kg. Using 72 kg would import information that was not available at day 10. The same conclusion applies if the value was available earlier but the analysis record has lost that availability timestamp: the missing metadata should be resolved or the eligibility rule made explicit, rather than assumed in whichever way produces a convenient result.

Comparing Approaches, Diagnostics, and Limitations

Common approaches differ in what they assume and what information they need. The key question for this tutorial is whether that information was available by the target time. A method that uses future observations can sometimes be useful for a different, explicitly retrospective task, but it does not satisfy a past-only requirement.

ApproachInformation usedKey consideration
Carry forward the last eligible valuePrior value available by \(t\)Requires an appropriate rule for how old a carried value may be and when a covariate can be treated as stable.
Past-only trend extrapolationTwo or more prior values available by \(t\)Requires the historical trend to be informative over the extrapolation interval; uncertainty can grow with that interval.
Linear interpolationValues before and after \(t\)Usually depends on a future value, so it is not point-in-time past-only imputation at \(t\).
Leave the value missingNo substituted covariate valueAvoids unsupported substitution, but requires an analysis plan that can handle the remaining missingness.

Useful diagnostics include checking that every source record used has an availability time no later than its target time; sorting target times and source times to identify any later inputs; and reviewing the largest gaps between a target time and its last eligible measurement. Compare imputed values with observed values at later times as a plausibility check, but do not feed those later values back into the past-only imputation. A later observed value can help evaluate a rule retrospectively without being an input to the point-in-time estimate.

A past-only method has limitations. Carrying a value forward can miss real change; extrapolation can amplify measurement noise or extend an unrepresentative trend; and leaving a value missing may limit which records can be used in a later analysis. No timestamp rule resolves whether a method is scientifically suitable. That requires a covariate-specific rationale and sensitivity checks appropriate to the analysis. Also, if a rule’s parameters are estimated from data, they must not use future information when the task is genuinely point-in-time prediction. A fixed rule or parameters estimated from an appropriate earlier training dataset can avoid that additional source of leakage.

A Practical Review Sequence

1
Define the target time.
Specify the occasion the covariate is intended to represent, such as the time of a PK sample.
2
Establish availability.
Identify which timestamps determine when each value could be used, and distinguish these from measurement event times where needed.
3
Apply a prespecified rule.
Use only eligible information and state the rule’s assumptions, such as stability for carry-forward or a locally linear trend for extrapolation.
4
Audit the inputs and limits.
Check that no input was available after the target time, review stale or extrapolated values, and document when the rule cannot produce a defensible value.

Common Mistake

Wrong reasoning: “The day-24 weight is the closest observation to day 12, so averaging the day-0 and day-24 weights is the best way to fill the gap.” Correction: closeness in time does not determine eligibility. If the task requires what was knowable at day 12, the day-24 measurement is future information. Select a defensible past-only rule or retain the value as missing; do not use interpolation merely because it appears numerically balanced.

Key takeaway: For a point-in-time covariate value at \(t\), use only information available by \(t\). Check both when a measurement occurred and when its value became available, and make the assumptions and limits of the past-only imputation explicit.

Check Your Understanding

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

  1. A covariate is 50 units at day 2 and 58 units at day 10. It is missing at day 6. What does straight-line interpolation give, and why is it not past-only at day 6?
  2. A laboratory sample is collected at day 3, but its result becomes available at day 7. Can it inform an imputation at day 5 when availability time defines the information set?
  3. Values are 4.0 at day 1 and 4.6 at day 4. Under a two-point linear trend rule, calculate the estimate at day 6 and state the assumption.
  4. Name one diagnostic for look-ahead and one limitation of past-only trend extrapolation.

Solutions. (1) Interpolation gives \(50+\frac{6-2}{10-2}(58-50)=50+4=54\) units. It uses the day-10 value, which is later than day 6. (2) No. Its availability time, day 7, is later than the target day 5, so it is ineligible under the stated rule. (3) The rate is \((4.6-4.0)/(4-1)=0.2\) units per day, so the day-6 estimate is \(4.6+0.2(6-4)=5.0\) units. This assumes the recent linear rate remains informative through day 6. (4) For example, verify that every input’s availability time is no later than its target time. Trend extrapolation can be inaccurate if the trend changes or measurement noise makes the estimated slope unreliable.

Clinical Biostats