Math for Causal Inference

Day 56. Identification Algorithms & Non-Identifiable Queries

With unobserved confounders drawn as bidirected edges, a graph splits into confounded components. Tian's criterion decides at a glance whether the effect of a single treatment is identified, the c-component factorisation produces the formula, and the general ID algorithm handles everything else.

Video coming soon
Learning outcomes
  • ●Convert a DAG with latent variables into an acyclic directed mixed graph (ADMG) and find its c-components.
  • ●Apply Tian's criterion to decide whether the effect of a single treatment is identified.
  • ●Derive identification formulas from the c-component factorisation, including the front door.
  • ●Recognise non-identified designs (bow, instrument) and know the alternatives (bounds, extra assumptions, new data).
2-HOUR SESSION PLAN
Theory 25′Warm-up (1–5) 20′Proofs (6–10) 35′Applied (11–15) 25′Python & Lab 15′
Colab notebook (.ipynb) Jump to the simulator

Theory

From latent DAGs to ADMGs

If an unobserved UU has exactly two observed children, A←U→BA \leftarrow U \to B, replace it by a bidirected edge A↔BA \leftrightarrow B. More generally, the latent projection keeps the observed nodes, draws A→BA \to B when AA causes BB through latent nodes only, and A↔BA \leftrightarrow B when they share a latent ancestor through latent paths. The result is an acyclic directed mixed graph (ADMG): directed edges are causal, bidirected edges are unmeasured confounding. All identification results can be stated on the ADMG.

c-components

Two nodes are in the same c-component (confounded component, or district) if they are connected by a path made only of bidirected edges. c-components partition the observed nodes. Write SXS_X for the c-component containing XX.

The c-component factorisation

For each c-component SS, define Q[S]=P(s∣do⁡(v∖s))Q[S] = P(\mathbf s \mid \operatorname{do}(\mathbf v \setminus \mathbf s)). Tian and Pearl showed that

P(v)=∏jQ[Sj],Q[Sj]=∏i: Vi∈SjP(vi∣v1,…,vi−1),P(\mathbf v) = \prod_j Q[S_j], \qquad Q[S_j] = \prod_{i:\, V_i \in S_j} P\big(v_i \mid v_1, \dots, v_{i-1}\big),

with the variables in a topological order. So every Q[Sj]Q[S_j] is identified from observational data.

Tian's criterion (single treatment)

The interventional distribution P(v∖x∣do⁡(x))P(\mathbf v \setminus x \mid \operatorname{do}(x)) is identified if and only if there is no bidirected path from XX to any of its children; equivalently, no child of XX is in SXS_X. Then

P(v∖x∣do⁡(x))=P(v)Q[SX]∑xQ[SX].P(\mathbf v \setminus x \mid \operatorname{do}(x)) = \frac{P(\mathbf v)}{Q[S_X]}\sum_x Q[S_X].

Marginalise to get P(y∣do⁡(x))P(y \mid \operatorname{do}(x)).

Beyond the simple criterion

Tian's criterion is about all outcomes at once. A particular P(y∣do⁡(x))P(y \mid \operatorname{do}(x)) can still be identified when the criterion fails (the "napkin" graph, Exercise 10). The general ID algorithm (Shpitser & Pearl, 2006) recursively decomposes the query into c-components and either returns a formula or finds a hedge, a structure that proves non-identification. It is sound and complete, and it is implemented in software (R's causaleffect, Python's y0).

When the answer is "not identified"

Two classic non-identified designs: the bow (X→YX \to Y, X↔YX \leftrightarrow Y) and the instrument (Z→X→YZ \to X \to Y, X↔YX \leftrightarrow Y). Options:

  • add assumptions (linearity or monotonicity make the IV design work, Phase 5);
  • report bounds (Day 79);
  • run a sensitivity analysis (Day 95);
  • collect new variables or run an experiment.

Part 1 · Warm-up

Exercise 1 · Find the c-components

ADMG: A→B→C→DA \to B \to C \to D, A↔CA \leftrightarrow C, B↔DB \leftrightarrow D, E→DE \to D. List the c-components.

Show solution

Step 1. Follow bidirected edges only: A↔CA \leftrightarrow C gives {A,C}\{A, C\}; B↔DB \leftrightarrow D gives {B,D}\{B, D\}.

Step 2. EE has no bidirected edges: {E}\{E\}.

Answer: {A,C}\{A, C\}, {B,D}\{B, D\}, {E}\{E\}.

Exercise 2 · Apply Tian's criterion

Is the effect of XX identified? (a) X→YX \to Y, X↔YX \leftrightarrow Y. (b) X→M→YX \to M \to Y, X↔YX \leftrightarrow Y. (c) Z→X→YZ \to X \to Y, Z↔YZ \leftrightarrow Y. (d) X→M→YX \to M \to Y, X↔MX \leftrightarrow M.

Show solution

Step 1. (a) Child YY is in SX={X,Y}S_X = \{X, Y\}: not identified (the bow).

Step 2. (b) SX={X,Y}S_X = \{X, Y\}; child MM is not in it: identified (the front door).

Step 3. (c) SX={X}S_X = \{X\}: identified (adjust for ZZ).

Step 4. (d) SX={X,M}S_X = \{X, M\} contains the child MM: not identified.

Exercise 3 · Q factors for the front door

For the ADMG X→M→YX \to M \to Y, X↔YX \leftrightarrow Y (order X,M,YX, M, Y), write Q[{X,Y}]Q[\{X, Y\}] and Q[{M}]Q[\{M\}].

Show solution

Step 1. Q[{X,Y}]=P(x) P(y∣x,m)Q[\{X, Y\}] = P(x)\,P(y \mid x, m) (the factors for XX and YY, each given all predecessors).

Step 2. Q[{M}]=P(m∣x)Q[\{M\}] = P(m \mid x).

Step 3. Check: the product is P(x)P(m∣x)P(y∣x,m)=P(x,m,y)P(x)P(m \mid x)P(y \mid x, m) = P(x, m, y).

Exercise 4 · The instrument graph

In Z→X→YZ \to X \to Y, X↔YX \leftrightarrow Y, is P(y∣do⁡(x))P(y \mid \operatorname{do}(x)) identified nonparametrically? Is P(y∣do⁡(z))P(y \mid \operatorname{do}(z))?

Show solution

Step 1. For XX: SX={X,Y}S_X = \{X, Y\} contains the child YY: not identified.

Step 2. For ZZ: SZ={Z}S_Z = \{Z\} (no bidirected edges at ZZ): identified, and since ZZ has no parents, P(y∣do⁡(z))=P(y∣z)P(y \mid \operatorname{do}(z)) = P(y \mid z).

Answer: the intention-to-treat effect of the instrument is identified; the effect of XX needs extra assumptions (linearity, or monotonicity for a LATE).

Exercise 5 · Latent projection

Latent DAG: U1→XU_1 \to X, U1→MU_1 \to M, U2→MU_2 \to M, U2→YU_2 \to Y, X→YX \to Y, with U1,U2U_1, U_2 unobserved and MM observed. Draw the ADMG and decide whether the effect of XX on YY is identified.

Show solution

Step 1. U1U_1 has observed children X,MX, M: draw X↔MX \leftrightarrow M. U2U_2: draw M↔YM \leftrightarrow Y.

Step 2. ADMG: X→YX \to Y, X↔M↔YX \leftrightarrow M \leftrightarrow Y.

Step 3. SX={X,M,Y}S_X = \{X, M, Y\} contains the child YY: Tian's criterion fails for the full distribution P(m,y∣do⁡(x))P(m, y \mid \operatorname{do}(x)).

Step 4. But for YY alone, the back-door criterion holds with ∅\varnothing (the M-structure, Day 53): P(y∣do⁡(x))=P(y∣x)P(y \mid \operatorname{do}(x)) = P(y \mid x).

Answer: identified for YY (not for the joint with MM), which illustrates why the criterion concerns all outcomes.

Part 2 · Proofs

Exercise 6 · c-components partition the nodes

Prove that "connected by a bidirected path (or equal)" is an equivalence relation.

Show solution

Step 1. Reflexive: by definition each node is related to itself.

Step 2. Symmetric: bidirected edges have no direction, so a bidirected path from AA to BB reversed is one from BB to AA.

Step 3. Transitive: join a bidirected path from AA to BB with one from BB to CC; the result is a bidirected walk from AA to CC, which contains a bidirected path.

Step 4. Equivalence classes partition the node set. ■\blacksquare

Exercise 7 · The front door from c-components

Use the identification formula in the theory to derive the front-door formula for X→M→YX \to M \to Y, X↔YX \leftrightarrow Y.

Show solution

Step 1. SX={X,Y}S_X = \{X, Y\}, with Q[SX]=P(x)P(y∣x,m)Q[S_X] = P(x)P(y \mid x, m) (Exercise 3).

Step 2. P(v)/Q[SX]=P(m∣x)P(\mathbf v)/Q[S_X] = P(m \mid x).

Step 3. ∑xQ[SX]=∑x′P(x′)P(y∣x′,m)\sum_x Q[S_X] = \sum_{x'} P(x')P(y \mid x', m).

Step 4. Multiply: P(m,y∣do⁡(x))=P(m∣x)∑x′P(x′)P(y∣x′,m)P(m, y \mid \operatorname{do}(x)) = P(m \mid x)\sum_{x'} P(x')P(y \mid x', m).

Step 5. Sum over mm: the front-door formula (Day 54). ■\blacksquare

Exercise 8 · Why children outside the district matter

Let Q[S]=P(s∣do⁡(v∖s))Q[S] = P(\mathbf s \mid \operatorname{do}(\mathbf v \setminus \mathbf s)). Argue that if X∈SX \in S has no children in SS, then ∑xQ[S]=Q[S∖{X}]\sum_x Q[S] = Q[S \setminus \{X\}].

Show solution

Step 1. ∑xQ[S]=P(s∖x∣do⁡(v∖s))\sum_x Q[S] = P(\mathbf s \setminus x \mid \operatorname{do}(\mathbf v \setminus \mathbf s)): marginalising over xx in the intervened world.

Step 2. Q[S∖{X}]=P(s∖x∣do⁡(v∖s),do⁡(x))Q[S \setminus \{X\}] = P(\mathbf s \setminus x \mid \operatorname{do}(\mathbf v \setminus \mathbf s), \operatorname{do}(x)).

Step 3. These are equal if, in the world where v∖s\mathbf v \setminus \mathbf s is fixed, XX has no causal effect on S∖{X}\mathbf S \setminus \{X\} (Rule 3).

Step 4. Any causal path from XX starts with an edge to a child; every child is outside SS, hence in v∖s\mathbf v \setminus \mathbf s, which is fixed by intervention. So all causal paths are cut. ■\blacksquare

This is the step that fails when a child of XX shares its c-component.

Exercise 9 · No confounding at the treatment

Show that if XX has no bidirected edges, the identification formula reduces to the truncated factorisation P(v∖x∣do⁡(x))=P(v)/P(x∣pa⁡(x))P(\mathbf v \setminus x \mid \operatorname{do}(x)) = P(\mathbf v)/P(x \mid \operatorname{pa}(x)) in the Markovian case.

Show solution

Step 1. SX={X}S_X = \{X\}, so Q[SX]=P(x∣v1,…,vi−1)Q[S_X] = P(x \mid v_1, \dots, v_{i-1}), which equals P(x∣pa⁡(x))P(x \mid \operatorname{pa}(x)) in a Markovian model (Day 47).

Step 2. ∑xQ[SX]=1\sum_x Q[S_X] = 1.

Step 3. So P(v∖x∣do⁡(x))=P(v)/P(x∣pa⁡(x))P(\mathbf v \setminus x \mid \operatorname{do}(x)) = P(\mathbf v)/P(x \mid \operatorname{pa}(x)), which is the truncated factorisation (divide out XX's factor). ■\blacksquare

Exercise 10 · The napkin

In the "napkin" ADMG W→Z→X→YW \to Z \to X \to Y, W↔XW \leftrightarrow X, W↔YW \leftrightarrow Y, show that Tian's criterion fails. The ID algorithm nevertheless gives

P(y∣do⁡(x))=∑wP(x,y∣z,w)P(w)∑wP(x∣z,w)P(w)P(y \mid \operatorname{do}(x)) = \frac{\sum_w P(x, y \mid z, w)P(w)}{\sum_w P(x \mid z, w)P(w)}

(for any zz). Explain why there is no back-door or front-door set.

Show solution

Step 1. SX={W,X,Y}S_X = \{W, X, Y\} (via X↔W↔YX \leftrightarrow W \leftrightarrow Y); the child YY is in it: the criterion fails, so P(w,z,y∣do⁡(x))P(w, z, y \mid \operatorname{do}(x)) is not identified.

Step 2. Back-door paths from XX to YY: X←Z←W↔YX \leftarrow Z \leftarrow W \leftrightarrow Y (open with no conditioning) and X↔W↔YX \leftrightarrow W \leftrightarrow Y (collider at WW).

Step 3. Conditioning on WW blocks the first path but opens the collider on the second. Conditioning on ZZ blocks the first path but also opens the second, because ZZ is a descendant of the collider WW. So no set of observed variables is admissible.

Step 4. Front door: XX has the single child YY, so no mediator exists.

Answer: identification uses ZZ as a conditioning device that is then integrated out over WW: a formula no single adjustment produces. The code verifies that it equals the truth in a model with strong latent confounding, while the naive comparison and adjustment for ZZ are biased.

Part 3 · Applied

Exercise 11 · Minimum wage with unobserved local demand

Counties' minimum wage XX is set by states; local labour demand DD (unobserved) affects both state policy and teen employment YY. Teen wages WW respond to XX and affect YY; XX also affects YY directly through hours rules. Draw the ADMG and decide identifiability. What changes if XX had no direct arrow to YY?

Show solution

Step 1. ADMG: X→W→YX \to W \to Y, X→YX \to Y, X↔YX \leftrightarrow Y (via DD).

Step 2. SX={X,Y}S_X = \{X, Y\} contains the child YY: not identified.

Step 3. Without the direct arrow, the children of XX are {W}\{W\}, outside SXS_X: identified by the front door through wages.

Answer: identification hinges on whether the minimum wage can affect employment only via wages, a substantive claim to defend or reject.

Exercise 12 · Statins and frailty

Elderly patients' frailty (unobserved) affects both statin prescription XX and mortality YY. Frailty also affects adherence AA. Statins affect cholesterol CC, which affects mortality; adherence affects cholesterol. Observed: X,A,C,YX, A, C, Y. Draw the ADMG and apply Tian's criterion to the effect of prescription.

Show solution

Step 1. Directed: X→CX \to C, A→CA \to C, C→YC \to Y. Bidirected (frailty): X↔YX \leftrightarrow Y, X↔AX \leftrightarrow A, A↔YA \leftrightarrow Y.

Step 2. SX={X,A,Y}S_X = \{X, A, Y\}. Children of XX: {C}\{C\}, not in SXS_X.

Step 3. Criterion satisfied: identified, with a front-door-like formula that treats CC as the mediator and adjusts for (X,A)(X, A) in its second stage.

Answer: identified, if cholesterol is the only channel for statins' effect, which pharmacology makes debatable (statins also reduce inflammation).

Exercise 13 · Job training with an observed confounder

Graph: motivation (unobserved) affects training TT and earnings YY; prior earnings PP (observed) affects TT and YY; training affects YY. Is the effect identified? What if motivation instead affected only PP and YY?

Show solution

Step 1. First case: T↔YT \leftrightarrow Y and YY is a child of TT: not identified.

Step 2. Second case: bidirected edge P↔YP \leftrightarrow Y; ST={T}S_T = \{T\}: identified. {P}\{P\} satisfies the back-door criterion (the path T←P↔YT \leftarrow P \leftrightarrow Y is blocked at PP).

Answer: whether unobserved factors touch the treatment directly or only through observed pre-treatment variables decides everything.

Exercise 14 · A school health programme (napkin)

A family's health culture WW (observed index) affects participation in a school health programme ZZ, which affects children's exercise habits XX, which affect BMI YY. Unobserved household factors link WW with XX, and other unobserved factors link WW with YY. Is the effect of exercise on BMI identified? How would you compute it?

Show solution

Step 1. ADMG: W→Z→X→YW \to Z \to X \to Y, W↔XW \leftrightarrow X, W↔YW \leftrightarrow Y: the napkin.

Step 2. Tian's criterion fails, but the ID algorithm returns the napkin formula of Exercise 10.

Step 3. Computation: for a chosen zz, compute ∑wP(x,y∣z,w)P(w)\sum_w P(x, y \mid z, w)P(w) and divide by ∑wP(x∣z,w)P(w)\sum_w P(x \mid z, w)P(w).

Answer: identified. The formula is unusual and estimation can be noisy; a practical analyst would also check whether some simpler design applies.

Exercise 15 · When the answer is no

A ministry asks for the effect of hospital ownership type (public vs private) on patient outcomes. Patients choose hospitals partly on unrecorded health status. No mediator captures the whole effect, and no instrument is available. What can you deliver?

Show solution

Step 1. The ADMG contains the bow X→YX \to Y, X↔YX \leftrightarrow Y (after adjusting for observed covariates): not identified.

Step 2. Options: worst-case or monotone bounds on the effect (Day 79); a sensitivity analysis showing how strong unobserved selection must be to overturn the sign (Day 95).

Step 3. Better data: look for an instrument (distance to the nearest public hospital, ambulance assignment rules) or a natural experiment (ownership conversions over time, Phase 5).

Answer: be explicit that the point effect is not identified, report bounds and sensitivity, and propose a design that would identify it.

Verify in Python

import itertools
import numpy as np
import networkx as nx

def districts(nodes, bidirected):
    """c-components: connected components of the bidirected part."""
    B = nx.Graph(); B.add_nodes_from(nodes); B.add_edges_from(bidirected)
    return [sorted(c) for c in nx.connected_components(B)]

def tian_identified(directed, bidirected, x):
    nodes = {v for e in directed + bidirected for v in e} | {x}
    Sx = next(set(c) for c in districts(nodes, bidirected) if x in c)
    children = {b for a, b in directed if a == x}
    return not (children & Sx)

print("Ex 1:", districts("ABCDE", [("A", "C"), ("B", "D")]))
cases = {"bow": ([("X", "Y")], [("X", "Y")]),
         "front door": ([("X", "M"), ("M", "Y")], [("X", "Y")]),
         "adjust Z": ([("Z", "X"), ("X", "Y")], [("Z", "Y")]),
         "instrument": ([("Z", "X"), ("X", "Y")], [("X", "Y")]),
         "statins": ([("X", "C"), ("A", "C"), ("C", "Y")], [("X", "Y"), ("X", "A"), ("A", "Y")]),
         "napkin": ([("W", "Z"), ("Z", "X"), ("X", "Y")], [("W", "X"), ("W", "Y")])}
for k, (d, b) in cases.items():
    print(f"{k:11s} Tian criterion satisfied: {tian_identified(d, b, 'X')}")

# Exercise 10: the napkin formula in a random model with two latent confounders
pU1, pU2 = .5, .4
pW = np.array([[.1, .5], [.5, .9]]); pZ = np.array([.2, .8])             # pW[u1, u2], pZ[w]
pX = np.array([[.1, .8], [.3, .9]]); pY = np.array([[.1, .7], [.3, .9]])  # pX[z, u1], pY[x, u2]
b = lambda p, v: p if v else 1 - p
P = {}
for u1, u2, w, z, x, y in itertools.product((0, 1), repeat=6):
    P[w, z, x, y] = P.get((w, z, x, y), 0) + b(pU1, u1) * b(pU2, u2) * b(pW[u1, u2], w) * b(pZ[w], z) * b(pX[z, u1], x) * b(pY[x, u2], y)
m = lambda **kw: sum(v for k, v in P.items() if all(k["wzxy".index(a)] == val for a, val in kw.items()))
truth = {x: sum(b(pU2, u2) * pY[x, u2] for u2 in (0, 1)) for x in (0, 1)}
for x in (0, 1):
    napkin = [sum(m(x=x, y=1, z=z, w=w) / m(z=z, w=w) * m(w=w) for w in (0, 1)) /
              sum(m(x=x, z=z, w=w) / m(z=z, w=w) * m(w=w) for w in (0, 1)) for z in (0, 1)]
    naive = m(x=x, y=1) / m(x=x)
    adjZ = sum(m(x=x, y=1, z=z) / m(x=x, z=z) * m(z=z) for z in (0, 1))
    print(f"x={x}: truth {truth[x]:.4f}  napkin (z=0, z=1) {napkin[0]:.4f}, {napkin[1]:.4f}  naive {naive:.4f}  adjust Z {adjZ:.4f}")

Key takeaways

  • Bidirected edges encode unmeasured confounding; c-components group variables linked by it, and each c-component's factor is identified.
  • Tian's criterion: the effect of a single XX on all other variables is identified exactly when no child of XX shares its c-component.
  • The ID algorithm is complete; when it says "not identified", turn to bounds, sensitivity analysis, extra assumptions or new data.

Simulation Lab: c-Components & Tian's Criterion

Open full screen →

Toggle arrows and hidden-confounder edges; c-components and the identification verdict update live.

WZXMY
c-component of X: {X, Y}; children of X: {M}.
No child of X shares its c-component: identified. P(v | do(x)) = P(v) · Σₓ Q[S_X] / Q[S_X].
DIRECTED EDGES
BIDIRECTED EDGES (UNMEASURED CONFOUNDING)
c-components: {W} {Z} {X, Y} {M}

Switch arrows and bidirected (unmeasured-confounding) edges on and off. Nodes in the same c-component share a colour. Tian's criterion: the effect of X on all other variables is identified exactly when no child of X lies in X's c-component. The napkin shows that P(y | do(x)) for one outcome can still be identified when the criterion fails.

Day 55Day 57