Day 51. Interventions & the do-Operator
Seeing is not doing. An intervention do(X = x) replaces X's structural equation, cutting the arrows into X. The truncated factorisation turns this into a formula for the interventional distribution, which differs from ordinary conditioning whenever X has open back-door paths.
- ●Draw the mutilated graph for an intervention and write the truncated factorisation.
- ●Compute P(y | do(x)) by adjusting for the parents of X, and compare it with P(y | x).
- ●Prove that interventions leave non-descendants unchanged and that conditioning equals intervening when X has no parents.
- ●Evaluate deterministic and stochastic policy interventions in health and economics.
Theory
Intervening on a model
An intervention replaces the structural equation by the constant , leaving every other equation unchanged. The modified model is ; its graph is the mutilated graph, with all arrows into removed.
The distribution of in is written . It answers "what would happen to if we set to for everyone?"
Seeing versus doing
describes among units that happen to have . Those units may differ in other ways (they have different parents of ). describes the whole population when is set to . They coincide only when nothing that affects also affects .
The truncated factorisation
For a Markovian model, delete the factor for and plug in everywhere else:
Adjusting for the parents
Summing the truncated factorisation over everything except and the parents gives the adjustment formula
Compare with conditioning, which weights by instead of :
The difference is exactly confounding. (When the parents are unobserved, Days 52–56 look for other sets.)
Causal effects
The average causal effect of a binary is . It is the ATE of Phase 3: in an SCM, the potential outcome is computed in with unit 's disturbances (Day 59).
Stochastic (policy) interventions
Real policies rarely force on everyone; they shift its distribution, for example a subsidy that raises vaccination rates. Replacing by a new gives
Part 1 · Warm-up
Exercise 1 · Mutilated graphs
For , , , , draw and .
Show solution
Step 1. removes arrows into (, ): left with , , and isolated.
Step 2. removes : left with , , , .
Exercise 2 · Truncated factorisation
Write for the graph in Exercise 1 (ignore ).
Show solution
Step 1. Full factorisation: .
Step 2. Drop and fix :
Exercise 3 · Linear seeing versus doing
, with , . Find and .
Show solution
Step 1. Doing: 's equation is untouched, so .
Step 2. Seeing: .
Step 3. .
Answer: slope 2 for doing, 3.5 for seeing.
Exercise 4 · No parents, no difference
If has no parents (a coin flip), show using the adjustment formula.
Show solution
Step 1. With the sum has one term: .
Answer: randomisation makes parentless; that is why experiments identify causal effects.
Exercise 5 · Upstream variables do not move
In the graph of Exercise 1, is ? Is ?
Show solution
Step 1. Doing: is not a descendant of , and the truncated factorisation keeps . Summing out gives .
Step 2. Seeing: , so observing is informative about : in general .
Part 2 · Proofs
Exercise 6 · Truncated factorisation from the SCM
Prove the truncated factorisation for a Markovian SCM.
Show solution
Step 1. is again a Markovian SCM: same equations and disturbances for all , and (a constant with no parents).
Step 2. By Day 50 (Exercise 6), its distribution factorises over its graph : .
Step 3. For , the conditional distribution of given its parents comes from the same and as in , so .
Exercise 7 · The parent adjustment formula
Derive from the truncated factorisation.
Show solution
Step 1. Multiply and divide the truncated product by : for consistent with .
Step 2. Write , where is all remaining variables, including .
Step 3. So .
Step 4. Sum over and over all components of other than : .
Exercise 8 · Non-descendants are unaffected
Prove that for any set of non-descendants of , .
Show solution
Step 1. Order the variables topologically with all non-descendants of first. This is possible: no non-descendant has a descendant of as an ancestor.
Step 2. The equations of non-descendants involve only other non-descendants and their own disturbances.
Step 3. The intervention changes only 's equation, and is not an input to any non-descendant's equation (directly or indirectly).
Step 4. So the non-descendants are the same functions of the same disturbances in and : their joint distribution is unchanged.
Exercise 9 · Conditional ignorability from the SCM
In a Markovian SCM, prove that the potential outcome is independent of given .
Show solution
Step 1. In , 's equation is gone, so is a function of the disturbances other than : .
Step 2. is a function of the disturbances of its ancestors, also in .
Step 3. . Given , depends only on .
Step 4. is independent of , also after conditioning on an event defined by (the event ).
Step 5. So given , is independent of . This is Phase 3's unconfoundedness, derived from a graph.
Exercise 10 · Conditioning is a weighted adjustment
Show that , and give two conditions under which it is zero.
Show solution
Step 1. By the law of total probability, .
Step 2. Subtract the adjustment formula term by term.
Step 3. Zero if for all values ( independent of its parents, as under randomisation).
Step 4. Zero if does not depend on (the parents do not affect except through ).
Part 3 · Applied
Exercise 11 · Vaccination: seeing versus doing
Use Day 47's flu model: 30% are older; , ; infection risks young unvaccinated 0.10, young vaccinated 0.04, old unvaccinated 0.30, old vaccinated 0.12. Compute and and compare with the observed 0.077 and 0.125.
Show solution
Step 1. Age is the only parent of . Adjust: .
Step 2. .
Step 3. Causal risk ratio ; risk difference .
Answer: universal vaccination would cut the infection rate from 16% to 6.4%. The observed comparison (7.7% vs 12.5%, ratio 0.62) understates the benefit, because the vaccinated are older.
Exercise 12 · A vaccination subsidy
A subsidy raises vaccination among the young from 40% to 70%, leaving the old at 80%. Using Exercise 11's model, what infection rate does the policy produce, compared with 10% now?
Show solution
Step 1. Stochastic intervention: replace by .
Step 2. Young: .
Step 3. Old (unchanged): .
Step 4. Total: .
Answer: about 8.7% instead of 10%, a 1.3-point reduction. The policy effect depends on whom the subsidy reaches, which a single ATE does not tell you.
Exercise 13 · Fertiliser and yields
On farms, rainfall affects both fertiliser use () and yields . A regression of yields on fertiliser alone finds what slope? What is the effect of a fertiliser subsidy that raises by one unit on every farm?
Show solution
Step 1. and .
Step 2. Seeing: . Slope 3.5.
Step 3. Doing: .
Answer: the regression overstates the yield response by 75%, because farmers use more fertiliser in wet years, which are also good years.
Exercise 14 · Should hospitals close intensive care units?
20% of patients are severe. and . Death risks: mild without ICU 0.02, mild in ICU 0.01, severe without ICU 0.40, severe in ICU 0.25. Compute observed mortality with and without ICU care, and the mortality under do(ICU) and do(no ICU).
Show solution
Step 1. .
Step 2. Seeing, ICU: .
Step 3. Seeing, no ICU: .
Step 4. Doing: ; .
Answer: ICU patients die six times as often (17.6% vs 3.0%), yet giving everyone ICU care would cut mortality from 9.6% to 5.8%. Severity is a parent of both admission and death.
Exercise 15 · Seeing or doing?
Classify each question as a conditional (seeing) or interventional (doing) query: (a) "What share of microfinance borrowers start a business?"; (b) "How much would business creation rise if every household got a loan?"; (c) "Do workers who join a union earn more?"; (d) "What would happen to wages if union membership became mandatory?"; (e) "Which patients with a positive test actually have the disease?"
Show solution
Step 1. (a) Seeing: .
Step 2. (b) Doing: .
Step 3. (c) Seeing: .
Step 4. (d) Doing: .
Step 5. (e) Seeing: , a diagnostic question answered by Bayes' rule (Day 2); no intervention is involved.
Verify in Python
import numpy as np
# Exercises 11-12: vaccination
pOld = .3; pV = {"young": .4, "old": .8}
risk = {("young", 0): .10, ("young", 1): .04, ("old", 0): .30, ("old", 1): .12}
w = {"young": 1 - pOld, "old": pOld}
do = {v: sum(w[a] * risk[a, v] for a in w) for v in (0, 1)}
see = {v: sum(w[a] * (pV[a] if v else 1 - pV[a]) * risk[a, v] for a in w) / sum(w[a] * (pV[a] if v else 1 - pV[a]) for a in w) for v in (0, 1)}
print("do:", {k: round(x, 4) for k, x in do.items()}, " see:", {k: round(x, 4) for k, x in see.items()})
q = {"young": .7, "old": .8}
print("infection with subsidy:", round(sum(w[a] * (q[a] * risk[a, 1] + (1 - q[a]) * risk[a, 0]) for a in w), 4))
# Exercise 13: fertiliser, by simulation of the SCM and of the intervened SCM
rng = np.random.default_rng(51); n = 1_000_000
R = rng.normal(size=n); F = .5 * R + np.sqrt(.75) * rng.normal(size=n); Y = 2 * F + 3 * R + rng.normal(size=n)
print("observational slope:", round(np.polyfit(F, Y, 1)[0], 3))
Y1 = 2 * (F + 1) + 3 * R + rng.normal(size=n) # do(F := F + 1) for every farm
print("effect of +1 unit:", round((Y1 - Y).mean(), 3))
# Exercise 14: ICU
pS = .2; pICU = {0: .1, 1: .9}; d = {(0, 0): .02, (0, 1): .01, (1, 0): .40, (1, 1): .25} # key (severe, icu)
ws = {0: 1 - pS, 1: pS}
for icu in (0, 1):
num = sum(ws[s] * (pICU[s] if icu else 1 - pICU[s]) * d[s, icu] for s in (0, 1))
den = sum(ws[s] * (pICU[s] if icu else 1 - pICU[s]) for s in (0, 1))
print(f"ICU={icu}: seeing {num / den:.4f} doing {sum(ws[s] * d[s, icu] for s in (0, 1)):.4f}")
Key takeaways
- deletes 's equation and the arrows into ; everything else stays the same.
- With observed parents, ; conditioning instead weights by .
- Policies are often stochastic interventions: they shift rather than fix .
Simulation Lab: Seeing vs Doing: the ICU
Open full screen →ICU patients die more often, yet admitting everyone saves lives: conditional versus interventional mortality.
Severity drives both ICU admission and death. Seeing compares patients who happened to be admitted with those who were not; doing sets admission for everyone, cutting the arrow from severity into ICU (the mutilated graph) and averaging over the population's severity mix.