Tutorials › Competing Risks and Multi-State Models › Time-Varying Confounding With Competing Events

Causal Contrasts With Competing Events · Tutorial 197 of 699

Time-Varying Confounding With Competing Events

See how treatment-confounder feedback arises in competing-risk settings and how the g-formula and inverse probability weighting estimate risks under sustained treatment strategies.

Advanced 12 min read

What You'll Learn

  • Identify a time-varying confounder affected by prior treatment in a competing-event process
  • Distinguish a sustained treatment-regime risk from a risk conditional on observed treatment and covariate history
  • Derive the two-period competing-risk g-formula from sequential conditional probabilities
  • Calculate cumulative cause-specific risks under two treatment strategies
  • Explain why ordinary adjustment for a post-treatment confounder can change the target contrast
  • Construct inverse probability treatment weights and identify positivity and model-diagnostic concerns

Why Longitudinal Treatment Creates a Special Problem

In a longitudinal study, treatment may be chosen repeatedly as a participant’s health evolves. A health measure recorded after an earlier treatment can both influence the next treatment and predict a later event. If the earlier treatment also affects that health measure, it is a time-varying confounder affected by prior treatment. This treatment-confounder feedback makes ordinary regression adjustment difficult: the measure needs to be accounted for when estimating the effect of later treatment, but adjusting for it in a conventional outcome regression can remove part of the effect of earlier treatment.

Competing events make the target a risk under a strategy, not simply a rate among people who remain event-free. A participant who experiences the competing event can no longer experience the event of interest first. The causal contrast therefore depends on how each treatment strategy changes both the event of interest and the competing event, as well as the evolving covariate history among those still at risk.

Definition: Let \(A_t\) denote treatment at decision time \(t\), and let \(L_t\) denote measured covariate history available before that decision. A time-varying confounder affected by prior treatment is a \(L_t\) that predicts subsequent treatment and the outcome, while its distribution is itself affected by one or more earlier \(A_s\), where \(s<t\). Let \(J\) identify the first event type, with \(J=1\) the event of interest and \(J=2\) a competing event. A treatment regime \(g\) specifies treatment at each decision time for people still eligible to receive it. The causal risk of interest is \(P(T^g\leq \tau,J^g=1)\), the probability of the event of interest by time \(\tau\) under that regime, with the competing event allowed to occur naturally.

The focus here is the total risk contrast between treatment strategies. It is not the risk in a hypothetical world where the competing event is eliminated. Treatment assignment, covariate measurement, and event timing must be ordered clearly: covariates used to choose \(A_t\) are measured before \(A_t\), and once either event occurs, subsequent treatment decisions do not apply.

Assumptions for Causal Risk Estimation

A g-method does not by itself make observational data causal. Identification requires substantive assumptions, stated here for measured treatment and covariate histories:

  • Consistency and well-defined strategies. If a participant follows regime \(g\), their observed event history equals the potential event history under \(g\). Treatment versions grouped under one value must be sufficiently well defined for this equality to be meaningful.
  • Sequential exchangeability. At each decision time, conditional on measured history available before treatment, treatment assignment is independent of the potential future event and covariate histories under the regimes being compared. In practical terms, there are no unmeasured common causes of treatment decisions and subsequent outcomes after conditioning on that history.
  • Positivity. Every treatment required by a regime has positive probability within each history that occurs under the regime. If, for example, nearly all participants with severe symptoms receive treatment, data may not support estimating the outcome they would have had untreated.
  • Correct time ordering and measurement. Relevant confounders are measured before the treatment decisions they confound, and event type and timing are recorded adequately. A covariate measured after an event cannot be used as a pre-event treatment confounder.
  • Appropriate handling of censoring. If loss to follow-up occurs, censoring must be independent of future potential outcomes conditional on the measured history used in the analysis, or be addressed with an appropriate censoring model. The examples below assume complete follow-up.

These assumptions extend the exchangeability, positivity, consistency, and censoring conditions used for causal risk estimation to a sequence of treatment decisions. They are not verified merely because a fitted model converges or produces plausible estimates.

Two-Period Competing-Risk G-Formula

Consider a two-period setting. At baseline, treatment \(A_0\) is assigned. During the first period, either the event of interest or the competing event may occur. Among those event-free at the second decision, \(L_1\) is measured and treatment \(A_1\) is assigned. During the second period, either event may occur. Let \(g=(a_0,a_1)\) be a sustained strategy, assigning \(A_0=a_0\) and, if the participant remains event-free, \(A_1=a_1\).

Write \(S_1^{a_0}=1\) for being event-free after the first period under \(A_0=a_0\). Let \(q_{1,0}(a_0)\) be the probability of the event of interest in period one under \(a_0\), and let \(q_{1,1}(a_1,l)\) be the period-two probability of the event of interest among those event-free with \(L_1=l\), under \(A_1=a_1\). Then the cumulative risk under \(g\) is:

$$ P(T^g\leq 2,J^g=1) = q_{1,0}(a_0) + P(S_1^{a_0}=1) \sum_l P(L_1=l\mid S_1^{a_0}=1) q_{1,1}(a_1,l). $$

The formula adds two mutually exclusive ways to experience the event of interest by the end of period two: having it in period one, or surviving event-free through period one and having it in period two. In the second term, the covariate distribution is the distribution that would arise under the first treatment \(a_0\), among those still event-free. This is precisely why simply fixing or conditioning away \(L_1\) does not generally estimate the total risk under a treatment strategy.

Justification: Partition the event \(\{T^g\leq 2,J^g=1\}\) according to whether the event of interest occurs in period one or period two. The period-one probability is \(q_{1,0}(a_0)\). A period-two event requires \(S_1^{a_0}=1\); conditional on that survival, average its probability over the \(L_1\) distribution under \(a_0\). The law of total probability gives the displayed expression. The competing event contributes to failure to survive event-free into period two, so it is already accounted for in \(P(S_1^{a_0}=1)\); it must not be treated as ordinary censoring.

In longer follow-up, the same logic is applied recursively: at each time, average the event probabilities and next covariate distributions under the treatment specified by the regime, while removing from the risk set those who have already experienced either event. The competing-risk g-formula is this sequential standardization over the histories that would occur under the intervention.

Worked Example: A Confounder Changed by Earlier Treatment

Suppose a hypothetical clinic follows patients with a chronic condition. At baseline, clinicians choose treatment \(A_0\). Among patients who remain free of either event, a symptom measure \(L_1\) is recorded; symptoms can worsen after the initial treatment, and clinicians use them to choose \(A_1\). The event of interest is hospitalization, while death before hospitalization is competing. Here \(L_1\) is affected by \(A_0\), predicts \(A_1\), and predicts hospitalization. Thus it is a time-varying confounder affected by prior treatment.

Consider a hypothetical participant who receives \(A_0=1\), remains event-free, and has \(L_1=1\). For estimating the effect of \(A_1\), this symptom history is relevant because it influences treatment choice and later hospitalization risk. But in an analysis of the total effect of the sustained strategy \((1,1)\) versus \((0,0)\), the distribution of \(L_1\) is also part of the pathway through which \(A_0\) can affect risk. A conventional outcome regression that conditions on \(L_1\) as though it were an ordinary baseline confounder may block that pathway.

The remedy is not to ignore \(L_1\). The g-formula accounts for its relationship with later treatment and outcome while retaining the strategy-specific distribution of \(L_1\). The next example shows the arithmetic. All numbers are hypothetical, and there is no loss to follow-up.

Calculating Risks Under Sustained Strategies

Suppose a hypothetical data source supports the following conditional probabilities. “Survival” in period one means remaining free of both event types through that period. Each period-two row describes mutually exclusive period-two outcomes among people who survived event-free through period one.

QuantityValue
Period-one event of interest: \(A_0=0\)0.100
Period-one competing event: \(A_0=0\)0.050
Period-one event of interest: \(A_0=1\)0.080
Period-one competing event: \(A_0=1\)0.120
\(P(L_1=1\mid S_1^{0}=1)\)0.200
\(P(L_1=1\mid S_1^{1}=1)\)0.600
Period-two event of interest, \(A_1=0,L_1=0\)0.100
Period-two event of interest, \(A_1=0,L_1=1\)0.250
Period-two event of interest, \(A_1=1,L_1=0\)0.060
Period-two event of interest, \(A_1=1,L_1=1\)0.120

Worked Example: G-Formula Risk Contrast

Calculate the two-period risk of hospitalization under \((0,0)\) and \((1,1)\). The period-one probabilities of remaining event-free are \(1-0.100-0.050=0.850\) under \(A_0=0\), and \(1-0.080-0.120=0.800\) under \(A_0=1\). These subtractions include both mutually exclusive event types.

Under \((0,0)\), the period-two event probability averaged over the \(L_1\) distribution among event-free patients is:

$$ (1-0.200)(0.100)+(0.200)(0.250) =0.080+0.050=0.130. $$

Therefore the total risk under \((0,0)\) is:

$$ 0.100+(0.850)(0.130)=0.2105. $$

Under \((1,1)\), \(P(L_1=0\mid S_1^1=1)=1-0.600=0.400\). The averaged period-two event probability is:

$$ (0.400)(0.060)+(0.600)(0.120) =0.024+0.072=0.096. $$

Thus the total risk under \((1,1)\) is:

$$ 0.080+(0.800)(0.096)=0.1568. $$

The risk difference, risk under \((1,1)\) minus risk under \((0,0)\), is \(0.1568-0.2105=-0.0537\), or 5.37 percentage points lower under \((1,1)\) in this hypothetical population over the two periods. This contrast includes any effect of treatment on the competing event; it is not a comparison in which death is eliminated.

The assumptions must be considered alongside this computation. The conditional probabilities need to identify the relevant potential outcomes through sequential exchangeability; both strategies must be possible in the histories they generate; treatment and events must be consistently defined; and the measured symptom distribution must correspond to the right time and risk set. If these conditions fail, the arithmetic still describes a model-based standardization, but it need not identify the causal risk contrast.

Why Ordinary Adjustment Can Change the Target

A standard regression that includes \(L_1\) as a covariate can help control confounding of the later decision \(A_1\), but it does not automatically recover the total effect of a sustained strategy. In particular, plugging in one common \(L_1\) distribution for both strategies removes the way the first treatment changes that distribution. The g-formula instead uses \(P(L_1\mid S_1^{a_0}=1)\) separately under each strategy.

For illustration, if the \((1,1)\) period-two outcome probabilities from the example were averaged using the \(L_1\) distribution under \(A_0=0\), the result would be \((0.800)(0.060)+(0.200)(0.120)=0.072\). Combining that with the \((1,1)\) first-period risk and survival gives \(0.080+(0.800)(0.072)=0.1376\), not the strategy-specific risk \(0.1568\). This calculation is not a claim that every adjusted regression equals 0.1376. It demonstrates that changing the covariate distribution changes the standardization target; a conventional conditional model needs an explicit, appropriate causal procedure to yield the desired total risk.

Worked Example: Inverse Probability Weights for Treatment History

Weighting offers another way to address measured time-varying confounding. In a hypothetical cohort, suppose \(P(A_0=1)=0.500\), and among people with \(A_0=1\) who remain event-free, the observed probabilities of \(A_1=1\) are 0.800 for \(L_1=0\) and 0.400 for \(L_1=1\). For an individual following regime \((1,1)\), the unstabilized treatment weight is the inverse probability of receiving that treatment history given the measured history.

For a history with \(L_1=0\), the probability of the observed treatment path is \((0.500)(0.800)=0.400\), so the weight is \(1/0.400=2.50\). For a history with \(L_1=1\), that probability is \((0.500)(0.400)=0.200\), so the weight is \(1/0.200=5.00\). The larger weight reflects that this treatment path is less common in that measured history.

In a weighted analysis, people who followed a strategy can represent similar measured histories in which that strategy was less often observed. With repeated decisions, the treatment-history weight is the product of the inverse conditional treatment probabilities at each decision time. Censoring weights can also be needed when follow-up is incomplete. These weights address measured treatment assignment only under the model and identification assumptions; they do not repair unmeasured confounding or lack of support.

Diagnostics, Alternatives, and Limitations

The g-formula and inverse probability weighting are both g-methods, but they rely on different models. The g-formula models outcome and covariate distributions and then standardizes under a specified regime. Weighting models treatment assignment (and often censoring) and creates a weighted pseudo-population in which measured treatment history is balanced, subject to correct models and positivity. A marginal structural model can summarize weighted risks across strategies. Doubly robust approaches combine components, but “doubly robust” does not remove the need for well-defined interventions, adequate overlap, and at least one correctly specified nuisance-model component under the method’s conditions.

Useful checks include examining treatment probabilities across covariate histories, inspecting the range and upper tail of weights, and comparing weighted covariate balance before and after weighting. For the g-formula, inspect fitted probabilities for impossible values, compare model-predicted covariate and event distributions with observed distributions, and check whether important nonlinearities or interactions have been omitted. Extreme weights signal that some histories contribute disproportionately; truncation may reduce variance but introduces a bias-variance trade-off and changes the estimator. Report such choices and assess sensitivity to them.

Neither method is a cure for unsupported extrapolation. If no patients with a particular symptom history receive one treatment, the corresponding counterfactual risk is not learned from the data without additional assumptions. Model misspecification can also distort either approach: a flexible outcome model may still extrapolate poorly, while a treatment model may predict probabilities near zero and create unstable weights. With few events, especially few competing events, estimates can be imprecise even when the method is correctly specified.

A common mistake is to adjust for every available covariate in a single outcome regression and assume that this necessarily controls confounding. The reasoning is that a variable associated with treatment and outcome must be included as an ordinary covariate. The correction is to inspect its timing and causal role: if it is affected by earlier treatment, it can be both a confounder of later treatment and part of the earlier treatment’s effect pathway. Use a method that respects the longitudinal treatment and covariate history, and state the target regime and competing-event treatment explicitly.

Key takeaway: When a time-varying confounder is affected by prior treatment, ordinary adjustment may not estimate the total risk under a treatment strategy. The competing-risk g-formula or a suitable weighting approach can address this treatment-confounder feedback under consistency, sequential exchangeability, positivity, correct measurement, and appropriate censoring assumptions.

Check Your Understanding

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

  1. A post-baseline symptom measure is affected by initial treatment, predicts the next treatment, and predicts the event of interest. Why can simply adding it to an outcome regression be inadequate for the total effect?
  2. Under a regime, the period-one event-of-interest risk is 0.12, competing-event risk is 0.08, and the period-two event risk among period-one survivors, averaged over their regime-specific covariate distribution, is 0.10. Calculate the two-period event-of-interest risk.
  3. In a hypothetical study, the probability of a treatment path for a history is 0.25. What is its unstabilized inverse probability weight, and what does it mean?
  4. Why is the competing event included when calculating period-one survival for the g-formula?
  5. Name two important diagnostics for a weighting analysis and state what a failure may indicate.

Solutions. (1) The measure is needed to account for confounding of later treatment, but it is also affected by earlier treatment and can lie on an effect pathway. Conventional conditioning may block part of the total effect or otherwise target a different contrast; a longitudinal g-method preserves the regime-specific covariate history. (2) Period-one survival is \(1-0.12-0.08=0.80\). The cumulative risk is \(0.12+(0.80)(0.10)=0.20\), or 20% by the end of period two. (3) The weight is \(1/0.25=4\). This is a contribution weight for a path relatively unlikely under that measured history, not an individual causal effect. (4) Experiencing either event prevents the participant from remaining event-free and at risk for the event of interest in period two, so survival subtracts both mutually exclusive event probabilities. (5) Check treatment-probability overlap and the weight distribution, and check covariate balance after weighting. Poor overlap or extreme weights can indicate positivity problems or an unstable treatment model; residual imbalance can indicate model misspecification or inadequate control of measured history.

Clinical Biostats