Tutorials › Marginal Structural Models › Common Mistake: Treating A Time-Varying Confounder As Baseline

Time-Varying Treatments and Confounder Feedback · Tutorial 29 of 501

Common Mistake: Treating A Time-Varying Confounder As Baseline

Work through a two-decision example to see how treating an intermediate confounder as baseline can change the treatment contrast being estimated.

Intermediate 10 min read

What You'll Learn

  • Distinguish baseline covariates from covariates measured after an earlier treatment
  • Trace how an intermediate covariate can affect both later treatment and outcome
  • Calculate the difference between a marginal treatment contrast and a covariate-adjusted contrast
  • See why omitting the intermediate covariate can confound a later treatment comparison
  • Use measurement timing and treatment-history summaries to diagnose a mistaken adjustment

Why the Measurement Time Matters

In a study with repeated treatment decisions, a covariate can occupy two different causal positions over time. It may be an outcome of an earlier treatment and, at the next decision, a predictor of both later treatment and the final outcome. Its later role does not erase its earlier one. Treating such a variable as if it had been measured before every treatment decision can change the question an analysis answers.

The key distinction is not merely whether a covariate is associated with treatment. It is when it was measured relative to each treatment decision. A variable measured before the first decision can be a baseline confounder. A variable measured after that decision cannot be a baseline covariate for the first treatment, even if it is essential to consider when studying a later treatment.

Definition: A baseline covariate is measured before the treatment decisions under study begin. An intermediate covariate is measured after at least one treatment decision and before a later one. In a two-decision study, write \(A_1\) for the first treatment, \(L\) for a covariate measured between decisions, \(A_2\) for the later treatment, and \(Y\) for the outcome.

The pattern of interest is \(A_1 \to L \to A_2\), with \(L\) also predicting \(Y\), and possibly \(A_1\) and \(A_2\) affecting \(Y\). Thus \(L\) can be relevant to the later treatment comparison while also lying on a pathway from the earlier treatment to the outcome. The worked calculations below isolate that tension in a small model.

A Two-Decision Example

Worked Example: One Covariate, Two Different Roles

Let \(A_1,L,A_2\) be binary. Suppose treatment and covariate values are generated as follows: \(P(A_1=1)=0.5\); \(P(L=1\mid A_1=1)=0.8\) and \(P(L=1\mid A_1=0)=0.2\); and \(P(A_2=1\mid L=1)=0.8\) and \(P(A_2=1\mid L=0)=0.2\). The outcome has conditional mean \(E[Y\mid A_1,L,A_2]=2L+3A_1+4A_2\).

This specifies a simple feedback structure: the distribution of \(L\) changes with \(A_1\), and \(L\) predicts the chance of receiving \(A_2\). The outcome mean also depends on \(L\), as well as on both treatments. We can calculate the observed mean outcome in each first-treatment group.

For \(A_1=1\), the mean of \(L\) is \(0.8\). By summing over the two possible values of \(L\), \(P(A_2=1\mid A_1=1)=0.8(0.8)+0.2(0.2)=0.68\). Therefore, \(E[Y\mid A_1=1]=2(0.8)+3+4(0.68)=1.6+3+2.72=7.32\).

For \(A_1=0\), the mean of \(L\) is \(0.2\), and \(P(A_2=1\mid A_1=0)=0.2(0.8)+0.8(0.2)=0.32\). Thus, \(E[Y\mid A_1=0]=2(0.2)+4(0.32)=0.4+1.28=1.68\). The observed first-treatment-group difference is \(7.32-1.68=5.64\).

Now consider a regression that includes \(A_1\) and \(L\), but not \(A_2\). Since \(E[A_2\mid L]=0.2+0.6L\), its conditional mean is \(E[Y\mid A_1,L]=2L+3A_1+4(0.2+0.6L)=0.8+3A_1+4.4L\). At a fixed value of \(L\), the difference between \(A_1=1\) and \(A_1=0\) is \(3\). It is not the marginal difference \(5.64\) calculated above. Conditioning on the post-\(A_1\) covariate holds fixed a variable whose distribution differs between the first-treatment groups.

In this example, \(L\) is measured after \(A_1\), so it is not a baseline covariate for that decision. Yet it helps determine \(A_2\) and predicts \(Y\). The same variable is therefore post-treatment with respect to \(A_1\) and pre-treatment with respect to \(A_2\).

What the Adjustment Changes

The calculation above is not a claim that adjustment is always wrong. It shows why the timing and target comparison must be stated. In the specified model, \(5.64\) compares the two first-treatment groups while allowing \(L\) and the later treatment process to follow their corresponding distributions. The conditional contrast of \(3\) compares the first treatments at a fixed value of \(L\). These are different comparisons.

Result: If \(E[Y\mid A_1,L]=\alpha+\beta A_1+\gamma L\), then the conditional contrast at a fixed \(L=l\) is \(\beta\). The marginal contrast is \(E[Y\mid A_1=1]-E[Y\mid A_1=0]=\beta+\gamma\{E[L\mid A_1=1]-E[L\mid A_1=0]\}\), provided the stated conditional-mean model holds.

To verify the result, take expectations of the conditional mean separately in the two groups:

$$ \begin{aligned} E[Y\mid A_1=1]&=\alpha+\beta+\gamma E[L\mid A_1=1],\\ E[Y\mid A_1=0]&=\alpha+\gamma E[L\mid A_1=0]. \end{aligned} $$

Subtracting the second expression from the first gives the displayed marginal contrast. In the example, \(\beta=3\), \(\gamma=4.4\), and the difference in mean \(L\) is \(0.8-0.2=0.6\). Hence the marginal contrast is \(3+4.4(0.6)=3+2.64=5.64\), matching the direct calculation. The adjustment did not simply “control confounding” for the first treatment; it removed the contribution associated with the changed distribution of \(L\).

Worked Example: The Intermediate Covariate and the Later Treatment

In the same model, compare the observed outcome means for \(A_2=1\) and \(A_2=0\). First find the joint probabilities for \(A_1\) and \(L\): \(P(A_1=1,L=1)=0.5(0.8)=0.4\), while \(P(A_1=0,L=1)=0.5(0.2)=0.1\). Since \(P(L=1)=0.5\), this gives \(P(A_1=1\mid L=1)=0.4/0.5=0.8\). Similarly, \(P(A_1=1,L=0)=0.1\), so \(P(A_1=1\mid L=0)=0.1/0.5=0.2\).

The treatment rule gives \(P(A_2=1)=0.5(0.8)+0.5(0.2)=0.5\). Bayes’ rule then gives \(P(L=1\mid A_2=1)=0.8\) and \(P(L=1\mid A_2=0)=0.2\). For those receiving \(A_2=1\), the mean outcome when \(L=1\) is \(2+3(0.8)+4=8.4\), and when \(L=0\) it is \(3(0.2)+4=4.6\). Thus \(E[Y\mid A_2=1]=0.8(8.4)+0.2(4.6)=6.72+0.92=7.64\).

For \(A_2=0\), the mean when \(L=1\) is \(2+3(0.8)=4.4\), and when \(L=0\) it is \(3(0.2)=0.6\). Therefore \(E[Y\mid A_2=0]=0.2(4.4)+0.8(0.6)=0.88+0.48=1.36\). The observed later-treatment difference is \(7.64-1.36=6.28\), not \(4\), the coefficient of \(A_2\) in the outcome model. The later-treatment groups have different distributions of \(L\) and \(A_1\).

In this model, conditioning on both \(L\) and \(A_1\) makes the conditional mean difference for \(A_2\) equal to \(4\), because the specified conditional mean is \(2L+3A_1+4A_2\). That fact is specific to this example and model. Its purpose is to show why the later decision has a different adjustment problem from the earlier one: \(L\) is observed before \(A_2\), but after \(A_1\).

A Useful Decomposition

Worked Example: Checking the First-Treatment Difference

In the first-treatment contrast, the change in \(L\) contributes \(2(0.8-0.2)=1.2\) through the \(2L\) term in the outcome mean. It also changes the average probability of later treatment: \(P(A_2=1\mid A_1=1)-P(A_2=1\mid A_1=0)=0.68-0.32=0.36\). The corresponding difference in the \(4A_2\) contribution is \(4(0.36)=1.44\). The direct \(3A_1\) contribution is \(3\). Adding all three pieces gives \(3+1.2+1.44=5.64\), the same as \(7.32-1.68\).

This arithmetic makes the mistake visible: fixing \(L\) while comparing \(A_1\) groups discards the part of the contrast associated with the groups’ different \(L\) distributions. In a more complex setting, the pieces need not be this simple or additive, but the timing issue remains.

Assumptions, Checks, and Alternatives

The calculations require only the probability rules and conditional-mean model stated for this constructed example. They do not, by themselves, establish that a regression adjustment identifies a causal effect in an observational study. For that interpretation, the study design and assumptions must support the relevant comparisons. The lesson here is narrower: a covariate’s position in time determines whether it can be treated as baseline for a given decision.

Before fitting a model, draw a timeline and place measurements on it. Check that \(L\) was recorded after \(A_1\) and before \(A_2\), rather than relying on a database column’s label or visit number. Then ask separately for each decision: which variables were known before treatment was assigned, and which may already have been changed by earlier treatment? An analysis that silently uses \(L\) as a pre-\(A_1\) variable has misrepresented the observed sequence.

Useful warning signs include a description of “baseline adjustment” that includes measurements collected after treatment began; treatment models for \(A_1\) that condition on \(L\); and an \(A_1\) coefficient interpreted as a total contrast even though \(L\) is held fixed. Also check whether treatment probabilities or outcome summaries vary across levels of \(L\). Such variation does not prove bias, but it can reveal that the covariate is relevant to the later decision and that a baseline-only description is incomplete.

A baseline-only regression leaves the later treatment decision unexplained when \(L\) predicts \(A_2\). A regression that conditions on \(L\) for every treatment decision can instead hold fixed a post-\(A_1\) variable when comparing \(A_1\). Visit-specific adjustment makes the timing explicit, but with feedback it does not automatically resolve every inferential problem. Marginal structural models are one approach developed for this setting; their weighting and identification details require additional assumptions and are not established by this example.

Use of \(L\)Temporal statusQuestion to ask
Adjustment for \(A_1\)Measured after \(A_1\)Would fixing \(L\) change the first-treatment comparison?
Adjustment for \(A_2\)Measured before \(A_2\)Does \(L\) help explain later treatment assignment and outcome?
Baseline-only analysisIgnores intermediate historyDoes it omit information relevant to the later decision?

A common mistake is to reason, “\(L\) predicts treatment and outcome, so it is a confounder; adjust for it as a baseline variable in every treatment comparison.” The correction is to specify the decision being analyzed and locate \(L\) relative to that decision. It may be a pre-treatment covariate for \(A_2\), yet a post-treatment variable for \(A_1\). Its role cannot be assigned once and carried unchanged across the entire study.

Key takeaway: An intermediate covariate is not baseline merely because it is measured before a later treatment. Record its timing relative to each decision: it can be downstream of an earlier treatment and a predictor of a later one at the same time.

Check Your Understanding

Answer each question using the timing distinction developed above. Short solutions follow the questions.

  1. A covariate is measured after \(A_1\) and before \(A_2\). Is it baseline for the \(A_1\) decision, for the \(A_2\) decision, or both?
  2. In the worked model, calculate the difference in mean \(L\) between the \(A_1=1\) and \(A_1=0\) groups. How much does the \(\gamma L\) part of the conditional mean contribute to their marginal contrast?
  3. Why does the regression of \(Y\) on \(A_1\) and \(L\) have an \(A_1\) contrast of \(3\) in the example, while the marginal contrast is \(5.64\)?
  4. What feature of the example makes \(L\) relevant to the \(A_2\) decision?
  5. Give one diagnostic question to ask before labeling an adjustment set “baseline.”

Solutions. (1) It is not baseline for \(A_1\), because it is measured after that decision; it is measured before \(A_2\). (2) The difference is \(0.8-0.2=0.6\), so the contribution is \(4.4(0.6)=2.64\). (3) Conditioning on \(L\) compares \(A_1\) values at a fixed \(L\); the marginal comparison also includes the changed distribution of \(L\), giving \(3+2.64=5.64\). (4) The assignment rule has \(P(A_2=1\mid L=1)=0.8\) and \(P(A_2=1\mid L=0)=0.2\). (5) Check whether every included variable was measured before the particular treatment decision being analyzed.

Clinical Biostats