Tutorials › Causal Inference › Worked Example: Two-Visit Treatment And Confounding

Structural Nested Models and G-Estimation · Tutorial 771 of 972

Worked Example: Two-Visit Treatment And Confounding

Follow a hypothetical two-visit study from the later-treatment blip through the earlier-treatment blip, accounting for a treatment-affected intermediate confounder.

Advanced 10 min read

What You'll Learn

  • Specify a two-time additive structural nested mean model and its blip-down outcomes.
  • State the identification assumptions needed for sequential g-estimation.
  • Use history-specific treatment residuals to estimate the second-visit blip.
  • Blip down the second-visit effect before estimating the first-visit effect.
  • Explain why the intermediate variable belongs in the later-treatment equation, not the earlier-treatment history.
  • Distinguish the sequential estimates from a crude treatment-group comparison.

Why the Order of the Blip-Down Matters

When treatment is assigned at two visits, the variable measured between visits may be affected by the first treatment and may also influence both the second treatment and the outcome. It is then a treatment-affected intermediate confounder for the later treatment. A conventional adjustment that treats it as an ordinary baseline covariate can obscure the causal effect of the first treatment. Sequential g-estimation instead uses it in the later-treatment equation, removes the later-treatment effect, and then estimates the earlier-treatment effect.

The example below uses binary treatments and a continuous outcome. All numbers describe a hypothetical dataset created for illustration; they are not results from a real study. The aim is to show the sequence of calculations, not to claim that the assumptions could be confirmed from a table of observed data alone.

Model, Notation, and Assumptions

Let \(A_1\) and \(A_2\) denote treatment at visits 1 and 2, with each taking values 0 or 1. Let \(L\) be measured after \(A_1\) and before \(A_2\), and let \(Y\) be the final outcome. Let \(L_0\) denote baseline covariates; in the example there are none. Write \(H_1=L_0\) for the first-visit history and \(H_2=(L_0,A_1,L)\) for the second-visit history. The treatment probabilities are \(e_1(H_1)=P(A_1=1\mid H_1)\) and \(e_2(H_2)=P(A_2=1\mid H_2)\).

Definition: In a two-time additive structural nested mean model (SNMM), \(\psi_2\) is the constant additive blip for treatment at visit 2, and \(\psi_1\) is the constant additive blip for treatment at visit 1 after removing the visit-2 blip. The model uses the blip-down outcomes \(U_2(\psi_2)=Y-A_2\psi_2\) and \(U_1(\psi_1,\psi_2)=Y-A_2\psi_2-A_1\psi_1\). At the true blip parameters, the corresponding outcome is conditionally mean-independent of the treatment being blipped down, given that visit’s pre-treatment history.

Equivalently, the sequential conditional moment equations are

$$ E\!\left[(A_2-e_2(H_2))\{Y-A_2\psi_2\}\mid H_2\right]=0 $$

for the second visit, and

$$ E\!\left[(A_1-e_1(H_1))\{Y-A_2\psi_2-A_1\psi_1\}\mid H_1\right]=0 $$

for the first visit. In practice, these conditional moments are commonly used as estimating equations, summed over individuals. The history in the first equation includes \(L\); the history in the second does not, because \(L\) occurs after \(A_1\).

Identification and estimation require consistency, sequential exchangeability, and positivity. Consistency means each observed outcome agrees with the counterfactual outcome under the treatment actually received. Sequential exchangeability means that, given each visit’s measured pre-treatment history, treatment assignment is independent of the relevant future counterfactual outcomes. Positivity means both treatment options have positive probability at each history with support in the population. The additive blip models and treatment-probability models must also be correctly specified for the estimating procedure used. These assumptions are not established by the arithmetic below; they are stipulated for the hypothetical example.

Hypothetical Data

Suppose \(A_1\) was randomized with probability \(1/2\). The intermediate variable \(L\) is more common among those assigned \(A_1=1\), so it is affected by the first treatment. Within each \((A_1,L)\) history, the chance of \(A_2=1\) varies, and every history includes both second-visit treatment values. The table gives sample sizes and mean outcomes in each treatment cell.

\(A_1\)\(L\)\(A_2=0\), countMean \(Y\) if \(A_2=0\)\(A_2=1\), countMean \(Y\) if \(A_2=1\)
009010.03013.0
012014.06017.0
104811.81214.8
114215.89818.8

For example, the first history has 120 people, of whom 30 received \(A_2=1\); its empirical treatment probability is \(30/120=0.25\). The four empirical probabilities are \(0.25\), \(0.75\), \(0.20\), and \(0.70\), respectively. All are strictly between 0 and 1, so this table has treatment variation in every listed history. The outcomes also vary with \(L\), which makes it important to account for \(L\) when estimating the effect of \(A_2\).

Worked Example: Estimating the Visit-2 Blip

Estimate \(\psi_2\) using the empirical conditional moment equation. In each history stratum \(g=(A_1,L)\), let \(n_{1g}\) and \(n_{0g}\) be the counts receiving \(A_2=1\) and \(A_2=0\), and let \(n_g=n_{1g}+n_{0g}\). The fitted probability is \(\hat e_{2g}=n_{1g}/n_g\).

Within a stratum, summing the treatment residual times the blipped outcome gives

$$ \sum_{i\in g}(A_{2i}-\hat e_{2g})(Y_i-A_{2i}\psi_2) = \frac{n_{0g}n_{1g}}{n_g} \left\{(\bar Y_{1g}-\bar Y_{0g})-\psi_2\right\}. $$

Here \(\bar Y_{1g}\) and \(\bar Y_{0g}\) are the observed mean outcomes for \(A_2=1\) and \(A_2=0\). In each of the four strata, the observed mean difference is \(3.0\). The stratum weights \(n_{0g}n_{1g}/n_g\), in table order, are \(90(30)/120=22.5\), \(20(60)/80=15.0\), \(48(12)/60=9.6\), and \(42(98)/140=29.4\). Thus the summed equation is

$$ (22.5+15.0+9.6+29.4)(3.0-\psi_2)=0, \qquad 76.5(3.0-\psi_2)=0, \qquad \hat\psi_2=3.0. $$

The estimated visit-2 blip is an increase of 3.0 outcome units for \(A_2=1\) rather than \(A_2=0\), under this model. The weights are positive because both treatment options occur in every stratum. In a real analysis, the validity of treating these within-history contrasts as causal also depends on the stated exchangeability and model assumptions.

Blip Down, Then Estimate Visit 1

The second-visit estimate is used to remove the modeled contribution of \(A_2\) from each outcome: \(U_2=Y-3A_2\). This step matters because \(A_2\) is not assigned with the same probability across histories. In particular, the probability of later treatment depends on \(L\), which is related to the outcome and was itself affected by \(A_1\).

Worked Example: Blipping Down an Individual Outcome

Suppose a hypothetical person has \(A_1=1\), \(L=1\), \(A_2=1\), and \(Y=18.8\), the mean shown for that treatment cell. Using the estimated visit-2 blip, the outcome with the visit-2 contribution removed is

$$ U_2=Y-A_2\hat\psi_2=18.8-(1)(3.0)=15.8. $$

For a person in the same history with \(A_2=0\) and mean outcome \(15.8\), the blipped-down value is also \(15.8-(0)(3.0)=15.8\). This equality is what the fitted visit-2 blip model implies for these cell means; it is not a claim that every individual outcome is identical.

Now use \(e_1=0.5\), the randomization probability, and solve the first-visit estimating equation with \(U_2\). Do not condition this equation on \(L\): doing so would condition on a variable affected by \(A_1\), rather than use the baseline history that governed the first treatment.

Worked Example: Estimating the Visit-1 Blip

After blipping down \(A_2\), the mean \(U_2\) among those with \(A_1=0\) is

$$ \frac{120(10.0)+80(14.0)}{200} = \frac{2320}{200} = 11.6. $$

For those with \(A_1=1\), the corresponding mean is

$$ \frac{60(11.8)+140(15.8)}{200} = \frac{2920}{200} = 14.6. $$

There are 200 people in each first-treatment group. Substituting into the summed first-visit equation gives

$$ \sum_i(A_{1i}-0.5)(U_{2i}-A_{1i}\psi_1) = 0.5\{2920-200\psi_1-2320\}=0. $$

Therefore \(300-100\psi_1=0\), and \(\hat\psi_1=3.0\) outcome units. The visit-1 blip is estimated only after accounting for the visit-2 blip. In this sequential model it includes the downstream consequences of the first treatment, including pathways through \(L\); it is not a controlled direct effect that holds \(L\) fixed.

Sequential Estimation as a Procedure

1
Specify the histories and blip models.
Place each variable according to when it is measured. Here \(L\) belongs to \(H_2\), not \(H_1\), and the model assumes constant additive blips at both visits.
2
Estimate the later-treatment equation.
Model or estimate \(e_2(H_2)\), then solve the conditional moment equation for \(\psi_2\). Check that treatment variation is adequate across relevant histories.
3
Blip down the later treatment.
Construct \(U_2=Y-A_2\hat\psi_2\). This removes the fitted later-treatment contribution before the first-visit equation is used.
4
Estimate the earlier-treatment equation.
Use \(e_1(H_1)\), not a propensity conditional on the post-treatment \(L\), and solve for \(\psi_1\) using \(U_2-A_1\psi_1\).

The order is not merely bookkeeping. The later treatment can be confounded by \(L\), so the later-treatment moment needs to compare treatment assignments within histories that include \(L\). Once that later blip is removed, the earlier-treatment moment uses the earlier assignment mechanism. This lets the procedure address treatment-confounder feedback without treating a post-treatment variable as if it were a baseline confounder.

Common Mistake: Adjusting for the Intermediate Variable at Both Visits

A tempting approach is to include \(L\) in both treatment equations, or to compare the observed \(A_1\) groups within levels of \(L\) when estimating \(\psi_1\). The first-visit assignment occurred before \(L\) was measured. Since \(A_1\) affects \(L\), conditioning on \(L\) changes the comparison and can block part of the earlier treatment’s effect or induce bias. The correction is to use the pre-treatment history for each visit: include \(L\) for \(A_2\), but not for \(A_1\).

A second mistake is to interpret the raw difference in final outcomes by \(A_1\) as the sequentially estimated blip. In this table, the observed mean \(Y\) for \(A_1=0\) is \(11.6+3(0.45)=12.95\), because 90 of 200 received \(A_2=1\). For \(A_1=1\), it is \(14.6+3(0.55)=16.25\), because 110 of 200 received \(A_2=1\). The raw difference is \(16.25-12.95=3.30\), not the blip-down estimate \(3.00\). The extra \(0.30\) reflects the different proportions receiving the later treatment. Sequential estimation separates the two treatment contributions under the specified model.

Key takeaway: For two-visit g-estimation with a treatment-affected intermediate confounder, first estimate the later blip conditional on the intermediate history, subtract that blip from the outcome, and then estimate the earlier blip using only the earlier treatment’s pre-treatment history. The causal interpretation depends on exchangeability, positivity, consistency, and correct model specification.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. Why does the visit-2 treatment history include \(L\), while the visit-1 treatment history does not?
  2. For the stratum with \(A_1=0,L=1\), calculate the empirical probability of \(A_2=1\) and the weight used in the visit-2 estimating equation.
  3. What outcome is used in the visit-1 equation after the visit-2 blip has been estimated?
  4. Why is positivity relevant to the four within-history visit-2 comparisons in the example?
  5. Explain why conditioning on \(L\) in the visit-1 equation can be problematic.
Clinical Biostats