Tutorials › Marginal Structural Models › Why G-Computation Does Not Model Treatment Assignment

The Parametric g-Formula · Tutorial 301 of 501

Why G-Computation Does Not Model Treatment Assignment

Learn why intervention-based g-computation omits treatment-assignment probabilities, which models it does require, and when treatment probabilities remain important for identification and diagnostics.

Advanced 12 min read

What You'll Learn

  • Distinguish the observed treatment-assignment mechanism from the intervention distribution.
  • Derive the longitudinal g-formula by replacing treatment-assignment factors with a fixed regime.
  • Identify the conditional covariate and outcome models needed for g-computation.
  • Work through numerical examples where assignment probabilities do not enter the g-formula.
  • Recognize when treatment probabilities still matter for exchangeability, positivity, and diagnostics.
  • Compare g-computation with inverse-probability weighting without conflating their required models.

Why the Treatment-Assignment Model Disappears

In observed data, treatment is assigned according to the clinical or social process that generated the study. Under an intervention, treatment is instead set according to a specified regime. These are different distributions. The parametric g-formula uses models for how covariates and outcomes evolve under specified treatment values; it does not need to simulate the observed treatment-assignment process.

That distinction is not a claim that treatment assignment is unimportant. Assignment can be strongly associated with prognosis, and its probabilities help characterize confounding and the support available in the data. The point is narrower: once the intervention fixes treatment, the observed assignment probability is not a factor in the intervention distribution being averaged.

Definition: Let \(L_0\) be baseline covariates, \(A_t\) treatment at time \(t\), \(L_{t+1}\) covariates measured after \(A_t\), and \(Y\) the terminal outcome, for \(t=0,\ldots,K\) (with \(L_{K+1}\) not required). Write \(\bar L_t=(L_0,\ldots,L_t)\), \(\bar A_t=(A_0,\ldots,A_t)\), and \(C_t=(\bar L_t,\bar A_{t-1})\), where \(C_0=L_0\). A deterministic regime \(d\) specifies \(A_t=d_t(C_t)\). The treatment-assignment mechanism is \(g_t(a\mid C_t)=P(A_t=a\mid C_t)\). The covariate-transition distribution is \(q_t(l_{t+1}\mid \bar L_t,\bar A_t)=P(L_{t+1}=l_{t+1}\mid \bar L_t,\bar A_t)\), for \(t<K\); the terminal outcome distribution is \(f_Y(y\mid \bar L_K,\bar A_K)\).

For clarity, first consider finite-valued treatments and covariates. The observed-data distribution factors into a baseline distribution, treatment-assignment factors, covariate-transition factors, and a terminal outcome factor:

$$ f(l_0)\prod_{t=0}^{K}g_t(a_t\mid C_t) \prod_{t=0}^{K-1}q_t(l_{t+1}\mid \bar l_t,\bar a_t) f_Y(y\mid \bar l_K,\bar a_K). $$

Under regime \(d\), the factors \(g_t\) are not used to generate treatment. The intervention sets \(a_t=d_t(C_t)\). The distribution of later covariates and the outcome still depends on those assigned values, so their conditional models must retain treatment history as appropriate.

G-formula for a deterministic regime: Under consistency, sequential exchangeability, and positivity, the mean outcome under \(d\) is
$$ E[Y^d] = \sum_{l_0,\ldots,l_K} f(l_0) \left\{\prod_{t=0}^{K-1} q_t\!\left(l_{t+1}\mid \bar l_t,\bar a_t^d\right)\right\} E\!\left[Y\mid \bar L_K=\bar l_K,\bar A_K=\bar a_K^d\right], $$

where \(a_t^d=d_t(\bar l_t,\bar a_{t-1}^d)\) is the treatment specified by the regime along that covariate history. For continuous covariates, the sums are integrals with respect to the relevant distributions. The expression requires a model for the baseline distribution, the covariate transitions, and the conditional outcome mean. It contains no \(g_t\) factor.

Deriving the Intervention Distribution

The cancellation is a consequence of replacing the assignment mechanism, not an approximation that treats observed treatment as random. For each history, a deterministic intervention assigns probability one to its prescribed treatment and zero to other values. Thus the treatment factor under intervention is an indicator, not the observed conditional probability.

1
Write the observed factorization.
Separate the treatment factors \(g_t\) from the conditional distributions of covariates and the outcome.
2
Replace assignment by the intervention.
For each time \(t\), use the point-mass factor \(I\{a_t=d_t(C_t)\}\), where \(I\{\cdot\}\) is one when its condition holds and zero otherwise.
3
Sum over treatment values.
The indicator permits only the regime-prescribed treatment at each history. Summing over \(\bar a_K\) removes the treatment factors and evaluates each \(q_t\) and outcome distribution at \(\bar a_K^d\).

More formally, the intervention joint distribution is the observed baseline, covariate, and outcome kernels multiplied by \(\prod_{t=0}^{K}I\{a_t=d_t(C_t)\}\). To obtain the marginal distribution of covariates and \(Y\), sum this joint distribution over all treatment sequences. At each step only the sequence consistent with \(d\) contributes. The result is the product of the baseline distribution and the covariate and outcome kernels evaluated along that sequence. Taking the expectation of \(Y\) gives the displayed g-formula. This derivation proves the algebraic form of the intervention distribution; identification of its kernels from observed data requires the assumptions below. \(\square\)

Identification conditions: Consistency means that a person who follows regime \(d\) has observed outcome \(Y=Y^d\). Sequential exchangeability requires, at each \(t\), that treatment be independent of the relevant future counterfactual outcomes and covariates conditional on \(C_t\). Positivity requires \(P(A_t=d_t(C_t)\mid C_t)>0\) for histories with positive probability under the intervention. These conditions justify using the observed conditional kernels for the intervention calculation; they do not make treatment-assignment probabilities part of the g-formula.

In a parametric implementation, the corresponding conditional models must also be adequately specified for the target histories. A correctly specified treatment model cannot repair a misspecified covariate-transition or outcome model in the g-formula. Conversely, omitting a treatment model from the g-formula does not by itself establish exchangeability or positivity.

Worked Examples

Worked Example: A One-Time Intervention

Suppose \(L\) is a binary baseline risk factor with \(P(L=1)=0.40\). Under treatment \(A=1\), the outcome risks are \(0.20\) when \(L=1\) and \(0.05\) when \(L=0\). The observed treatment probabilities are \(P(A=1\mid L=1)=0.80\) and \(P(A=1\mid L=0)=0.30\). Find the g-computation risk under the intervention \(A=1\) for everyone.

The intervention mean standardizes the conditional outcome risks over the baseline covariate distribution:

$$ E[Y^{1}] = P(L=1)E[Y\mid L=1,A=1] +P(L=0)E[Y\mid L=0,A=1] $$

Substituting the values gives

$$ E[Y^{1}]=(0.40)(0.20)+(0.60)(0.05) =0.08+0.03=0.11. $$

The estimated regime risk is \(0.11\). The probabilities \(0.80\) and \(0.30\) describe which people actually received treatment; neither is multiplied into this standardization. They can matter for whether the required treated histories are represented well enough to estimate the conditional risks, but they are not regime weights in this calculation.

Worked Example: Treatment-Confounder Feedback

Consider two treatment times, \(A_0\) and \(A_1\), and an intermediate binary covariate \(L_1\). Use the regime \(A_0=A_1=1\). Suppose \(P(L_1=1\mid A_0=1)=0.30\), and the terminal outcome risks under \(A_1=1\) are \(0.40\) for \(L_1=1\) and \(0.10\) for \(L_1=0\). In the observed data, suppose \(P(A_0=1)=0.20\), \(P(A_1=1\mid L_1=1,A_0=1)=0.90\), and \(P(A_1=1\mid L_1=0,A_0=1)=0.30\). Calculate the regime risk.

First average the outcome risks over the covariate distribution that would arise after \(A_0=1\):

$$ E[Y^{(1,1)}] =(0.30)(0.40)+(0.70)(0.10) =0.12+0.07=0.19. $$

The assignment probabilities do not enter this calculation. Under the regime, both treatment values are set to one; the \(L_1\) transition distribution is evaluated under \(A_0=1\), and the outcome risks are evaluated under \(A_1=1\). The observed probability of receiving \(A_0=1\), or of receiving \(A_1=1\) conditional on \(L_1\), describes selection into treatment, not the distribution generated by the intervention.

Worked Example: Why a Treatment Model Alone Is Not the G-Formula

Let \(L\) be binary with \(P(L=1)=0.50\). The treatment probabilities are \(P(A=1\mid L=1)=0.80\) and \(P(A=1\mid L=0)=0.20\). Suppose the outcome risks are \(0.30\) and \(0.10\) under \(A=1\), for \(L=1\) and \(L=0\), respectively; under \(A=0\), they are \(0.50\) and \(0.20\). Compute the risk under \(A=1\), then compare it with the observed treated risk.

The g-computation risk is obtained from the outcome model and the baseline distribution:

$$ E[Y^{1}]=(0.50)(0.30)+(0.50)(0.10)=0.20. $$

Among treated people, the covariate distribution is different. The joint probabilities of \(L=1,A=1\) and \(L=0,A=1\) are \((0.50)(0.80)=0.40\) and \((0.50)(0.20)=0.10\), so \(P(A=1)=0.50\), \(P(L=1\mid A=1)=0.40/0.50=0.80\), and \(P(L=0\mid A=1)=0.10/0.50=0.20\). Therefore,

$$ E[Y\mid A=1]=(0.80)(0.30)+(0.20)(0.10)=0.26. $$

The difference, \(0.26\) versus \(0.20\), arises because the treated group overrepresents \(L=1\), a group with higher outcome risk under treatment. The treatment model explains this selection pattern, but it does not replace the conditional outcome model needed to calculate the intervention mean.

When Treatment Probabilities Still Matter

Although assignment probabilities are absent from the g-formula, they remain relevant to the analysis in several ways. First, sequential exchangeability is a causal assumption about treatment selection given measured history. A fitted treatment model may help describe that selection, but good prediction or calibration does not prove that all confounders were measured. Second, positivity concerns whether the regime-prescribed treatment occurs with positive probability at relevant histories. Near-zero probabilities signal that the outcome or transition models may be forced to extrapolate. Third, treatment probabilities are central to inverse-probability weighting, where observed records are reweighted to represent a target intervention. That is a different estimating strategy from g-computation, not an extra factor to append to its formula.

QuestionG-computation roleAssignment-model role
What happens to covariates under the regime?Model the conditional covariate transitions under assigned treatment values.Not a transition model; describes observed treatment selection.
What is the outcome under the regime?Model the conditional outcome given covariate and treatment history.Does not provide the required outcome regression by itself.
Are relevant treatment histories supported?Required for credible estimation and interpretation.Probabilities can help diagnose sparse or poorly supported histories.
How does inverse-probability weighting work?Not the weighting factor in this approach.Treatment probabilities are used to construct weights.

The main practical limitation is therefore not that g-computation ignores treatment selection, but that it relies on correctly estimated outcome and covariate-transition distributions at regime-relevant histories. Extrapolation can be severe when the data contain little support for those histories. A treatment model can help reveal weak support, but cannot turn unsupported histories into observed information. Nor does fitting every conditional model guarantee validity: causal identification assumptions and model adequacy remain necessary.

Common Mistake: Multiplying by the Propensity Score

A common error is to take the g-formula and multiply each term by \(P(A_t=d_t(C_t)\mid C_t)\), reasoning that the probability of observing the regime must be part of its counterfactual mean. That inserts the observational assignment mechanism into a distribution where treatment has already been set by intervention. It would generally downweight histories precisely because the observed assignment process made the intervention uncommon, changing the target quantity. In inverse-probability weighting, treatment probabilities appear for a different reason: weights reweight observed treatment histories. Keep the two constructions distinct.

Key takeaway: G-computation sets treatment to the regime and models the covariate and outcome distributions that follow. Treatment-assignment probabilities are not factors in its intervention mean, although they remain relevant to assumptions, support, and diagnostics.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In one sentence, distinguish the treatment-assignment mechanism from the treatment rule under a deterministic intervention.
  2. Suppose a baseline covariate has probability \(0.25\) of being high risk. Under a fixed treatment, outcome risks are \(0.40\) for high risk and \(0.12\) for low risk. What is the g-computation risk?
  3. Does a fitted treatment model establish sequential exchangeability? Explain.
  4. Why can very small treatment probabilities matter even though they do not appear in the g-formula?
  5. Which model is needed to predict the distribution of an intermediate covariate under a specified treatment history?

Solutions. (1) The assignment mechanism gives the probability of observed treatment conditional on history; the intervention rule fixes treatment as a function of history. (2) \(0.25(0.40)+0.75(0.12)=0.10+0.09=0.19\). (3) No. A model describes observed assignment conditional on measured history; it cannot verify that all confounders were measured or that the causal assumption holds. (4) They indicate that the regime may have little support at those histories, so conditional models may rely on extrapolation. (5) The conditional covariate-transition model \(q_t\), evaluated at the regime-prescribed treatment history.

Clinical Biostats