Why Measurement Windows Change the Question
An omics assay is a measurement taken at a particular time; a time-updated Cox model needs a covariate value available throughout each subject's risk time. Turning intermittent assays into a time-varying predictor therefore requires a rule for which part of the observed history represents the exposure at each time. That rule is not just a data-processing detail. It defines the exposure history whose association with the hazard is being estimated.
A recent assay may be the most relevant measure if the molecular state changes rapidly. A moving average may better represent sustained activity, while a lag may be appropriate when a molecular change is expected to precede a clinical event by a delay. These choices can produce different estimates even when they use the same underlying assay records.
Three Ways to Define a Time-Updated Covariate
For assays collected at times \(s_{i1},s_{i2},\ldots\), the last-observation value is
It is often implemented by carrying the most recent value forward until another assay is available. The strict inequality makes the timing convention explicit: a result obtained at the event time should not predict that event unless it was available before the event. A moving average over a trailing window of width \(w\) can be defined as a time-weighted average,
This integral requires a defined history between assays, such as a prespecified piecewise-constant interpolation. It is different from simply averaging the assay records in the interval: an unweighted average gives each assay equal weight even when the gaps between assays differ. A lagged covariate is \(X_i^{\mathrm{lag}}(t;\ell)=X_i(t-\ell)\) when the value at \(t-\ell\) is observed. With intermittent assays, an analysis must specify how it obtains that historical value, for example by using the latest assay available at or before \(t-\ell\). Each definition must use only information available before the event time.
Model and Interpretation
For any chosen window rule \(W\), a time-updated Cox model can be written as
Here \(\lambda_i(t\mid \mathcal{F}_{i,t-})\) is subject \(i\)'s hazard at time \(t\), conditional on the observed history available just before \(t\); \(\lambda_0(t)\) is the unspecified baseline hazard; and \(X_i^W(t)\) is the covariate defined by the selected window. The model assumes that the log hazard is linear in this covariate and that its coefficient \(\beta\) is constant over time: conditional on the model covariates, a one-unit difference in \(X_i^W(t)\) corresponds to a hazard ratio of \(\exp(\beta)\). It also requires appropriate handling of censoring and correctly ordered covariate histories. A causal interpretation needs additional assumptions and a design that supports it; the model alone establishes an association, not a causal effect.
The window changes the meaning of \(\beta\). With the last observation, it describes the association with the most recently measured level as carried forward. With a moving average, it describes the association with a sustained or recent average over the specified duration. With a lag, it describes the association with an earlier molecular value at the chosen delay. A one-unit contrast in these predictors is not necessarily the same biological contrast.
Worked Example: Using the Most Recent Available Assay
Hypothetical data. A subject has assays at months 0, 2, and 5, with values 3.0, 4.0, and 6.0 units. The subject remains at risk at month 4. Suppose a fitted Cox model uses the last-observation covariate and estimates \(\beta=0.30\) per omics unit.
At month 4, the most recent assay before that time is the month-2 assay, so \(X_i^{\mathrm{last}}(4)=4.0\) units. The month-5 result cannot be used at month 4 because it was not yet observed. For a one-unit difference in the carried-forward assay value, the hazard ratio is
Thus, under the fitted model, a one-unit higher last-observed value is associated with a 1.350-fold hazard at the same time, conditional on the model covariates. This is not a claim that the subject's unmeasured molecular level stayed exactly at 4.0 units between months 2 and 5. It is the interpretation of the chosen observed-data rule.
Why These Rules Estimate Different Associations
The Cox partial likelihood makes the role of the predictor explicit. At an event time \(t_j\), the contribution for the subject \(i_j\) who experiences the event is proportional to that subject's relative hazard among the subjects still at risk:
Here \(R(t_j)\) is the risk set just before \(t_j\). Replacing a last observation with a moving average or a lag changes the covariate values inside these comparisons, and therefore changes the partial likelihood and its fitted coefficient. The estimate is tied to the exposure-history summary used in the model; it is not a window-free property of the assay.
For instance, if risk is related to a brief rise immediately before an event, a long moving average can dilute that rise. If risk is more closely associated with accumulated molecular activity, a single latest value can be a noisy representation of the relevant history. A lag shifts the association to an earlier time, but a poorly chosen lag may miss the relevant period altogether.
The moving-average formula also shows why gaps matter. If an assay value is treated as constant between measurements, each value contributes in proportion to the length of time it covers in the window. That calculation is transparent, but the interpolation is an analysis convention, not proof that the underlying biology was constant.
Worked Example: Calculating a Time-Weighted Moving Average
Hypothetical data. Within a three-month window before an event time, a piecewise-constant history is 2 units from month 0 to 1, 4 units from month 1 to 2, and 7 units from month 2 to 3. The chosen trailing-window covariate is the time-weighted average, and a fitted model has \(\beta=0.20\) per average omics unit.
The three values each cover one month, so the window average is
A one-unit difference in this three-month average has an estimated hazard ratio of \(\exp(0.20)=1.221\). Comparing histories that differ by 2 average units gives
The latter interpretation concerns a two-unit difference in the three-month average, not a two-unit difference in the latest assay alone. If the intervals had different durations, the calculation would weight each value by its duration rather than taking the simple mean of the three records.
Lagging for Biological Latency
A lag is useful when the scientific hypothesis specifies that a molecular state precedes, rather than coincides with, a change in hazard. The lag length should be chosen in advance when possible and justified using biological knowledge or a clearly specified analysis plan. Searching many lags and reporting only the strongest association can exaggerate evidence and make the selected estimate difficult to interpret.
Worked Example: Interpreting a Two-Month Lag
Hypothetical data. At month 8, a subject's current assay is 6.0 units, and the assay at month 6 was 4.8 units. A model uses the assay two months earlier, with \(\beta=0.25\) per lagged omics unit.
The model's covariate at month 8 is the month-6 value, 4.8 units; it is not the current value of 6.0 units. A one-unit contrast in the lagged covariate has hazard ratio
The difference between this subject's current and two-month-prior assay is \(6.0-4.8=1.2\) units. If comparing two otherwise identical histories that differ by 1.2 units in the lagged value, the model-implied hazard ratio is
This coefficient concerns the value two months before the risk time. It does not estimate the association of the month-8 assay with the month-8 hazard, nor does it by itself prove a two-month biological mechanism.
Choosing, Comparing, and Checking Windows
| Window rule | What the predictor represents | Main trade-off |
|---|---|---|
| Last observation | Most recent assay, carried forward until an update | Simple and recency-focused, but can become stale between assays |
| Moving average | Average over a specified recent duration | Summarizes sustained history, but may smooth away short-lived changes and depends on the averaging rule |
| Lagged value | Assay history at a specified earlier time | Represents a hypothesized latency, but results depend on the lag and availability of earlier measurements |
The comparison should be driven by the biological and clinical question, not by which specification produces the smallest p-value. Useful checks include plotting assay times and values against event and censoring times; verifying that each risk-set covariate uses only assays already available; checking how often a carried-forward value is old; and examining whether conclusions change under a small set of scientifically plausible windows. Large changes across windows are evidence that the hazard association depends on how history is summarized, not a reason to select a preferred result after the fact.
Also check the model's proportional-hazards assumption for the chosen covariate. If the association changes over follow-up, a single coefficient may average over different effects. Unequal or symptom-driven assay schedules deserve special attention: people who become unwell may be tested more frequently, and measurement timing can then track evolving health. A standard time-updated Cox model does not automatically remove this concern. Addressing the visit process requires methods beyond simply choosing a window.
Window choice has limits. Last observation does not recover unobserved changes between assays; moving averages depend on window width and the assumed history between observations; and a lag cannot identify latency if the relevant earlier values are unavailable. These rules summarize observed data. They do not solve measurement error, establish causal effects, or substitute for a model of the assay process.
Common Mistake
Check Your Understanding
Try each question, then compare your reasoning with the solutions.
- An event occurs at month 7. The last assays were at months 3 and 8. Which assay can enter a last-observation covariate at month 7, and why?
- In a four-month trailing window, values of 2 units cover three months and 5 units cover one month. Calculate the time-weighted average.
- A model uses a three-month lag. State what a one-unit hazard ratio contrast refers to.
- Why can a moving average and a last-observation covariate produce different Cox coefficients using the same assay records?
- Give one diagnostic for a stale carried-forward value and one concern if assay frequency increases as patients become unwell.
Solutions. (1) Use the month-3 assay; the month-8 assay occurs after month 7 and would use future information. (2) The average is \(\{(2)(3)+(5)(1)\}/4=11/4=2.750\) units. (3) It refers to a one-unit difference in the omics value three months before the risk time, with other model covariates held fixed. (4) The two rules create different covariate values in the Cox risk-set comparisons: one uses the latest value, while the other summarizes a duration of history. They therefore estimate associations with different exposure summaries. (5) Plot or tabulate the time since each subject's last assay to identify long carry-forward periods. If testing becomes more frequent with worsening health, assay timing may be informative and the ordinary time-updated model does not automatically account for that process.