Tutorials › Competing Risks and Multi-State Models › Predictions Under Time-Varying Covariate Paths

Absolute Risk Prediction · Tutorial 92 of 699

Predictions Under Time-Varying Covariate Paths

Calculate path-specific competing-risk probabilities by updating cause-specific hazards over time and accounting for the event-free probability carried between covariate segments.

Advanced 9 min read

What You'll Learn

  • Define a covariate path and distinguish path-specific risk from risk at a fixed covariate profile.
  • Update cause-specific hazards when covariates change during follow-up.
  • Calculate segment contributions to cumulative incidence and event-free probability.
  • Handle segments where both cause-specific hazards are zero.
  • Check whether predicted risks are coherent and whether the specified path is suitable for prediction.

Why the Covariate Path Matters

A prediction based on a fixed covariate profile assumes that the profile applies throughout follow-up. Some questions instead specify a path: for example, a person has one treatment status during the first part of follow-up and another status later. Because the cause-specific hazards can change when covariates change, the predicted risk must update over time. The event-free probability at each change point must also be carried forward; each later segment acts on the people still free of every event.

The result is a path-specific prediction: the predicted probability of a particular cause of failure by a chosen horizon, conditional on the specified covariate path and the fitted hazard models. It is not automatically a causal effect of following that path. Its interpretation depends on the model and on whether the future path is known or is being imposed as a prediction scenario.

Definition: A covariate path \(x(t)\) specifies the covariate values used to predict a subject's event hazards at each time \(t\) from the prediction origin through the horizon. Given cause-specific hazards \(\lambda_1(t\mid x(t))\) and \(\lambda_2(t\mid x(t))\), the path-specific cumulative incidence for cause 1 by time \(t\) is the probability of cause 1 occurring by \(t\), before cause 2, under those hazards and that path.

Hazards and Risk Along a Path

For two competing causes, let \(\lambda_k(t\mid x(t))\) be the instantaneous cause-specific hazard for cause \(k\), for \(k=1,2\), among subjects who are event-free just before time \(t\). The total hazard is \(\lambda_+(t\mid x(t))=\lambda_1(t\mid x(t))+\lambda_2(t\mid x(t))\). The event-free probability along the path and the cumulative incidence for cause \(k\) are

$$ S(t\mid x(\cdot))= \exp\left\{-\int_0^t \lambda_+(u\mid x(u))\,du\right\}, \qquad F_k(t\mid x(\cdot))= \int_0^t S(u\mid x(\cdot))\lambda_k(u\mid x(u))\,du. $$

Here \(x(\cdot)\) denotes the whole path, not just the covariate value at the horizon. The integrand for cause \(k\) combines the probability of still being event-free just before \(u\) with the cause-\(k\) hazard at \(u\). Thus, changing a covariate can alter both the current cause-specific hazards and the event-free probability available to experience later events.

These expressions assume that the cause-specific hazards are correctly specified for the path, that the path is defined over the prediction interval, and that the hazards are integrable. If the path changes at known times and hazards are constant within each segment, the integrals have a simple recursive form. For a segment of length \(d_j\), let its constant hazards be \(\lambda_{1j}\) and \(\lambda_{2j}\), and let \(S_{j-1}\) be the event-free probability at the segment's start. Write \(\lambda_{+j}=\lambda_{1j}+\lambda_{2j}\). If \(\lambda_{+j}>0\), the segment contributes

$$ \Delta F_{kj} = S_{j-1}\frac{\lambda_{kj}}{\lambda_{+j}} \left(1-e^{-\lambda_{+j}d_j}\right), \qquad S_j=S_{j-1}e^{-\lambda_{+j}d_j}. $$

If \(\lambda_{+j}=0\), both cause-specific hazards are zero. The segment contributes zero to each cumulative incidence and leaves event-free probability unchanged: \(\Delta F_{1j}=\Delta F_{2j}=0\) and \(S_j=S_{j-1}\). This separate case matters because the hazard-share expression would otherwise divide by zero.

Why the Segment Formula Works

Within a segment with constant hazards, event-free probability \(v\) units after the segment begins is \(S_{j-1}e^{-\lambda_{+j}v}\). The probability contribution to cause \(k\) is the integral of this event-free probability times its cause-specific hazard. For \(\lambda_{+j}>0\),

$$ \begin{aligned} \Delta F_{kj} &=\int_0^{d_j} S_{j-1}e^{-\lambda_{+j}v}\lambda_{kj}\,dv\\ &=S_{j-1}\lambda_{kj} \frac{1-e^{-\lambda_{+j}d_j}}{\lambda_{+j}}\\ &=S_{j-1}\frac{\lambda_{kj}}{\lambda_{+j}} \left(1-e^{-\lambda_{+j}d_j}\right). \end{aligned} $$

The factor \(1-e^{-\lambda_{+j}d_j}\) is the conditional probability of any event during the segment for someone event-free at its start. The hazard ratio \(\lambda_{kj}/\lambda_{+j}\) allocates that probability to cause \(k\) when the two hazards remain constant over the segment. The allocation is not a fixed share across time if the hazards change within the segment.

Worked Example: Updating Hazards at a Change Point

Suppose a hypothetical model predicts hazards per year for two causes. A specified covariate path gives \((\lambda_1,\lambda_2)=(0.02,0.03)\) during the first half-year, then \((0.06,0.03)\) during the second half-year. Calculate the one-year cause-specific cumulative incidences.

For the first segment, \(S_0=1\), \(\lambda_{+1}=0.05\), and \(d_1=0.5\). Its event probability conditional on being event-free at the start is \(1-e^{-0.05(0.5)}=1-e^{-0.025}=0.0246901\). Therefore,

$$ \Delta F_{11} =1\left(\frac{0.02}{0.05}\right)(0.0246901)=0.0098760, \qquad \Delta F_{21} =1\left(\frac{0.03}{0.05}\right)(0.0246901)=0.0148141. $$

The event-free probability at six months is \(S_1=e^{-0.025}=0.9753099\). In the second segment, \(\lambda_{+2}=0.09\), and its conditional event probability is \(1-e^{-0.09(0.5)}=1-e^{-0.045}=0.0440025\). Updating from \(S_1\) gives

$$ \begin{aligned} \Delta F_{12} &=0.9753099\left(\frac{0.06}{0.09}\right)(0.0440025) =0.0286107,\\ \Delta F_{22} &=0.9753099\left(\frac{0.03}{0.09}\right)(0.0440025) =0.0143054. \end{aligned} $$

Adding each cause's contributions gives \(F_1(1)=0.0098760+0.0286107=0.0384867\), or about 0.03849, and \(F_2(1)=0.0148141+0.0143054=0.0291195\), or about 0.02912. The final event-free probability is \(S_2=e^{-0.025}e^{-0.045}=e^{-0.07}=0.9323938\). As a coherence check, \(F_1(1)+F_2(1)+S_2\) is approximately 1. The predicted one-year probabilities of the two causes are about 3.849% and 2.912%, respectively, under this hypothetical path and model.

Using a Fitted Model to Update Hazards

A path is often translated into hazards using fitted cause-specific models. For example, a proportional-hazards specification for cause \(k\) has the form

$$ \lambda_k(t\mid x(t))=\lambda_{k0}(t)\exp\{\beta_k^\mathsf{T}x(t)\}. $$

Here \(\lambda_{k0}(t)\) is the cause-specific baseline hazard and \(\beta_k\) is the coefficient vector for that cause. At each time, insert the covariate values from the path into the cause-specific model, combine the resulting hazards to obtain \(\lambda_+\), and update survival and cumulative incidence. The two causes may have different coefficients, so a covariate change need not alter their hazards in the same direction or by the same factor.

1
Specify the path and horizon.
Record the covariate values and the times at which they change, from the prediction origin to the chosen horizon.
2
Obtain both cause-specific hazards.
Use the fitted model for each cause with the covariate values applying at that time. Check the time units and ensure the hazards use compatible units.
3
Update event-free probability and incidence.
Integrate within each segment or use the constant-hazard formula, adding each segment's cause-specific contribution to the previous total.
4
Check the result.
Verify that each incidence is nonnegative and that \(F_1+F_2+S=1\) at the horizon, up to rounding.

Worked Example: A Treatment Indicator Changes Under Proportional Hazards

Consider hypothetical constant baseline hazards \(\lambda_{10}=0.02\) and \(\lambda_{20}=0.01\) per year. Let a binary treatment indicator \(x(t)\) be 0 for the first 0.4 years and 1 for the next 0.6 years. Suppose the cause-specific models are \(\lambda_1(t\mid x)=0.02\exp\{(\log 2)x(t)\}\) and \(\lambda_2(t\mid x)=0.01\exp\{-(\log 2)x(t)\}\). Thus, when \(x=1\), the cause 1 hazard doubles to 0.04 per year while the cause 2 hazard halves to 0.005 per year.

In the first segment, the hazards are 0.02 and 0.01, so \(\lambda_+=0.03\). The segment event probability is \(1-e^{-0.03(0.4)}=0.0119283\). Its cause-specific contributions are

$$ \Delta F_{11}=\frac{0.02}{0.03}(0.0119283)=0.0079522, \qquad \Delta F_{21}=\frac{0.01}{0.03}(0.0119283)=0.0039761, \qquad S_1=e^{-0.012}=0.9880717. $$

In the second segment, \(\lambda_+=0.045\) and the conditional event probability is \(1-e^{-0.045(0.6)}=1-e^{-0.027}\), approximately 0.0266390. The hazard shares are \(0.04/0.045=8/9\) for cause 1 and \(0.005/0.045=1/9\) for cause 2. Carrying forward \(S_1\),

$$ \begin{aligned} \Delta F_{12} &=0.9880717\left(\frac{8}{9}\right)(0.0266390) \approx 0.02340,\\ \Delta F_{22} &=0.9880717\left(\frac{1}{9}\right)(0.0266390) \approx 0.002925. \end{aligned} $$

The one-year path-specific predictions are therefore \(F_1\approx0.0079522+0.02340=0.03135\) and \(F_2\approx0.0039761+0.002925=0.006901\). The final event-free probability is \(e^{-0.012}e^{-0.027}=e^{-0.039}\approx0.96175\); the two incidences and event-free probability sum to approximately 1. These are model-based predictions under the stated time-varying treatment path, not evidence that changing treatment would cause those risk differences.

Worked Example: A Segment With Zero Hazards

For a final hypothetical path, suppose the hazards are \((0.04,0.02)\) per year for 0.25 years, then both are zero for 0.25 years, and finally they are \((0.02,0.04)\) per year for 0.5 years. The initial event-free probability is 1.

In the first segment, the total hazard is 0.06. Thus \(S_1=e^{-0.06(0.25)}=e^{-0.015}=0.9851119\). The two contributions are \(F_{11}=(0.04/0.06)(1-e^{-0.015})=0.0099254\) and \(F_{21}=(0.02/0.06)(1-e^{-0.015})=0.0049627\). The middle segment has \(\lambda_+=0\), so both incidence contributions are zero and \(S_2=S_1=0.9851119\).

In the final segment, \(\lambda_+=0.06\), and \(1-e^{-0.06(0.5)}=1-e^{-0.03}=0.0295545\). Therefore, \(\Delta F_{13}=0.9851119(0.02/0.06)(0.0295545)\approx0.009705\), while \(\Delta F_{23}=0.9851119(0.04/0.06)(0.0295545)\approx0.01941\). The total incidences are approximately \(F_1=0.01963\) and \(F_2=0.02437\), with final survival \(e^{-0.045}=0.9559975\). Their sum is approximately 1. The zero-hazard interval adds no risk, but the event-free probability entering the final segment remains the probability carried forward from the first segment.

Diagnostics, Alternatives, and Limitations

The central diagnostic is probability coherence: at any horizon, the two cumulative incidences and event-free probability must be nonnegative and sum to 1, subject only to numerical rounding. A sum above 1 often signals that segment contributions were calculated from the original survival probability rather than the survival carried forward from the preceding segment. A sum below 1 may indicate a missing cause, a time interval omitted from integration, or inconsistent numerical approximations.

Check also that the path is defined at every time and that its change points align with the hazard calculations. When a covariate varies continuously or the baseline hazard varies within a segment, a constant-hazard segment formula is not exact; evaluate the integral using suitable numerical integration or a sufficiently fine time grid. Refining the grid and checking that predictions stabilize is a useful numerical diagnostic. Large changes under modest grid refinement suggest the approximation is too coarse.

This approach extends a fixed-profile prediction by updating the covariate inputs over time. Aalen-Johansen absolute risk prediction uses estimated transition probabilities in a discrete-time or event-time representation; direct integration of cause-specific hazards expresses the same competing-risk accounting in hazard form. Fine-Gray fits instead model a subdistribution hazard, so predictions should be obtained from that model's specified prediction procedure rather than by treating its subdistribution hazard as an ordinary cause-specific hazard and applying the segment formula above.

A path-specific prediction is only as credible as the path and model. A future covariate path may not be known in practice; inserting a path chosen after observing future information can produce a useful hypothetical calculation but not necessarily a prediction available at baseline. If future covariates are stochastic, a prediction for one fixed path is not generally the population-average prediction over possible paths. Also, the calculation describes associations under the fitted models; it does not by itself identify the effect of intervening to set covariates to that path.

Common Mistake

  • Wrong reasoning: calculate the event probability in every segment as if the subject were event-free at that segment's start, then add those probabilities directly. This counts later events among people who would already have failed earlier.
  • Correction: multiply each segment's conditional cause-specific contribution by the event-free probability carried into that segment. Update that probability using the total hazard, including both competing causes.
  • Another boundary error: use \(\lambda_{kj}/\lambda_{+j}\) when \(\lambda_{+j}=0\). In that case both hazards are zero, so assign zero contribution to both causes and leave survival unchanged.
Key takeaway: For a specified time-varying covariate path, recalculate the cause-specific hazards as the path changes, but carry forward event-free probability continuously. Cumulative incidence is the sum of the resulting survival-weighted cause-specific contributions.

Check Your Understanding

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

  1. For a segment with \(\lambda_1=0.03\), \(\lambda_2=0.02\) per year, duration 0.2 years, and event-free probability 0.9 at its start, calculate each cause's contribution and the ending event-free probability.
  2. If both cause-specific hazards are zero throughout a segment, what happens to each cumulative incidence and to event-free probability?
  3. Why is a subject's hazard change at a covariate change point not enough to calculate the later cause-specific incidence?
  4. State one reason a prediction under a specified future covariate path may not be a baseline prediction for an actual subject.

Solutions. (1) The total hazard is 0.05 and the conditional event probability is \(1-e^{-0.05(0.2)}=1-e^{-0.01}=0.0099502\). Thus \(\Delta F_1=0.9(0.03/0.05)(0.0099502)=0.005373\), \(\Delta F_2=0.9(0.02/0.05)(0.0099502)=0.003582\), and \(S_{\mathrm{end}}=0.9e^{-0.01}=0.8910\). (2) Both contributions are zero, and event-free probability is unchanged. (3) Later incidence also depends on the event-free probability entering that time segment, which has been reduced by earlier events from either cause. (4) The future covariate values may not yet be known; a fixed-path calculation is conditional on the specified path and does not average over possible future paths.

Clinical Biostats