Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 37 ยท Graphs and Identification

Front-Door Adjustment and the do-Operator

Understand the do-operator, the difference between seeing and doing, and how front-door adjustment identifies an effect despite an unmeasured confounder, verified by simulation in Python.

So far, identification meant adjusting for confounders you measured. What if the confounder is hidden? Sometimes a graph still allows identification through a different route. This lesson introduces the formal notation for interventions, the do-operator, and the classic front-door strategy.

Seeing versus doing

P(Y | T = t) is what you see: the distribution of Y among units that happen to have T = t. It mixes the effect of T with everything that influenced who has that value.

P(Y | do(T = t)) is what happens when you set T to t by intervention, cutting every arrow into T. It is the causal quantity.

flowchart LR
  subgraph S["Seeing: P(Y | T)"]
    U1["U"] --> T1["T"]
    U1 --> Y1["Y"]
    T1 --> Y1
  end
  subgraph D["Doing: P(Y | do(T))"]
    U2["U"] --> Y2["Y"]
    T2["T (set)"] --> Y2
  end

The intervention removes the arrow from U to T, so the backdoor path disappears.

A causal effect is identified if P(Y | do(T)) can be written using only quantities estimable from observed data. The backdoor adjustment formula is one identification result; do-calculus (Pearl) is a complete set of rules that finds all of them.

Simulating an intervention

In a simulation you can literally cut the arrow:

Python Observing versus intervening

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The two numbers differ because seeing includes the confounded path through u.

The front-door criterion

Suppose a hidden confounder U affects both smoking T and cancer Y, so backdoor adjustment is impossible. But tar deposits M in the lungs mediate all of smoking's effect:

flowchart LR
  U["U (unmeasured)"] --> T["T: smoking"]
  U --> Y["Y: outcome"]
  T --> M["M: mediator"]
  M --> Y

Conditions: (1) M intercepts all causal paths from T to Y; (2) no unblocked backdoor path from T to M; (3) all backdoor paths from M to Y are blocked by T.

Under these conditions the effect is identified in two steps, each of them unconfounded:

  1. T -> M: estimate P(M | T) directly (no backdoor path into M except through T).
  2. M -> Y: adjust for T to block the path M <- T <- U -> Y.

Then combine:

TEXT
P(Y | do(T = t)) = sum over m of  P(m | t) * sum over t' of  P(Y | m, t') * P(t')

Front-door adjustment in code

A binary version with exact probabilities. The hidden U is generated but never used by the estimator.

Python Front-door estimate without seeing the confounder

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The naive difference is inflated by U (it pushes both smoking and cancer). The front-door formula, using only T, M and Y, lands close to the true 0.32.

Using the idea in practice

  • Front-door conditions are strict; truly isolating all of an effect through one measured mediator is rare. But the idea (identify by chaining two unconfounded relationships) inspires other designs.
  • When a hidden confounder blocks adjustment, your options include instrumental variables, front-door, regression discontinuity and difference-in-differences. Each trades one assumption for another.
  • Tools such as DoWhy implement backdoor, front-door and IV identification and test refutations; they still depend on the graph you supply.

Identification is separate from estimation. Identification says whether the target can be computed from the observed distribution at all; estimation is how well you compute it from a finite sample. Settle identification first.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. P(Y | do(T = t)) differs from P(Y | T = t) because:

    An intervention sets T independently of its usual causes.
  2. 2. Front-door adjustment can identify an effect when:

    It uses T -> M and M -> Y (adjusting for T) as two unconfounded steps.
  3. 3. In the front-door formula, the step for M -> Y adjusts for T because:

    Conditioning on T closes the path through the hidden U.
  4. 4. An effect is 'identified' if:

    Identification is about whether the target can be computed from observable quantities at all.

Summary

  • do(T = t) means setting the treatment by intervention, cutting arrows into T.
  • An effect is identified if do-expressions can be rewritten in terms of observed probabilities.
  • Front-door adjustment identifies effects through a mediator even with an unmeasured confounder.
  • Different designs (IV, RD, DiD, front-door) trade different assumptions for identification.

Next: Propensity Scores