Tutorials › Competing Risks and Multi-State Models › Time-Dependent Covariates in Cause-Specific Cox Models

Regression: Cause-Specific Cox and Fine-Gray · Tutorial 153 of 699

Time-Dependent Covariates in Cause-Specific Cox Models

Learn to construct start-stop data and use only the covariate history available immediately before each event when fitting a cause-specific Cox model.

Advanced 11 min read

What You'll Learn

  • Translate covariate updates, events, competing events, and censoring into start-stop records.
  • Define cause-specific Cox risk sets using covariate values available just before each event time.
  • Derive the partial-likelihood contribution for a cause-specific event with updated covariates.
  • Identify look-ahead bias, interval-boundary errors, and problems caused by informative covariate measurement.
  • Distinguish changing covariate values from time-varying regression effects and from Fine-Gray risk sets.

Why covariate timing matters

A baseline covariate records a subject’s characteristics once, before follow-up. In many studies, important characteristics change: a laboratory value is measured repeatedly, a treatment begins or stops, or a patient’s clinical status is updated. A cause-specific Cox model can use such information, but each event-time comparison must use the covariate information that was available immediately before that event. Using a later measurement to explain an earlier event introduces future information into the risk set and can distort the estimated association.

This tutorial concerns changing covariate values, not a coefficient whose effect changes with time. In the model below, the covariate vector \(X_i(t)\) may change during follow-up while its coefficient vector \(\beta_k\) remains fixed. The earlier material on time-varying effects in cause-specific Cox regression addresses the distinct question of whether the coefficient itself varies with time.

Definition: Let \(T_i\) be the time to the first event or censoring for subject \(i\), and let \(J_i\) denote the event type when an event occurs. For a cause of interest \(k\), the cause-specific hazard is the instantaneous rate of an event of cause \(k\), conditional on being event-free just before time \(t\) and on the covariate history available by then. A time-dependent covariate \(X_i(t)\) is a covariate whose value may change over follow-up. It must be predictable: its value at time \(t\) is determined by information available before the event at \(t\), not by later information.

The cause-specific Cox model and its risk sets

For cause \(k\), the cause-specific Cox model with time-dependent covariates is

$$ \lambda_{ik}(t \mid \mathcal{H}_i(t^-)) = \lambda_{0k}(t)\exp\{\beta_k^\mathsf{T}X_i(t)\}, $$

where \(\mathcal{H}_i(t^-)\) is subject \(i\)’s observed history just before \(t\), \(\lambda_{0k}(t)\) is an unspecified baseline cause-specific hazard, and \(\beta_k\) is a constant coefficient vector. The model assumes the covariate’s multiplicative effect on the cause-specific hazard is constant over time, conditional on the covariate value and the model’s other terms. It does not require the covariate itself to remain constant.

For a subject who enters at time \(L_i\), define the risk indicator as \(Y_i(t)=1\) when \(L_i<t\leq T_i\), and \(0\) otherwise. At a cause-\(k\) event time \(t\), the risk set consists of subjects who have entered and remain event-free immediately before \(t\). A subject whose competing event occurred earlier is no longer in this risk set. For each subject still at risk, the model uses \(X_i(t)\) as known just before the event time.

A standard data layout expresses each subject’s follow-up as consecutive start-stop intervals, commonly written \((\text{start},\text{stop}]\). Split a subject’s record whenever a covariate value changes, and end the final interval at the event or censoring time. Each interval carries the covariate value applicable throughout it. The event indicator is marked only on the final interval, with the event’s cause recorded separately or coded so that only events of cause \(k\) count as failures in the cause-\(k\) fit.

Key rule: At an event time \(t\), use the record covering \(t\) and the covariate value known immediately before \(t\). A value first measured or assigned after \(t\) cannot be used for that event’s risk-set comparison.

Worked Example: Building records and identifying the risk set

Worked Example: Building records and identifying the risk set

Suppose three hypothetical subjects are followed for a cause-1 event. Subject A has \(X=0\) through time 3, then \(X=1\) through a cause-1 event at time 6. Subject B has \(X=0\) through time 5, then \(X=0\) until a competing event at time 8. Subject C has \(X=2\) from time 0 through censoring at time 7. Their records are:

SubjectStartStop\(X\)End of interval
A030Covariate update
A361Cause 1
B050Covariate update
B580Competing event
C072Censoring

At time 6, A, B, and C are all event-free and under observation immediately before the cause-1 event. Their applicable covariate values are \(1,0,\) and \(2\). With one cause-1 event at time 6 and no tied cause-1 failures, its partial-likelihood contribution is

$$ \frac{\exp(\beta_k \cdot 1)} {\exp(\beta_k \cdot 1)+\exp(\beta_k \cdot 0)+\exp(\beta_k \cdot 2)}. $$

At \(\beta_k=0\), this contribution is \(1/(1+1+1)=1/3\). B’s later competing event does not remove B from the risk set at time 6; it removes B only after time 8. C contributes at time 6 because censoring occurs at time 7. The interval rows encode these facts without treating the rows as independent subjects.

Partial likelihood: why the pre-event values enter

Assume distinct cause-\(k\) event times for this derivation. At a cause-\(k\) event time \(t\), the model’s instantaneous event rate for subject \(i\) in the risk set is proportional to \(\lambda_{0k}(t)\exp\{\beta_k^\mathsf{T}X_i(t)\}\). Conditional on one cause-\(k\) event occurring among that risk set at \(t\), the probability that subject \(i\) is the one who experiences it is therefore proportional to that rate. Normalizing across the risk set cancels the common baseline hazard:

$$ P(i\text{ is the cause-}k\text{ case at }t \mid \text{one cause-}k\text{ event in }R_k(t)) = \frac{\exp\{\beta_k^\mathsf{T}X_i(t)\}} {\sum_{j\in R_k(t)}\exp\{\beta_k^\mathsf{T}X_j(t)\}}. $$

Here \(R_k(t)\) is the set of subjects at risk immediately before \(t\). Multiplying these conditional contributions over the observed cause-\(k\) event times gives the partial likelihood. In particular, every denominator uses the time-specific covariates of the people in the risk set at that event time, not a baseline value carried forward regardless of updates or a value recorded later.

$$ L_k(\beta_k) = \prod_{i:\,J_i=k} \frac{\exp\{\beta_k^\mathsf{T}X_i(T_i)\}} {\sum_{j\in R_k(T_i)}\exp\{\beta_k^\mathsf{T}X_j(T_i)\}}. $$

The score contribution from an event is the event subject’s covariate vector minus the risk-set weighted average covariate vector. For a single scalar covariate, this is \(X_i(t)-\bar X_k(t;\beta_k)\), where the weighted average gives more weight to subjects with larger \(\exp\{\beta_k X_j(t)\}\). This shows directly why incorrect timing matters: assigning a subject a different \(X_j(t)\) changes the event’s comparison and hence the coefficient estimate.

This simple expression assumes no tied cause-\(k\) event times. When ties occur, use an appropriate tie method, such as the Breslow or Efron method, as in the earlier material on handling tied failures in cause-specific Cox models. Start-stop records do not remove the need to handle ties correctly.

Worked Example: An update after the event is not eligible

Worked Example: An update after the event is not eligible

Suppose a hypothetical subject experiences a cause-1 event at time 6. The subject’s covariate is \(X=0\) until it is measured as \(X=1\) at time 6.4. A second subject is still at risk at time 6 with \(X=1\). Assume \(\beta_k=\log(2)\), so the relative hazard associated with a one-unit difference is \(\exp\{\log(2)\}=2\).

The event subject’s value at time 6 is \(0\), not \(1\). The correct partial-likelihood contribution is therefore

$$ \frac{\exp\{\log(2)\cdot 0\}} {\exp\{\log(2)\cdot 0\}+\exp\{\log(2)\cdot 1\}} = \frac{1}{1+2} = \frac{1}{3}. $$

If the value measured at time 6.4 were incorrectly assigned to the event at time 6, the contribution would instead be \(2/(2+2)=1/2\). That is not a harmless formatting choice: it changes the comparison by using future information. The appropriate records are \((0,6]\) with \(X=0\) and the cause-1 event, followed, only if the subject had remained event-free, by an interval beginning after time 6.4 with \(X=1\). The later interval cannot affect the likelihood contribution at time 6.

Worked Example: Interpreting a fitted coefficient

Worked Example: Interpreting a fitted coefficient

In a hypothetical cause-specific Cox analysis, a laboratory marker is updated during follow-up and entered in units of 10 points. Suppose the fitted coefficient is \(\hat\beta_k=0.5878\), with standard error \(SE=0.2000\). Assuming the records correctly use the value available just before each event, the estimated cause-specific hazard ratio for a 10-point higher marker value is

$$ \exp(\hat\beta_k)=\exp(0.5878)=1.800. $$

A Wald 95% confidence interval on the coefficient scale is \(0.5878\pm1.96(0.2000)=(0.1958,0.9798)\). Exponentiating its endpoints gives a hazard-ratio interval of approximately \((1.216,2.664)\). The Wald statistic is \(z=0.5878/0.2000=2.939\), corresponding to a two-sided \(p\)-value of about 0.0033.

Under the fitted model, among subjects still event-free at a given time and with the other modeled covariates held fixed, a 10-point higher current marker value is associated with an estimated 1.80 times the cause-\(k\) hazard at that time. The interval is a confidence interval for this model-based hazard ratio, not a range containing the parameter with 95% probability. This is an association in a cause-specific hazard model; it does not by itself establish a causal effect.

Assumptions, diagnostics, and common failures

Start-stop coding is a data representation, not a remedy for violations of the model. A meaningful fit requires accurate event times and causes, valid covariate timing, and a correctly specified relationship between the covariates and the cause-specific hazard. The usual cause-specific Cox assumptions include a proportional effect for each included covariate as parameterized, and censoring that is conditionally independent of the event process given the modeled history. The data must also provide adequate information and variation in the risk sets to estimate the coefficients.

The covariate process must be observed in a way that supports the intended analysis. In particular, a value should not be assigned retrospectively using information learned after an event. If updates occur only when a patient’s condition worsens, the observation process may itself be informative; carrying the last observed value forward does not automatically resolve that problem. A time-dependent covariate can also be affected by a subject’s evolving health. The fitted coefficient remains a conditional association unless additional causal assumptions and methods justify a causal interpretation.

Useful checks include verifying that each person’s intervals are ordered, have no unintended gaps or overlaps, and end at the correct event or censoring time. Confirm that covariate changes begin only when recorded, that the event indicator appears only on the final interval, and that competing events remove a subject from subsequent cause-specific risk sets. At each event time, manually inspect a few risk sets and confirm the covariate value used for every included person. Boundary rules matter: with \((\text{start},\text{stop}]\) intervals, the interval ending at an event time contains the pre-event value. If an update and event share a recorded time, the analysis needs a defensible ordering rule based on measurement timing; absent evidence that the update preceded the event, do not silently use the updated value.

Also examine whether the assumed functional form and proportional effect are plausible, and whether there are enough cause-\(k\) events across the relevant covariate histories. Sparse updates, long periods of carrying forward a value, extreme values, or abrupt changes in estimates under reasonable coding alternatives can signal instability or measurement problems. A large number of interval rows does not create more independent subjects or more event information.

How this approach differs from alternatives

ApproachWhat changesMain distinction
Baseline-covariate cause-specific Cox modelUses a fixed covariate value for each subjectCannot represent within-person updates unless they are deliberately summarized at baseline.
Cause-specific Cox model with time-dependent covariatesUpdates \(X_i(t)\) as information becomes availableAt each cause-\(k\) event, compares the event subject with the then-current values among subjects still event-free.
Cause-specific Cox model with time-varying effectsAllows a coefficient or covariate effect to vary with timeDifferent from updating the observed covariate while keeping its coefficient fixed.
Fine-Gray modelUses a subdistribution risk set for cumulative incidence regressionIts treatment of people with competing events differs from the cause-specific risk set; do not transfer cause-specific start-stop risk-set rules without accounting for the Fine-Gray formulation.

A baseline value may be simpler and more robust when updates are sparse or poorly timed, but it answers a different question and can discard relevant history. Conversely, updating covariates is not automatically preferable: it requires trustworthy timing and a clear interpretation of the conditional hazard being modeled. The introductory material on competing risks provides the broader distinction between cause-specific hazards and cumulative incidence; here the key operational point is that a prior competing event removes a subject from the cause-specific risk set.

Common mistake: treating rows as independent or using future values

  • Wrong reasoning: “Each start-stop row is one observation, so all rows can be treated as separate subjects.” Correction: Rows represent intervals for the same person. The risk set at each event time is formed from people, using the one interval applicable to each person at that time.
  • Wrong reasoning: “The most recent value in the completed data file is the best value to use for every event.” Correction: Use only the value known immediately before that event. A later measurement cannot be carried backward.
  • Wrong reasoning: “A competing event is just censoring at the time it occurs, so the subject can remain in all later risk sets.” Correction: In the cause-specific analysis, the subject leaves the event-free risk set at the competing event and contributes no later risk time.

These errors can produce a numerically converged fit that is nevertheless based on the wrong comparisons. Inspecting the records and selected event-time risk sets is therefore part of the statistical analysis, not merely a software check.

Check Your Understanding

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

  1. A subject’s covariate changes at time 4 and the subject has a cause-\(k\) event at time 7. Which value enters the event’s numerator if the value remains unchanged from time 4 to 7?
  2. A person experiences a competing event at time 5. Should that person be included in the cause-\(k\) risk set at time 6?
  3. At a cause-\(k\) event time, three people have covariate values \(0,1,2\), and the event subject has value \(1\). Write the partial-likelihood contribution for this event in a scalar model.
  4. Explain why updating a covariate value to one measured after the event can bias the partial-likelihood comparison.
  5. What is the difference between a time-dependent covariate and a time-varying coefficient?

Solutions. (1) Use the value measured at time 4, because it is available immediately before time 7. (2) No. The competing event removes the person from the event-free risk set after time 5. (3) The contribution is \(\exp(\beta_k)/[1+\exp(\beta_k)+\exp(2\beta_k)]\). (4) It uses future information to represent the subject’s covariate history at the earlier event, changing the event subject’s relative weight and the risk-set comparison. (5) A time-dependent covariate changes its observed value over follow-up; a time-varying coefficient changes the modeled effect of a covariate over time. A model can have either feature or both.

Clinical Biostats