Tutorials › Marginal Structural Models › Conditioning on Past and Future Covariates

Causal Diagrams for Longitudinal Data · Tutorial 71 of 501

Conditioning on Past and Future Covariates

See why a covariate’s timing and position in the causal graph determine whether conditioning blocks a noncausal path, removes part of a treatment effect, or opens another path.

Intermediate 11 min read

What You'll Learn

  • Apply the d-separation path rule to covariates measured before and after treatment.
  • Identify when conditioning on a baseline covariate blocks a backdoor path.
  • Explain how conditioning on a post-treatment covariate can block part of a total-effect pathway.
  • Recognize that a covariate can be post-treatment for one exposure and pre-treatment for a later one.
  • Audit a proposed conditioning set for blocked and newly active paths.
  • Distinguish graphical path analysis from a claim about a particular causal estimand.

Why Timing Changes the Consequences of Conditioning

A covariate measured before a treatment can be a common cause of treatment and outcome. Conditioning on it may block a noncausal path and help control confounding. A covariate measured after treatment has a different possible role: it may lie on a causal pathway from treatment to outcome. Conditioning on it can then block part of the treatment’s effect. It can also change whether other paths are open or blocked, depending on the graph.

The key question is not whether a variable is called a “covariate,” or even simply whether it was measured before or after a treatment. The question is where it sits in the directed acyclic graph (DAG), relative to the exposure, outcome, and other causes. In longitudinal data, the same covariate can be post-treatment for an earlier exposure and pre-treatment for a later one.

Definition: A path between two nodes in a DAG is any sequence of adjacent nodes connecting them, regardless of arrow direction. An internal node on a path is a collider if both arrows on that path point into it; otherwise it is a noncollider. Given a conditioning set \(Z\), a path is active if every noncollider on it is outside \(Z\), and every collider on it either is in \(Z\) or has a descendant in \(Z\). Conditioning blocks a path if the path is not active. Two nodes are d-separated given \(Z\) when every path between them is blocked.

Under the DAG Markov property, d-separation implies conditional independence. The converse requires an additional faithfulness assumption; an active path does not guarantee an observed association if effects cancel or parameters happen to produce independence. These graph rules describe how conditioning changes paths, not by themselves whether a causal effect is identified.

Before Treatment: Blocking a Backdoor Path

Consider a baseline covariate \(L_0\), measured before treatment \(A_0\), and an outcome \(Y\). Suppose the graph contains \(L_0 \to A_0\) and \(L_0 \to Y\). The path \(A_0 \leftarrow L_0 \to Y\) is a fork: \(L_0\) is a noncollider on the path. Without conditioning on \(L_0\), the path is active. Conditioning on \(L_0\) blocks it. If the graph also contains \(A_0 \to Y\), that directed path remains active when conditioning on \(L_0\), because \(L_0\) is not on it.

Result: If the only path under consideration between \(A_0\) and \(Y\) is the fork \(A_0 \leftarrow L_0 \to Y\), conditioning on \(L_0\) blocks that path. If a separate directed path \(A_0 \to Y\) is present, conditioning on \(L_0\) does not block that directed path.

Justification. On the fork, \(L_0\) is an internal noncollider. The path-activity rule says that a path containing a conditioned noncollider is blocked. The directed path \(A_0 \to Y\) contains no \(L_0\), so conditioning on \(L_0\) does not change its activity. This conclusion concerns these specified paths: other paths in a larger DAG must be checked separately. \(\square\)

Worked Example: Adjusting for a Baseline Common Cause

Let \(L_0\) be binary with \(P(L_0=1)=0.5\). Treatment probabilities are \(P(A_0=1\mid L_0=1)=0.8\) and \(P(A_0=1\mid L_0=0)=0.2\). Suppose the outcome risks satisfy \(P(Y=1\mid A_0=a,L_0=l)=0.1+0.4a+0.2l\). All four risks are between zero and one.

First find the covariate distribution in each treatment group. The treatment probability is \(P(A_0=1)=0.5(0.8)+0.5(0.2)=0.5\). Thus \(P(L_0=1\mid A_0=1)=0.5(0.8)/0.5=0.8\). Likewise, \(P(A_0=0)=0.5\) and \(P(L_0=1\mid A_0=0)=0.5(0.2)/0.5=0.2\).

The unadjusted treated risk is \(0.8(0.1+0.4+0.2)+0.2(0.1+0.4)=0.8(0.7)+0.2(0.5)=0.66\). The unadjusted untreated risk is \(0.2(0.1+0.2)+0.8(0.1)=0.2(0.3)+0.8(0.1)=0.14\). The crude risk difference is \(0.66-0.14=0.52\).

Within either level of \(L_0\), the treatment risk difference is \(0.4\): for \(L_0=0\), it is \(0.5-0.1=0.4\); for \(L_0=1\), it is \(0.7-0.3=0.4\). The discrepancy between the crude difference, \(0.52\), and the within-stratum difference, \(0.4\), is consistent with the graph’s open backdoor path and the different covariate distributions across treatment groups. In this model the covariate is a common cause, and conditioning removes that path.

After an Earlier Treatment: Conditioning Can Block a Causal Path

Now consider \(A_0 \to L_1 \to Y\), where \(L_1\) is measured after \(A_0\). The path through \(L_1\) is directed from treatment to outcome. Since \(L_1\) is a noncollider on this path, conditioning on \(L_1\) blocks it. If the aim is the total effect of \(A_0\) on \(Y\), which includes effects transmitted through \(L_1\), conditioning on \(L_1\) removes part of the pathway relevant to that estimand.

Result: On the directed chain \(A_0 \to L_1 \to Y\), conditioning on \(L_1\) blocks the chain. If a separate path \(A_0 \to Y\) is present, that path is not blocked by conditioning on \(L_1\). Whether the resulting contrast answers a causal question depends on the target estimand and on the rest of the graph.

Justification. The internal node \(L_1\) on the chain is a noncollider. Once it is conditioned on, the path-activity rule makes the chain inactive. A path \(A_0 \to Y\) does not contain \(L_1\), so its activity is unaffected by this conditioning. Thus conditioning can remove the mediated route while leaving a direct route open; it does not, from the graph alone, specify the numerical effect remaining. \(\square\)

Worked Example: Conditioning on a Post-Treatment Intermediate

Suppose \(A_0\) is randomized with \(P(A_0=1)=0.5\). A post-treatment variable \(L_1\) has probabilities \(P(L_1=1\mid A_0=1)=0.8\) and \(P(L_1=1\mid A_0=0)=0.2\). Let the outcome risk be \(P(Y=1\mid A_0=a,L_1=l)=0.1+0.2a+0.4l\). The risks are \(0.1, 0.5, 0.3,\) and \(0.7\) for \((a,l)=(0,0),(0,1),(1,0),(1,1)\), respectively.

For \(A_0=0\), the marginal outcome risk is \(0.2(0.5)+0.8(0.1)=0.18\). For \(A_0=1\), it is \(0.8(0.7)+0.2(0.3)=0.62\). The total risk difference is therefore \(0.62-0.18=0.44\).

At either fixed value of \(L_1\), the treatment contrast is \(0.2\): when \(L_1=0\), \(0.3-0.1=0.2\); when \(L_1=1\), \(0.7-0.5=0.2\). The total difference \(0.44\) includes the change in the distribution of \(L_1\) caused by treatment. Comparing outcomes conditional on \(L_1\) instead holds that post-treatment variable fixed and removes the pathway through which its distribution changes. The numerical distinction illustrates why “adjust for every measured covariate” is not a general rule for estimating a total effect.

A Covariate Can Be Post-Treatment and Still Confound a Later Treatment

In a longitudinal study, \(L_1\) can be affected by \(A_0\), yet occur before a later treatment \(A_1\). If \(L_1\) also affects \(Y\), it may be a common cause of \(A_1\) and \(Y\). For the later treatment, the path \(A_1 \leftarrow L_1 \to Y\) is a backdoor path, and conditioning on \(L_1\) blocks it. But \(L_1\) is still post-treatment for \(A_0\), so conditioning on it when comparing earlier treatment histories can block paths from \(A_0\) through \(L_1\). There is no contradiction: the relevant exposure and estimand differ.

Worked Example: The Same Covariate at Two Treatment Times

Let \(A_0\) be randomized, and suppose \(P(L_1=1\mid A_0=1)=0.8\) and \(P(L_1=1\mid A_0=0)=0.2\). Marginally \(P(L_1=1)=0.5(0.8)+0.5(0.2)=0.5\). Let \(P(A_1=1\mid L_1=1)=0.8\) and \(P(A_1=1\mid L_1=0)=0.2\). Assume the outcome risk is \(P(Y=1\mid A_1=a,L_1=l)=0.1+0.4a+0.2l\).

For the later treatment, the distribution of \(L_1\) differs by \(A_1\): \(P(A_1=1)=0.5(0.8)+0.5(0.2)=0.5\), so \(P(L_1=1\mid A_1=1)=0.5(0.8)/0.5=0.8\). Similarly \(P(L_1=1\mid A_1=0)=0.2\).

The observed risk among those with \(A_1=1\) is \(0.8(0.7)+0.2(0.5)=0.66\). Among those with \(A_1=0\), it is \(0.2(0.3)+0.8(0.1)=0.14\). Their crude risk difference is \(0.52\). Within either level of \(L_1\), the risk difference for \(A_1\) is \(0.4\). Thus \(L_1\) confounds the crude comparison of the later treatment in this specified graph. Yet \(L_1\) is affected by \(A_0\). Conditioning on it to address the \(A_1\) comparison must not be confused with an automatic adjustment rule for the total effect of \(A_0\).

Path Audits, Diagnostics, and Limits

A useful audit records, for each conditioning variable, its timing relative to each treatment and its role on each relevant path. For every candidate adjustment set, list the paths between the exposure and outcome, then mark the internal nodes as colliders or noncolliders. Apply the path-activity rule after conditioning. This prevents a timing label such as “baseline” or “time-varying” from replacing the actual graphical argument.

1
Name the exposure and estimand.
State whether the question concerns an earlier treatment, a later treatment, a total effect, or another contrast. The same conditioning choice can have different consequences for different questions.
2
Place the covariate in time.
Check whether it precedes the exposure of interest, follows it, or lies between repeated treatment times.
3
Trace the paths.
Identify common-cause paths, directed paths from treatment to outcome, and paths containing colliders. Recheck the active paths after conditioning.
4
Check the assumptions separately.
A blocked path in a proposed DAG does not establish that the DAG is correct, that all relevant causes were measured, or that the causal effect is identified under the study’s assumptions.

Conditioning can also open a path. For example, in \(A_0 \to C \leftarrow U \to Y\), \(C\) is a collider. The path is blocked when \(C\) is not conditioned on, but becomes active when \(C\) is conditioned on. A descendant of \(C\) can also activate the path if conditioned on. This is why a covariate’s post-treatment timing alone cannot tell you whether conditioning is safe. The detailed consequences of collider conditioning require a separate analysis.

The main alternatives are not interchangeable adjustment recipes. One can use a graphical audit to decide whether a proposed adjustment set blocks the paths of concern; one can also state a causal estimand and assess the assumptions required for its identification. In longitudinal settings, methods such as marginal structural models address settings where treatment-confounder feedback makes simple adjustment inadequate, but their use does not remove the need to specify the time ordering and causal question. No method can recover information absent from the data or repair a materially incorrect causal graph.

Common Pitfalls

  • “It was measured before the outcome, so adjust for it.” Measurement before \(Y\) does not establish that a variable is a confounder. Determine its arrows and its role on paths.
  • “It is post-treatment, so never condition on it.” A post-treatment variable for \(A_0\) may be a pre-treatment confounder for \(A_1\). Identify which treatment is under study.
  • “Conditioning removes confounding without changing the effect.” Conditioning on a noncollider on a causal path blocks that path too. The resulting contrast may not be the total effect.
  • “Every open path creates bias.” An active path indicates the graph does not d-separate the nodes. An association need not appear if effects cancel; causal interpretation also requires appropriate assumptions.
  • “The variable name determines the answer.” Labels such as “confounder,” “mediator,” or “baseline covariate” are not substitutes for a time-indexed DAG and a stated estimand.
Key takeaway: Conditioning acts on paths, not on variable labels. A pre-treatment common cause can be a useful adjustment variable; a post-treatment noncollider can lie on and block part of an earlier treatment’s causal pathway; and that same post-treatment variable can be a confounder for a later treatment. Trace the graph separately for each exposure and estimand.

Check Your Understanding

For each question, identify the relevant path change and compare your reasoning with the solutions.

  1. In \(A \leftarrow L \to Y\), what happens to the path when conditioning on \(L\)?
  2. In \(A \to M \to Y\), what happens to this path when conditioning on \(M\), and why might that matter for a total effect?
  3. In \(A_0 \to L_1 \to A_1\) and \(L_1 \to Y\), why might \(L_1\) be relevant to an analysis of \(A_1\) but not an automatic adjustment choice for the total effect of \(A_0\)?
  4. In \(A \to C \leftarrow U \to Y\), is the path through \(C\) active before and after conditioning on \(C\)?

Solutions. (1) \(L\) is a noncollider on the fork; conditioning on it blocks that path. (2) \(M\) is a noncollider on the directed chain, so conditioning on \(M\) blocks the chain and removes that route from the total effect. (3) \(L_1\) is before \(A_1\) and can be a common cause of \(A_1\) and \(Y\), so it can block a backdoor path for the later treatment. It is after \(A_0\), however, and conditioning on it can block a path through which \(A_0\) affects \(Y\). (4) The path is blocked when \(C\) is unconditioned because \(C\) is a collider; conditioning on \(C\) activates it, since the collider is then in the conditioning set.

Clinical Biostats