Tutorials › Competing Risks and Multi-State Models › External Time-Varying Covariates in Transition Regression

Regression for Multi-State Data · Tutorial 360 of 699

External Time-Varying Covariates in Transition Regression

You will learn to align external covariate histories with transition event times and use those values correctly in transition-specific Cox partial likelihoods.

Advanced 12 min read

What You'll Learn

  • Define an external time-varying covariate for multi-state transition regression.
  • Specify the covariate value used immediately before each transition event time.
  • Construct transition-specific Cox partial-likelihood contributions from time-updated values.
  • Interpret a transition-specific hazard ratio for a change in an external covariate.
  • Recognize when common calendar-time covariates cancel from the partial likelihood.
  • Diagnose timing, measurement, and risk-set problems in time-varying covariate data.

Why Covariate Timing Matters

A covariate need not be fixed at baseline. A participant's work schedule, a region's air-quality measure, or a treatment policy assigned independently of a participant's disease history may change over follow-up. In transition regression, the relevant question is not merely what the covariate value is, but which value was available just before the transition event. Using a value recorded after the event can reverse the temporal order and produce an invalid risk-set comparison.

This tutorial focuses on externally measured time-varying covariates in transition-specific Cox models. The earlier material on transition-specific Cox regression and risk sets supplies the basic regression framework: each transition has its own risk set, baseline hazard, and potentially its own covariate effect. Here the additional task is aligning each member of that risk set with the correct covariate value at each event time.

Definition: An external time-varying covariate is a covariate process whose values are defined independently of the individual's transition or event process, including values that would be defined after that individual experiences an event. Write the covariate vector for individual \(i\) as \(Z_i(t)\). For a transition event at time \(t\), a Cox model uses the covariate information available immediately before \(t\), written \(Z_i(t-)\). Externality does not mean that the covariate must be statistically independent of the event process, nor does it by itself establish a causal effect.

For a transition from state \(r\) to state \(s\), let \(Y_i^{rs}(t)=1\) when individual \(i\) is in state \(r\), under observation, and eligible to make that transition just before \(t\); otherwise \(Y_i^{rs}(t)=0\). A transition-specific proportional-hazards model is

$$ \lambda_i^{rs}(t\mid Z_i(t-)) = \lambda_{0,rs}(t) \exp\!\left\{\beta_{rs}^{\mathsf T}Z_i(t-)\right\}, \qquad \text{while }Y_i^{rs}(t)=1. $$

Here \(\lambda_{0,rs}(t)\) is the transition-specific baseline hazard and \(\beta_{rs}\) is the vector of coefficients for that transition. The model says that, among individuals eligible for the same transition at time \(t\), covariate contrasts multiply the instantaneous transition hazard by an exponential factor. The coefficient vector is constant over time in this model, even though \(Z_i(t)\) can change.

Assumptions and the Event-Time Value

Correct use of the model requires more than attaching a covariate column to a data set. The transition definition and the state-occupancy history must determine who is at risk; the covariate value must be known just before the event time; and the conditional transition hazards must have the proportional-hazards form above. For a simple partial-likelihood argument, assume one event at each distinct event time. If tied events occur, a suitable tied-event likelihood approximation or exact method is needed.

  • Temporal ordering: covariate information used at \(t\) must be available before the event at \(t\). This is the predictable, no-look-ahead convention.
  • Correct risk set: a subject contributes to transition \(r\to s\)'s denominator only while eligible for that transition, not merely because they remain under observation.
  • Conditional proportional hazards: the covariate multiplies the transition hazard through \(\exp\{\beta_{rs}^{\mathsf T}Z_i(t-)\}\), with a coefficient that does not change over time.
  • Noninformative observation, conditional on the modeled information: censoring or loss to follow-up must not selectively remove people with different unaccounted-for transition risks. Appropriate entry and censoring rules must be reflected in the risk sets.
  • Information in the risk sets: covariate values must vary among individuals at risk in a way that allows the coefficient to be distinguished from the baseline hazard.

Suppose a measurement is taken at time 2 and the next measurement is taken at time 5. If the scientific protocol supports treating the measured value as applying from time 2 up to (but not including) time 5, then an event at time 4 uses the time-2 value. This is a data convention grounded in the measurement process, not a universal license to carry every last observation forward. If a measurement is taken at exactly the event time, the value is usable only if it was recorded before the event and its timing is documented. A post-event measurement cannot be substituted.

Worked Example: Selecting the Value at a Transition Event

Consider a hypothetical transition \(A\to B\). Three individuals are in state \(A\) and at risk at time 4 days. Their externally measured exposure is recorded at days 0 and 3, and the protocol specifies that each value applies until the next scheduled measurement. Individual 2 makes the transition at day 4.

IndividualExposure at day 0Exposure at day 3Value at day 4 just before event
1000
2011
3222

At day 4, the transition-specific risk set is \(\{1,2,3\}\), and the event individual's value is \(Z_2(4-)=1\). Suppose the coefficient for this exposure is fixed at \(\beta_{AB}=\log(1.5)\). The event-time partial-likelihood contribution is

$$ \frac{\exp\{\beta_{AB} Z_2(4-)\}} {\sum_{j\in\{1,2,3\}}\exp\{\beta_{AB} Z_j(4-)\}} = \frac{1.5^1}{1.5^0+1.5^1+1.5^2} = \frac{1.5}{1+1.5+2.25} = 0.3158. $$

The value 0.3158 is the model-based conditional probability contribution for individual 2 being the one who makes this transition at that event time, given one transition event in this risk set. The day-0 exposure for individual 2 is not used, because it was superseded before day 4. No day-4 post-event measurement is used.

Partial Likelihood With Time-Updated Covariates

Let \(t_k\) be a distinct event time for transition \(r\to s\), and let \(i_k\) be the individual who makes that transition. Define \(\mathcal R_{rs}(t_k)\) as the set of individuals eligible for transition \(r\to s\) immediately before \(t_k\). Conditional on one transition event in that risk set, the probability that individual \(i_k\) is the one who transitions is

$$ \frac{\lambda_{0,rs}(t_k)\exp\{\beta_{rs}^{\mathsf T}Z_{i_k}(t_k-)\}} {\displaystyle\sum_{j\in\mathcal R_{rs}(t_k)} \lambda_{0,rs}(t_k)\exp\{\beta_{rs}^{\mathsf T}Z_j(t_k-)\}}. $$

The common baseline hazard cancels. Multiplying these conditional probabilities over event times gives the transition-specific partial likelihood:

$$ L_{rs}(\beta_{rs}) = \prod_{k:\,r\to s\ \mathrm{event}} \frac{\exp\{\beta_{rs}^{\mathsf T}Z_{i_k}(t_k-)\}} {\displaystyle\sum_{j\in\mathcal R_{rs}(t_k)} \exp\{\beta_{rs}^{\mathsf T}Z_j(t_k-)\}}. $$

This derivation explains why the event-time value is used for every person in the risk set, not just the person who transitions. The comparison is between the transitioning individual's covariate vector and the contemporaneous vectors of all eligible non-transitioning individuals. A subject can contribute a different covariate value at each event time while remaining at risk.

For several modeled transitions, construct the appropriate risk set and partial likelihood contribution for each transition. A person who has moved out of state \(r\) no longer belongs to a risk set for transitions out of \(r\), though they may later enter a risk set for a different transition from their new state. The risk-set definition follows the state process; time-updating a covariate does not alter it.

Worked Example: Interpreting a Transition-Specific Effect

In a hypothetical study, a one-unit increase in an externally measured air-quality index is associated with an estimated coefficient \(\hat\beta_{AB}=0.1823\) for transition \(A\to B\). Assume the fitted model is correctly specified and the index is measured on the same scale for all individuals.

For two individuals in the \(A\to B\) risk set at the same time, whose index values differ by one unit, the estimated hazard ratio is

$$ \widehat{\mathrm{HR}}_{AB} = \exp\{\hat\beta_{AB}(1)\} = \exp(0.1823) = 1.200. $$

Thus, conditional on the model and the other included covariates, the individual with an index one unit higher has an estimated instantaneous hazard of transition \(A\to B\) that is 1.20 times as large at that time. This is a 20% higher estimated transition hazard, not a 20-percentage-point increase in the probability of entering state \(B\). It is specific to transition \(A\to B\), and it is an association unless additional causal assumptions and design support a causal interpretation.

If the two individuals' index values differ by 0.5 units instead, the corresponding estimated hazard ratio is

$$ \exp\{0.1823(0.5)\} = \exp(0.09115) \approx 1.095. $$

The interpretation compares their covariate values immediately before the same time and while both are eligible for \(A\to B\). A hazard ratio does not compare individuals in different origin states or give an unconditional probability of transition.

When the Covariate Cannot Be Estimated

Time-varying does not automatically mean estimable. If an external covariate has exactly the same value for every person in a transition-specific risk set at every event time, its exponential term cancels from each partial-likelihood contribution. The data then contain no partial-likelihood information about its coefficient. This can happen with a calendar-time exposure shared by everyone in the study: at any one event time, all members of the risk set face the same exposure value.

Worked Example: A Shared Calendar-Time Covariate Cancels

Suppose a hypothetical transition risk set contains three people at an event time \(t=6\). A region-wide policy indicator is \(Z(t)=1\) for everyone at that time. If the second person transitions, the event-time partial-likelihood contribution for a coefficient \(\beta\) on this indicator is

$$ \frac{\exp(\beta)} {\exp(\beta)+\exp(\beta)+\exp(\beta)} = \frac{1}{3}. $$

The contribution is \(1/3\) for every value of \(\beta\); its derivative with respect to \(\beta\) is zero. This event time therefore provides no information about \(\beta\). If the shared indicator changes over calendar time but is still identical for everyone in each risk set, its value at each event time still factors out in exactly the same way. An alternative design with contemporaneous between-person exposure variation, or a modeling strategy supported by additional assumptions and information, is needed to separate its effect from the baseline hazard.

Diagnostics, Alternatives, and Limitations

Before interpreting a fitted model, inspect how the time-dependent covariate history was constructed. A useful audit lists, for each transition event time, the event individual's value, the values for the other members of that transition risk set, and the measurement times that justify each value. This often catches data errors that ordinary model summaries will not reveal.

  • Look-ahead or stale values: compare event times with measurement timestamps. A value recorded after an event is not a valid predictor at that event. A value carried forward across a long gap may cease to represent the intended exposure.
  • Incorrect transition risk sets: verify that all denominator members are in the relevant origin state and under observation immediately before the event. A person in another state cannot be included just because their covariate is observed.
  • Little or no within-risk-set variation: tabulate covariate values among people at risk at event times. A common calendar-time covariate can be inseparable from the baseline hazard; sparse variation can also yield unstable estimates or very wide uncertainty intervals.
  • Inconsistent measurement schedules: if measurements are more likely at times related to a person's worsening condition, observed covariate histories may not represent the intended external process. The measurement and observation mechanisms need scrutiny.
  • Wrong functional form or transition effect: assess whether the selected covariate scale and transition-specific coefficient are scientifically plausible. A time-updated covariate does not by itself allow its coefficient to vary over time or guarantee that its relationship is linear on the log-hazard scale.

A baseline-only Cox model uses a fixed covariate value and is appropriate only when the scientific target is baseline adjustment or the covariate is genuinely fixed for the analysis. Updating the covariate can better represent changing exposure, but requires correctly timed measurements. Stratifying by transition permits different baseline hazards but does not solve incorrect covariate timing. In practice, start-stop records are a common data representation: each row covers an interval during which state, observation status, and covariate values are constant, with rows split at covariate updates and transition events. The data format is only a representation; the event-time risk sets and the \(t-\) convention still determine the model.

An external covariate is not necessarily randomized, accurately measured, or causally interpretable. Nor does the model account automatically for uncertainty in a noisy covariate, informative missingness, or dependence among repeated transition contributions from the same person. When individuals contribute multiple events or transitions, variance estimation should reflect the sampling structure when needed. These issues affect inference, but they do not change the basic rule: compare the event individual's pre-event covariates with the pre-event covariates of the eligible risk set.

Key takeaway: For every transition event at time \(t\), use \(Z_i(t-)\) for the event individual and \(Z_j(t-)\) for every member \(j\) of that transition's risk set. The covariate history must be externally defined, available before the event, and supported by enough risk-set variation to identify its effect.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. An external covariate is measured at days 1 and 4. Under a justified carry-forward convention, which value applies to an event at day 3?
  2. At an event time, four people are at risk with covariate values \(0,1,1,2\). The event is for a person with value 1 and \(\beta=\log(2)\). What is the partial-likelihood contribution?
  3. Why can a calendar-time covariate shared by everyone in each risk set be unidentifiable in a Cox partial likelihood?
  4. State the transition-specific hazard ratio for a two-unit increase when \(\beta_{rs}=0.15\). Interpret it.

Solutions. (1) Use the day-1 value, because day 4 is after the event and the carry-forward convention applies only until the next measurement. (2) The numerator is \(2^1=2\); the denominator is \(2^0+2^1+2^1+2^2=1+2+2+4=9\), so the contribution is \(2/9=0.2222\). (3) Its exponential term is common to numerator and denominator and cancels at each event time, leaving no partial-likelihood information about its coefficient. (4) The hazard ratio is \(\exp(0.15\times2)=\exp(0.30)=1.350\). Conditional on the fitted transition model, the estimated instantaneous hazard for that transition is 1.350 times as large for a two-unit higher covariate value, holding other modeled covariates fixed.

Clinical Biostats