Tutorials › Marginal Structural Models › Avoiding Confounder Adjustment in Weighted Outcome Models

Fitting MSMs for Survival Outcomes · Tutorial 184 of 501

Avoiding Confounder Adjustment in Weighted Outcome Models

Learn how treatment-affected confounders behave in a weighted Cox outcome model, and why adjusting for them can change the causal contrast being estimated.

Advanced 12 min read

What You'll Learn

  • Distinguish a marginal structural Cox outcome model from a weighted conditional hazard model.
  • Trace how prior treatment can affect a later confounder and later treatment.
  • Derive how treatment weights balance a time-varying confounder without removing its dependence on prior treatment.
  • Calculate marginal and conditional hazards in an explicit feedback example.
  • Diagnose when adding a post-treatment covariate changes the target rather than improving confounding control.

Why a Weighted Outcome Model Usually Leaves Out Time-Varying Confounders

A time-varying covariate can predict both later treatment and the event, yet still be the wrong variable to add to the outcome regression. The key is that it may also be affected by earlier treatment. In that case, weighting is used to address its role in treatment assignment while preserving the pathways through which earlier treatment changes it. Adding the covariate to the weighted Cox outcome model conditions on it and can change the target from a contrast between treatment regimes to a conditional hazard contrast.

The distinction is between how the treatment weights are constructed and what the outcome model is meant to represent. In a marginal structural Cox model, the outcome model describes the hazard under specified treatment histories or regimes. Its covariates encode those histories and the chosen marginal structural form. A post-treatment confounder is typically included in the treatment-weight model, not automatically in the outcome model.

Definition: Let \(A_0\) be treatment at an initial time, \(L_1\) a later time-varying covariate, and \(A_1\) subsequent treatment. A marginal structural Cox outcome model specifies a hazard under a treatment regime, marginal over the covariate histories that would arise under that regime. A weighted conditional outcome model additionally conditions the hazard on covariates such as \(L_1\). These are different targets when \(L_1\)'s distribution or its relationship with the event differs across regimes.

The usual causal interpretation requires consistency, sequential exchangeability of treatment given the measured past, and positivity: each treatment option being compared must have positive probability at relevant covariate histories. The treatment and any censoring weights must also be correctly specified for the intended adjustment. These conditions support identification of regime-specific outcomes; they do not make every subsequent outcome regression target equivalent. The central example below assumes no unmeasured treatment or censoring confounding and no informative censoring after appropriate censoring adjustment.

Feedback Changes What Adjustment Means

The feedback structure is \(A_0 \rightarrow L_1 \rightarrow A_1\), with \(A_0 \rightarrow L_1\), and with \(L_1\) predicting the event. Thus \(L_1\) confounds the association between \(A_1\) and the event, but it is also on a pathway from earlier treatment to the event. Treatment weighting addresses the confounding of \(A_1\) by \(L_1\). Conditioning on \(L_1\) in the outcome model can, in turn, remove part of the effect of \(A_0\) that operates through \(L_1\).

Worked Example: Feedback and Different Hazard Contrasts

Suppose \(A_0\) is randomized, and \(L_1\) is binary with \(P(L_1=1\mid A_0=0)=0.2\) and \(P(L_1=1\mid A_0=1)=0.8\). Later treatment is assigned with \(P(A_1=1\mid L_1=1)=0.8\) and \(P(A_1=1\mid L_1=0)=0.2\). Given the treatment history and \(L_1\), assume the event hazard is \(\lambda(t\mid A_0,A_1,L_1)=0.01\exp\{(\log 2)A_0+(\log 1.5)A_1+(\log 3)L_1\}\).

At a fixed \(A_1\), the conditional hazard ratio for \(A_0=1\) versus \(A_0=0\), comparing people with the same \(L_1\), is \(2\). The corresponding initial marginal hazards average over the \(L_1\) distributions under each \(A_0\). For \(A_0=0,A_1=0\), the initial hazard is \(0.01\{0.8(1)+0.2(3)\}=0.014\). For \(A_0=1,A_1=0\), it is \(0.02\{0.2(1)+0.8(3)\}=0.052\). Therefore, the marginal initial hazard ratio is \(0.052/0.014=26/7\), approximately \(3.71\), not \(2\).

The extra factor arises because treatment changes the distribution of \(L_1\), which predicts the event. A model adjusting for \(L_1\) compares hazards at fixed \(L_1\); the marginal regime contrast averages over the regime-specific \(L_1\) distributions. The calculation is an initial-hazard comparison, not a claim that the marginal hazards remain proportional over follow-up: mixtures of survival distributions can change as people experience events.

Here \(L_1\) also predicts \(A_1\), so it is a confounder of the later treatment-outcome relationship. Correctly constructed treatment weights can address that role. They do not undo the causal effect of \(A_0\) on the distribution of \(L_1\), which is part of the total regime contrast.

What Treatment Weighting Does—and Does Not Do

The following factorization makes the distinction precise. In this simple setup, write \(p(a_1\mid a_0,l_1)=P(A_1=a_1\mid A_0=a_0,L_1=l_1)\). A stabilized treatment weight for \(A_1\) has numerator \(P(A_1=a_1\mid A_0=a_0)\) and denominator \(p(a_1\mid a_0,l_1)\). Conditional on \(A_0=a_0\), weighting the observed distribution of \((L_1,A_1)\) by this ratio gives:

$$ \begin{aligned} &f(l_1,a_1\mid a_0) \frac{P(a_1\mid a_0)}{p(a_1\mid a_0,l_1)}\\ &\qquad = f(l_1\mid a_0)p(a_1\mid a_0,l_1) \frac{P(a_1\mid a_0)}{p(a_1\mid a_0,l_1)}\\ &\qquad = f(l_1\mid a_0)P(a_1\mid a_0). \end{aligned} $$

In the weighted distribution, \(A_1\) and \(L_1\) are independent conditional on \(A_0\). But the factor \(f(l_1\mid a_0)\) remains: weighting for \(A_1\) does not make \(L_1\) independent of \(A_0\). This is exactly what is needed to address the \(L_1\)-to-\(A_1\) confounding without deleting the earlier-treatment effect carried through \(L_1\).

Result: If the treatment-weight denominator correctly uses the measured treatment history, weighting can remove the association between \(A_1\) and \(L_1\) within levels of \(A_0\) in the weighted distribution. It does not generally remove the association between \(A_0\) and \(L_1\). Therefore, adding \(L_1\) to the outcome model is not required to perform the treatment-confounding adjustment represented by these weights.

Worked Example: Checking the Weighted Distribution

Use the feedback example above. Among those with \(A_0=0\), \(P(A_1=1)=0.2(0.8)+0.8(0.2)=0.32\). The stabilized weight numerator for \(A_1=1\) is \(0.32\). Thus people with \(L_1=1\) receive weight \(0.32/0.8=0.4\), and those with \(L_1=0\) receive weight \(0.32/0.2=1.6\). Their weighted masses are \(0.2(0.8)(0.4)=0.064\) and \(0.8(0.2)(1.6)=0.256\). The weighted proportion with \(L_1=1\) is \(0.064/(0.064+0.256)=0.2\).

For \(A_0=1\), \(P(A_1=1)=0.8(0.8)+0.2(0.2)=0.68\). The weights are \(0.68/0.8=0.85\) for \(L_1=1\) and \(0.68/0.2=3.4\) for \(L_1=0\). Weighted masses are \(0.8(0.8)(0.85)=0.544\) and \(0.2(0.2)(3.4)=0.136\), giving a weighted proportion \(0.544/0.68=0.8\). Thus within each \(A_0\) group, the weighted \(L_1\) proportion is the original proportion for that group, while the weighted \(A_1\) allocation no longer depends on \(L_1\).

The calculation also shows why saying that the weights “balance all covariates” is too broad. They balance treatment against the covariates in the treatment model, in the relevant history-specific comparisons. They do not erase the relationship between prior treatment and a covariate affected by that treatment.

Why the Marginal Hazard Averages Differ

For clarity, consider a fixed regime \((a_0,a_1)\), and let \(q_l=P(L_1=l\mid A_0=a_0)\) under that regime. Write \(S_l(t)\) and \(\lambda_l(t)\) for the conditional survival function and hazard given \(L_1=l\) and the fixed treatment history. With \(L_1\) binary, the marginal survival and hazard are:

$$ S_{a_0,a_1}(t)=\sum_{l=0}^1 q_l S_l(t), \qquad \lambda_{a_0,a_1}(t)= \frac{\sum_{l=0}^1 q_l S_l(t)\lambda_l(t)} {\sum_{l=0}^1 q_l S_l(t)}. $$

The hazard is a risk-set-weighted average, not generally the hazard at a fixed value of \(L_1\), nor an average using only the initial proportions \(q_l\). The formula follows directly from survival probabilities:

1
Mix survival.
Under the regime, the population survival probability is the sum of the conditional survivals, weighted by the regime-specific proportions \(q_l\): \(S(t)=\sum_l q_lS_l(t)\).
2
Differentiate.
For absolutely continuous survival functions, \(S_l'(t)=-S_l(t)\lambda_l(t)\) almost everywhere. Hence \(S'(t)=-\sum_l q_lS_l(t)\lambda_l(t)\).
3
Form the hazard.
Where \(S(t)>0\), the marginal hazard is \(-S'(t)/S(t)\), which gives the displayed risk-set-weighted average. The weights on \(l\) change over time if survival differs by \(l\). \(\square\)

This derivation explains why adding \(L_1\) changes the Cox model’s interpretation. A model with \(L_1\) in its linear predictor describes hazards conditional on \(L_1\). A model without it can represent a marginal structural hazard model for treatment regimes, subject to its structural assumptions. The conditional coefficients need not equal the marginal regime coefficients, even when the treatment weights are correct.

Worked Example: A Marginal Hazard Is Not a Fixed-Covariate Hazard

In the first example, under regime \((A_0,A_1)=(0,0)\), the conditional hazards are \(0.01\) for \(L_1=0\) and \(0.03\) for \(L_1=1\), with proportions \(0.8\) and \(0.2\). Thus \(S_{00}(t)=0.8e^{-0.01t}+0.2e^{-0.03t}\). Under regime \((1,0)\), the conditional hazards are \(0.02\) and \(0.06\), with proportions \(0.2\) and \(0.8\), so \(S_{10}(t)=0.2e^{-0.02t}+0.8e^{-0.06t}\).

At \(t=0\), differentiating these survival functions gives hazards \(0.014\) and \(0.052\), as calculated earlier. At later times, each mixture’s risk-set proportions change: for example, the high-hazard \(L_1=1\) group is depleted more rapidly within each regime. Consequently, the initial ratio \(0.052/0.014\) need not be the hazard ratio at a later time. A fitted Cox model should therefore be interpreted according to its stated marginal structural form; it should not be assumed that a conditional model with \(L_1\) estimates the same contrast more accurately.

Choosing and Diagnosing the Outcome Model

For a marginal structural Cox analysis, specify the treatment history or regime contrast that defines the estimand, then fit the weighted outcome model to that structural covariate. A post-treatment confounder belongs in the treatment model when needed to control treatment assignment, but does not automatically belong in the outcome model. Adding it changes the hazard being modeled to one conditional on that covariate. Such a conditional parameter might be of interest for a different question, but it is not the marginal regime parameter merely because the fit is weighted.

This is not a rule to exclude every prognostic variable from every survival model. A baseline variable is not affected by prior treatment, though including it can still change the conditional-versus-marginal interpretation. Any covariate adjustment in the outcome model should be tied to a clearly stated target, and a conditional model intended to recover a marginal contrast requires an explicit standardization or other valid marginalization step. Do not interpret an adjusted coefficient as a regime-level effect by default.

Useful checks include:

  • Draw the treatment and covariate history. Ask whether the proposed outcome covariate is affected by earlier treatment.
  • Write the estimand in words: a comparison of regime-specific hazards, or a comparison conditional on a covariate history?
  • Check whether treatment weights address the measured predictors of each treatment decision, and inspect extreme weights and lack of practical positivity.
  • Check whether the treatment history in the outcome model matches the intended contrast, and assess whether the chosen Cox structural form is plausible.
  • Compare results from the prespecified marginal model with any conditional model as a sensitivity or secondary analysis, labeling the targets rather than treating disagreement as proof that one fit is defective.
Common pitfall: “\(L_1\) predicts the event and later treatment, so I should include it in both the weight model and the weighted outcome model.” The first part can justify including \(L_1\) in the treatment-weight denominator. The second does not follow: because prior treatment may cause \(L_1\), outcome adjustment conditions on a post-treatment variable and can remove part of the regime effect. Keep it out of the marginal outcome model unless the estimand and a valid marginalization procedure specifically call for it.

Alternatives and Limits

The main alternative is an ordinary conditional outcome regression that adjusts directly for time-varying covariates. With treatment-confounder feedback, ordinary adjustment for a covariate affected by prior treatment can fail to identify the total effect of a treatment regime. The weighted marginal structural approach instead uses treatment weights to handle measured time-varying confounding and fits an outcome model for the regime contrast. A weighted conditional model is a different alternative: it can answer a conditional question, but should not be presented as the marginal regime model without further justification.

Weighting is not a cure for unmeasured confounding, near-violations of positivity, misspecified treatment models, or an inadequate outcome structural form. Nor does the label “marginal” guarantee that the chosen Cox model exactly represents every regime-specific hazard over time. When the structural form is an approximation, the fitted coefficient summarizes the weighted Cox fit under that approximation. State the target and assumptions, and separate a change of estimand from a change in statistical precision.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. If \(L_1\) is affected by \(A_0\) and predicts both \(A_1\) and the event, what is the distinct role of \(L_1\) in the treatment-weight model and the marginal outcome model?
  2. In the feedback example, calculate the initial marginal hazard under \((A_0,A_1)=(0,1)\).
  3. Does weighting for \(A_1\) make \(L_1\) independent of \(A_0\)? Explain using the weighted-distribution factorization.
  4. Why can a weighted Cox model that includes \(L_1\) answer a different question from one that omits it?

Solutions. (1) \(L_1\) can enter the treatment-weight denominator to address confounding of \(A_1\); it is not automatically an outcome covariate in a model for marginal regime hazards. (2) For \(A_0=0\), the \(L_1\) distribution is \(0.8,0.2\). The conditional hazards when \(A_1=1\) are \(0.015\) and \(0.045\), so the initial marginal hazard is \(0.8(0.015)+0.2(0.045)=0.021\). (3) No. The weighted factorization is \(f(l_1\mid a_0)P(a_1\mid a_0)\), which separates \(A_1\) from \(L_1\) within \(A_0\) but retains the dependence of \(L_1\) on \(A_0\). (4) Including \(L_1\) models hazards conditional on its value, while omitting it allows the regime-specific distribution of \(L_1\) to contribute to the marginal hazard; these contrasts need not agree.

Clinical Biostats