Tutorials › Causal Inference › Why Observed-Treatment Conditioning Is Not G-Computation

The G-Formula and Dynamic Regimes · Tutorial 725 of 972

Why Observed-Treatment Conditioning Is Not G-Computation

Learn how a later treatment selects the observed covariate history, why g-computation averages over the regime-specific history distribution, and when those distributions coincide.

Advanced 12 min read

What You'll Learn

  • Define the regime-specific distribution of a later covariate in a two-treatment longitudinal setting
  • Derive the covariate distribution among people observed to receive the later treatment
  • Calculate how treatment-confounder feedback changes an observed treated-group mean
  • Distinguish conditioning on observed treatment from g-computation standardization
  • Identify the support-specific condition under which treatment selection does not change the covariate distribution

Why the Averaging Distribution Matters

In longitudinal studies, a covariate measured after an initial treatment can affect both a later treatment and the outcome. It is then a time-varying confounder for the later treatment, but it may also have been changed by the earlier treatment. This feedback means that the people who actually receive a later treatment need not have the covariate distribution that would arise if everyone followed a specified treatment regime.

G-computation handles this distinction by predicting outcomes under the regime and averaging those predictions over the covariate histories generated by that regime. Merely conditioning on observed treatment instead selects people according to the treatment process. The two procedures can use the same conditional outcome model and still produce different means because they average over different distributions.

Definition: Consider two treatment times, with initial treatment \(A_0\), a later covariate \(L_1\), later treatment \(A_1\), and outcome \(Y\). A static regime \((a_0,a_1)\) sets treatment to \(a_0\) at the first time and \(a_1\) at the second. The regime-specific mean is \(E[Y^{a_0,a_1}]\), where \(Y^{a_0,a_1}\) is the outcome that would occur under that regime. The regime-specific distribution of \(L_1\) is the distribution of \(L_1\) under initial treatment \(a_0\), written \(P(L_1^{a_0}=l)\).

The Two Distributions

For clarity, first consider a setting with no baseline covariates. Let \(q(l)=P(L_1=l\mid A_0=a_0)\), the observed distribution of the later covariate among those given the initial treatment \(a_0\). Under consistency and exchangeability for the initial treatment, this identifies the distribution \(P(L_1^{a_0}=l)\). Write \(e(l)=P(A_1=a_1\mid A_0=a_0,L_1=l)\) for the probability of receiving the later treatment \(a_1\) at covariate value \(l\).

Among people with \(A_0=a_0\) who are also observed to receive \(A_1=a_1\), covariate values with larger \(e(l)\) are more likely to appear. The resulting conditional distribution is

$$ P(L_1=l\mid A_0=a_0,A_1=a_1) = \frac{q(l)e(l)}{\sum_{l'}q(l')e(l')}, $$

provided the denominator is positive. By contrast, g-computation averages over \(q(l)\), not over this treatment-selected distribution. Under consistency, sequential exchangeability, and positivity, the two-time g-formula is

$$ E[Y^{a_0,a_1}] = \sum_l E[Y\mid A_0=a_0,L_1=l,A_1=a_1]\,q(l). $$

In this formula, the conditional outcome mean supplies the predicted outcome at each covariate value under the specified treatments. The factor \(q(l)\) then represents how common that covariate value would be under the initial treatment in the target regime. Conditioning on observed \(A_1=a_1\) instead weights covariate values by both \(q(l)\) and their chance of receiving that later treatment.

Assumptions for the identification formula: Consistency means observed covariates and outcomes equal their corresponding potential values under the treatments actually received. Sequential exchangeability means treatment assignment at each time is independent of the relevant future potential outcomes, conditional on the measured history available before that treatment. Positivity requires positive probability of each regime treatment at histories that occur under the regime. In the no-baseline-covariate setup above, these conditions allow the conditional outcome mean and \(q(l)\) to identify the regime-specific mean. They do not make the observed distribution among later-treated people equal to \(q(l)\).

Why Later Treatment Changes the Covariate Mix

The distribution among people observed to receive \(a_1\) is a reweighted version of \(q\). In a discrete setting, let \(C=\sum_l q(l)e(l)\), with \(C>0\). The selected distribution equals \(q(l)\) at every value if and only if

$$ \frac{q(l)e(l)}{C}=q(l) \quad\text{for every } l. $$

For values in the support of \(q\), division by \(q(l)>0\) gives \(e(l)=C\). Thus the two distributions agree exactly when \(e(l)\) is constant on the support of \(q\), or equivalently constant \(q\)-almost surely. It is not enough to say that \(e(l)\) varies somewhere: variation outside the support of \(q\) has no effect. This result concerns equality of distributions; even when the distributions differ, the two averages of an outcome model can coincide if that model is constant over the affected covariate values.

The distinction is especially important under treatment-confounder feedback. The initial treatment changes \(L_1\), and \(L_1\) in turn predicts both later treatment and outcome. Conditioning on the later treatment therefore selects among the \(L_1\) values created under the initial treatment. G-computation instead keeps the distribution of \(L_1\) that belongs to the regime and averages the regime-specific outcome predictions over it.

Worked Example: A Later Treatment Selects a Different Covariate Mix

Suppose a hypothetical longitudinal study has binary \(L_1\). Under \(A_0=1\), assume \(P(L_1=1\mid A_0=1)=0.8\), so \(P(L_1=0\mid A_0=1)=0.2\). Among people with \(A_0=1\), suppose \(P(A_1=1\mid L_1=1)=0.9\) and \(P(A_1=1\mid L_1=0)=0.3\). Finally, suppose the conditional outcome risks under \(A_0=1,A_1=1\) are 0.40 for \(L_1=1\) and 0.10 for \(L_1=0\). Take these conditional risks as identified under the assumptions stated above.

G-computation. The regime \((1,1)\) has \(L_1=1\) probability 0.8 and \(L_1=0\) probability 0.2. Its mean outcome risk is

$$ E[Y^{1,1}] = (0.8)(0.40)+(0.2)(0.10) = 0.32+0.02 = 0.34. $$

Observed treatment conditioning. Of those with \(A_0=1\), the proportions who also receive \(A_1=1\) from the two covariate groups are \((0.8)(0.9)=0.72\) and \((0.2)(0.3)=0.06\). The total is \(0.78\). Thus, among those observed to receive both treatments,

$$ P(L_1=1\mid A_0=1,A_1=1) = \frac{0.72}{0.78} = \frac{12}{13} \approx 0.9231, \qquad P(L_1=0\mid A_0=1,A_1=1) = \frac{1}{13}. $$

Their observed mean risk, using the same two conditional risks, is \((12/13)(0.40)+(1/13)(0.10)=4.9/13\approx0.3769\). That is about 3.69 percentage points higher than the g-computation estimate of 0.34. The difference arises because the observed group is about 92.3% \(L_1=1\), whereas the regime-specific distribution is 80% \(L_1=1\). The observed mean describes the selected group; the g-computation mean targets the specified regime.

Derivation of the Selection Formula

The expression for the covariate distribution among later-treated people follows directly from conditional probability. First, the joint probability of \(L_1=l\) and \(A_1=a_1\), among those with \(A_0=a_0\), factors into the probability of \(L_1=l\) and the conditional probability of later treatment:

$$ P(L_1=l,A_1=a_1\mid A_0=a_0) = P(L_1=l\mid A_0=a_0) P(A_1=a_1\mid A_0=a_0,L_1=l) = q(l)e(l). $$

Summing over all covariate values gives the probability of later treatment \(a_1\) among those with \(A_0=a_0\):

$$ P(A_1=a_1\mid A_0=a_0) = \sum_{l'}q(l')e(l'). $$

Dividing the joint probability by this marginal probability yields \(P(L_1=l\mid A_0=a_0,A_1=a_1)\), as stated. The reweighting is therefore a consequence of selecting people by their observed later treatment, not a special feature of a particular outcome model.

Worked Example: Variation Outside the Support Does Not Shift the Distribution

Suppose the regime-specific covariate distribution puts all its mass at \(L_1=0\): \(q(0)=1\) and \(q(1)=0\). Let the later-treatment probabilities be \(e(0)=0.5\) and \(e(1)=0.2\). The treatment probability varies across the two possible covariate values, but \(L_1=1\) never occurs under this distribution.

The denominator is \((1)(0.5)+(0)(0.2)=0.5\), which is positive. Reweighting gives

$$ P(L_1=0\mid A_0=a_0,A_1=a_1) = \frac{(1)(0.5)}{0.5} = 1, \qquad P(L_1=1\mid A_0=a_0,A_1=a_1) = \frac{(0)(0.2)}{0.5} = 0. $$

The selected distribution equals \(q\), even though \(e(0)\ne e(1)\), because \(e\) is constant on the support of \(q\): that support contains only \(L_1=0\). In contrast, if \(q(0)=q(1)=0.5\) with the same treatment probabilities, the unnormalized weights are 0.25 and 0.10, and the selected probabilities are \(5/7\) for \(L_1=0\) and \(2/7\) for \(L_1=1\). In that case treatment probability varies on the support, so the distribution shifts.

Different Initial Treatments, Different Regime Distributions

The distribution to use in g-computation depends on the earlier treatment specified by the regime. Even if the later treatment probability function is unchanged, different initial treatments can produce different distributions of the covariate that predicts later treatment and outcome. An observed group conditioned on both treatments can therefore differ from the relevant regime distribution in more than one way.

Worked Example: Comparing Two Initial-Treatment Regimes

Continue with a hypothetical example in which \(P(L_1=1\mid A_0=0)=0.2\), while \(P(L_1=1\mid A_0=1)=0.8\). Let the probabilities of \(A_1=1\) at \(L_1=1\) and \(L_1=0\) be 0.9 and 0.3, respectively, for either initial treatment. Suppose the conditional outcome risks under \(A_1=1\) are 0.25 for \(A_0=0,L_1=1\), 0.05 for \(A_0=0,L_1=0\), and, as before, 0.40 and 0.10 for \(A_0=1\) at \(L_1=1\) and 0.

For regime \((0,1)\), g-computation uses the distribution \(P(L_1=1\mid A_0=0)=0.2\):

$$ E[Y^{0,1}] = (0.2)(0.25)+(0.8)(0.05) = 0.05+0.04 = 0.09. $$

Among people observed with \(A_0=0,A_1=1\), the unnormalized covariate weights are \((0.2)(0.9)=0.18\) for \(L_1=1\) and \((0.8)(0.3)=0.24\) for \(L_1=0\). The total is 0.42, so the selected probability of \(L_1=1\) is \(0.18/0.42=3/7\), not 0.2. Their observed mean risk is \((3/7)(0.25)+(4/7)(0.05)=0.95/7\approx0.1357\).

The regime-specific contrast \(E[Y^{1,1}]-E[Y^{0,1}]\) is \(0.34-0.09=0.25\), or 25 percentage points. The difference between the observed means among people with both treatments, \(0.3769-0.1357\approx0.2412\), is not that regime contrast. Both observed means use distributions selected by later treatment; each regime mean instead uses the covariate distribution generated by its own initial treatment.

How to Keep the Target Clear

A conditional outcome model and an averaging distribution answer different parts of the causal calculation. The model asks what outcome mean is associated with each covariate history under the specified treatment values, subject to the identification assumptions. The distribution determines how those histories are represented in the target population under the regime. Replacing the latter with the distribution among observed later-treated people changes the target.

The difference is not automatically a bias in every numerical situation: if the conditional outcome mean is constant across values whose probabilities shift, both averages can match. Nor does the fact that an observed treated-group mean differs from a g-computation mean by itself show which estimate is correct; the target estimand and assumptions determine the interpretation. The key is not to label an observed-treatment conditional mean as a regime mean without checking its averaging distribution.

Common Mistake

  • Wrong reasoning: “I fit the outcome model among people with the observed treatment and averaged their outcomes, so I have the mean under that treatment regime.” This overlooks that the observed later-treated group is selected according to \(e(l)\).
  • Correction: For a regime-specific mean, predict the outcome under the regime at each relevant covariate value and average using the covariate distribution induced by the regime. In the two-time setting, that is \(q(l)=P(L_1=l\mid A_0=a_0)\), not generally \(P(L_1=l\mid A_0=a_0,A_1=a_1)\).
  • Overstatement to avoid: “Any variation in later-treatment probability changes the covariate distribution.” It changes the distribution only if that variation occurs on the support of \(q\). Equality holds when \(e(l)\) is constant \(q\)-almost surely, assuming a positive denominator.
Key takeaway: G-computation combines regime-specific conditional outcome predictions with the covariate-history distribution induced by the regime. Conditioning on observed later treatment instead reweights histories by their chance of receiving that treatment. Those averaging distributions coincide only under the support-specific condition derived above, or in special cases where the different distributions happen to give the same outcome average.

Check Your Understanding

Use the distinction between an outcome model and its averaging distribution to answer these questions.

  1. In the two-time setup, what distribution does g-computation use to average conditional outcome predictions under regime \((a_0,a_1)\)?
  2. If \(q(0)=q(1)=0.5\), \(e(0)=0.4\), and \(e(1)=0.8\), calculate the selected probability of \(L_1=1\) among those with \(A_0=a_0,A_1=a_1\).
  3. Why can an observed mean among people who received both treatments differ from \(E[Y^{a_0,a_1}]\), even when the conditional outcome risks are correctly estimated?
  4. Suppose \(q\) assigns probability zero to every covariate value where \(e(l)\) differs from its value on the support of \(q\). Does treatment selection change the covariate distribution? Explain.
  5. Can the g-computation and observed-treatment averages be numerically equal even when their covariate distributions differ? Give a condition under which this can happen.
Clinical Biostats