Tutorials › Marginal Structural Models › G-Computation With Treatment-Confounder Feedback

The Parametric g-Formula · Tutorial 296 of 501

G-Computation With Treatment-Confounder Feedback

See why g-computation must update the distribution of each time-varying confounder under the treatment history imposed by an intervention.

Advanced 11 min read

What You'll Learn

  • Define treatment-confounder feedback in a longitudinal study.
  • State the assumptions for identifying a regime-specific mean with the g-formula.
  • Explain how prior treatment changes the covariate distribution used at later times.
  • Calculate regime-specific risks by propagating covariate distributions.
  • Recognize why holding post-treatment covariates to an observed distribution can mislead.
  • Compare g-computation with weighting and conventional adjustment.

Why Covariate Distributions Must Follow the Intervention

In a longitudinal study, a treatment can affect a later covariate, and that covariate can in turn affect both subsequent treatment and the outcome. This is treatment-confounder feedback. The later covariate is a confounder of the next treatment-outcome relationship, but it is also part of the pathway through which earlier treatment can affect the outcome.

For example, an initial treatment may change a patient's disease severity. Severity then influences whether the patient receives treatment at the next visit and also predicts the final outcome. To estimate the outcome under a specified treatment history, g-computation must account for the severity distribution that would arise under that history. It does not generally suffice to adjust for severity while keeping it distributed as observed in the study.

Use \(L_t\) for covariates measured just before treatment \(A_t\), with \(t=0,\ldots,K\), and \(Y\) for the outcome measured after \(A_K\). Write \(\bar L_t=(L_0,\ldots,L_t)\) and \(\bar A_t=(A_0,\ldots,A_t)\). A treatment regime is a fixed sequence \(\bar a=(a_0,\ldots,a_K)\); \(Y^{\bar a}\) denotes the outcome that would be observed if treatment were set to that sequence. Here the focus is on how the distribution of the covariates evolves under that intervention.

Definition: Treatment-confounder feedback occurs when a prior treatment \(A_t\) affects a later covariate \(L_{t+1}\), and \(L_{t+1}\) is a confounder of the effect of a subsequent treatment \(A_{t+1}\) on the outcome. Thus \(L_{t+1}\) is both affected by earlier treatment and relevant to later treatment and outcome.

Identification and Propagation

The g-formula identifies a regime-specific mean under consistency, no interference between individuals, sequential exchangeability, and positivity. Informally, sequential exchangeability says that, conditional on the measured treatment and covariate history just before each treatment, treatment assignment is independent of the relevant future counterfactuals. Positivity requires that the treatment specified by the regime has positive probability at histories that can arise under the regime. These assumptions are stated for the intervention and target population of interest.

Let \(H_t=(\bar L_t,\bar A_{t-1})\) be the observed history before \(A_t\). For a fixed regime, the identifying formula is

$$ E[Y^{\bar a}] = \sum_{\bar l_K} E[Y\mid \bar L_K=\bar l_K,\bar A_K=\bar a]\, p(l_0)\prod_{t=0}^{K-1} p(l_{t+1}\mid \bar L_t=\bar l_t,\bar A_t=\bar a_t). $$

The displayed sum is for discrete covariates; integration replaces summation for continuous covariates. Each transition distribution is evaluated with the treatment history set to the regime. In particular, the factor for \(L_{t+1}\) uses \(A_t=a_t\), not the treatment value that happened to be observed for a person in that history.

Theorem: Under consistency, no interference, sequential exchangeability, and positivity for \(\bar a\), the distribution of covariate histories under the intervention is obtained by starting with the baseline distribution \(p(l_0)\) and successively applying the observed conditional transition distributions with treatment set to the regime. Consequently, averaging the conditional outcome mean over those intervention-specific histories gives \(E[Y^{\bar a}]\), as in the longitudinal g-formula.

To see why the distributions must be propagated, define \(q_0(l_0)=p(l_0)\). For each \(t=0,\ldots,K-1\), define the distribution of the next covariate history by

$$ q_{t+1}(\bar l_{t+1}) = q_t(\bar l_t)\, p(l_{t+1}\mid \bar L_t=\bar l_t,\bar A_t=\bar a_t). $$

For discrete covariates this is the joint probability of the history \(\bar l_{t+1}\); summing it over earlier covariate values gives the marginal distribution of \(L_{t+1}\). Under the intervention, consistency means that the covariate transition for people with history \(\bar l_t\) and treatment \(a_t\) follows the corresponding observed conditional distribution. Sequential exchangeability permits that observed conditional distribution to identify the transition among those who would have that history under the intervention. Positivity ensures the needed conditional distribution is represented in the observed data.

The recursion follows by the probability chain rule: the probability of \((\bar L_t=\bar l_t,L_{t+1}=l_{t+1})\) under the intervention equals the probability of \(\bar L_t=\bar l_t\) under that intervention times the conditional transition probability. Applying this identity at each time gives the product in the g-formula. Finally, conditional expectation gives

$$ E[Y^{\bar a}] = \sum_{\bar l_K} E[Y^{\bar a}\mid \bar L_K^{\bar a}=\bar l_K]\, P(\bar L_K^{\bar a}=\bar l_K), $$

and consistency and sequential exchangeability identify the conditional outcome mean in this expression with \(E[Y\mid \bar L_K=\bar l_K,\bar A_K=\bar a]\). Substituting the propagated history distribution yields the stated formula. \(\square\)

Worked Calculations

Worked Example: A Binary Confounder Affected by Earlier Treatment

Suppose \(L_0\) is constant and there are two treatment times, \(A_0,A_1\), followed by a binary outcome \(Y\). The covariate \(L_1\) is binary. The transition probabilities are

$$ P(L_1=1\mid A_0=0)=0.20,\qquad P(L_1=1\mid A_0=1)=0.60. $$

Suppose the outcome risks conditional on \(L_1,A_1\) are \(0.10,0.50\) for \(A_1=0\) when \(L_1=0,1\), respectively, and \(0.20,0.80\) for \(A_1=1\). Calculate the regime-specific risks for the four fixed treatment sequences.

For regime \((0,0)\), the intervention gives \(P(L_1=1)=0.20\), so \(E[Y^{(0,0)}]=0.80(0.10)+0.20(0.50)=0.08+0.10=0.18\).

For regime \((0,1)\), the same \(L_1\) distribution applies, but the outcome risks correspond to \(A_1=1\): \(E[Y^{(0,1)}]=0.80(0.20)+0.20(0.80)=0.16+0.16=0.32\).

For regime \((1,0)\), \(A_0=1\) changes the transition distribution to \(P(L_1=1)=0.60\): \(E[Y^{(1,0)}]=0.40(0.10)+0.60(0.50)=0.04+0.30=0.34\).

For regime \((1,1)\), use that same intervention-specific covariate distribution and the \(A_1=1\) outcome risks: \(E[Y^{(1,1)}]=0.40(0.20)+0.60(0.80)=0.08+0.48=0.56\).

The initial treatment changes the later confounder distribution, so the calculation for the \(A_0=1\) regimes must use \(P(L_1=1\mid A_0=1)\), not the transition distribution under \(A_0=0\).

Worked Example: Why an Observed Covariate Distribution Is Not a Substitute

Continue the same setting, and suppose half the study population receives \(A_0=1\) and half \(A_0=0\). The pooled observed probability of \(L_1=1\) is \(0.50(0.60)+0.50(0.20)=0.40\). Consider the intervention \((1,0)\).

The correct intervention distribution is \(P(L_1=1\mid A_0=1)=0.60\). As calculated above, its risk is \(0.40(0.10)+0.60(0.50)=0.34\).

If instead we average the \(A_1=0\) outcome risks over the pooled observed \(L_1\) distribution, the result is \(0.60(0.10)+0.40(0.50)=0.06+0.20=0.26\).

The value \(0.26\) is not the risk under \((1,0)\): it uses a covariate distribution that mixes histories generated under both values of \(A_0\). Even using the \(A_0=0\) distribution would give \(0.80(0.10)+0.20(0.50)=0.18\), also not \(0.34\). The issue is not the final outcome averaging step; it is averaging over the wrong distribution of a post-treatment covariate.

Worked Example: Averaging Over Baseline Strata

Let baseline covariate \(L_0\) have two strata, \(H\) and \(L\), with probabilities \(0.25\) and \(0.75\). Under \(A_0=0\), let \(P(L_1=1\mid H)=0.10\) and \(P(L_1=1\mid L)=0.30\). Under \(A_0=1\), let those probabilities be \(0.50\) and \(0.70\). At \(A_1=0\), suppose the outcome risks for \(L_1=0,1\) are \(0.10,0.40\) in stratum \(H\), and \(0.20,0.60\) in stratum \(L\). Find the risks under \((0,0)\) and \((1,0)\).

Under \((0,0)\), the risk in stratum \(H\) is \(0.90(0.10)+0.10(0.40)=0.09+0.04=0.13\). In stratum \(L\), it is \(0.70(0.20)+0.30(0.60)=0.14+0.18=0.32\). Thus \(E[Y^{(0,0)}]=0.25(0.13)+0.75(0.32)=0.0325+0.24=0.2725\).

Under \((1,0)\), the risk in stratum \(H\) is \(0.50(0.10)+0.50(0.40)=0.25\). In stratum \(L\), it is \(0.30(0.20)+0.70(0.60)=0.06+0.42=0.48\). Averaging over the same baseline target population gives \(E[Y^{(1,0)}]=0.25(0.25)+0.75(0.48)=0.0625+0.36=0.4225\).

The baseline distribution is common to both interventions, but the distribution of \(L_1\) changes with \(A_0\) within each baseline stratum. Both parts of the averaging therefore matter.

Interpretation, Diagnostics, and Alternatives

In a parametric g-computation analysis, conditional models are used to estimate the covariate transitions and the outcome mean; their fitted distributions are then combined according to the g-formula. The central requirement for treatment-confounder feedback is structural: each later covariate distribution must be allowed to depend on the earlier treatment history that precedes it. A model or calculation that holds a post-treatment confounder to its observed pooled distribution generally targets no specified intervention.

Useful checks include comparing fitted and observed covariate distributions across treatment histories, checking that predicted probabilities are valid, and checking whether the intervention requires treatment-covariate histories with little or no data support. Compare results across plausible model specifications: large changes can indicate sensitivity to functional form or extrapolation. Good fit to observed outcomes alone cannot establish that the intervention-specific covariate transitions are correct.

A conventional outcome regression that adjusts for a time-varying confounder can block part of the effect of earlier treatment, while omitting it can leave confounding of later treatment. The g-formula addresses this by conditioning on covariates in the transition and outcome distributions, then averaging over the covariate histories induced by the intervention. Inverse-probability weighting takes a different route by reweighting observations to represent treatment histories; it does not perform this same explicit propagation of covariate distributions.

Neither approach removes the need for identification assumptions or adequate data support. Parametric g-computation can be biased if the transition or outcome models are misspecified, and positivity violations can make estimates depend heavily on extrapolation. The formula describes the target under its assumptions; it does not guarantee that the available data can estimate that target reliably.

Common pitfall: “I adjusted for the later confounder, so I can average the outcome predictions over its observed distribution.” This fails when earlier treatment affects that confounder: the observed distribution may mix histories under different earlier treatments. Instead, use the covariate transition distributions under the treatment sequence being evaluated, then average the outcome mean over the resulting histories.

Check Your Understanding

Answer each question, then check the solutions below.

  1. In one sentence, what feature makes a covariate part of treatment-confounder feedback?
  2. In the first worked example, what is the risk under \((1,0)\), and which probability for \(L_1=1\) is used?
  3. Using that example, calculate the risk under \((0,0)\) if someone incorrectly uses \(P(L_1=1)=0.60\).
  4. Why does the g-formula average over an intervention-specific distribution of \(L_1\), rather than a single pooled observed distribution?

Solutions. (1) Earlier treatment affects the covariate, which then confounds a later treatment-outcome relationship. (2) The risk is \(0.40(0.10)+0.60(0.50)=0.34\), using \(P(L_1=1\mid A_0=1)=0.60\). (3) The incorrect calculation is \(0.40(0.10)+0.60(0.50)=0.34\); in this particular case it happens to equal the correct risk for \((1,0)\), because \(0.60\) is precisely the \(L_1\) probability under \(A_0=1\). For \((0,0)\), the correct risk is \(0.18\), using \(P(L_1=1\mid A_0=0)=0.20\). (4) The pooled distribution can combine covariate histories produced by different treatment histories, whereas the regime-specific mean requires histories produced under the intervention being evaluated.

Clinical Biostats