Day 72. Triple Differences & Changes-in-Changes
Two extensions of DiD. Triple differences add a within-state comparison group that is not targeted by the policy, so state-specific shocks cancel. Changes-in-changes drops additivity altogether and maps ranks across distributions, giving effects on whole outcome distributions that do not depend on the outcome's scale.
- ●Compute a triple-difference estimate and state the single parallel-trends assumption it needs.
- ●Write the fully interacted DDD regression.
- ●Derive the changes-in-changes counterfactual distribution and compute it by rank matching.
- ●Choose between DiD, DDD and CiC in labour and health applications.
Theory
Triple differences
DiD fails if the treated state has its own shock in the post period. If the policy targets a subgroup (married women of child-bearing age; low-income adults), we can use an untargeted subgroup in the same states to absorb state shocks:
where index treated and control states, the affected and unaffected subgroups, and the before–after change.
Assumption: the bias of the DiD (non-parallel trends) is the same for the two subgroups. DDD does not need two separate parallel-trends assumptions; it needs only that the difference between subgroups would have evolved in parallel across states (Olden and Møen).
Regression: a saturated regression with state-group, period and subgroup indicators and all their interactions; the coefficient on the triple interaction is the DDD.
Changes-in-changes (Athey and Imbens)
DiD assumes additivity: the counterfactual shift is the same in levels for everyone. CiC instead assumes
- untreated outcomes are with strictly increasing in an unobserved "rank" ;
- the distribution of within each group does not change over time (it may differ between groups).
Then a treated unit at rank in its group's pre-period distribution would have the outcome of the control-group rank that the same maps to. The counterfactual distribution of the treated in the post period is
where is the observed distribution in group , period . Equivalently, the counterfactual for a treated pre-period outcome is : find 's rank among control units before, then the control outcome at that rank after.
Why CiC
CiC gives quantile treatment effects (effects at the median, at the 10th percentile), not just a mean, and is invariant to monotone transformations of the outcome: levels and logs give the same answer, resolving Day 67's scale problem. It requires continuous outcomes (or bounds for discrete ones) and support overlap.
Part 1 · Warm-up
Exercise 1 · A triple difference
Changes in log wages (%), before and after a state mandated maternity benefits: treated state, married women 20–40: −5; treated state, others: −1; control states, married women 20–40: +1; control states, others: +2. Compute the DiD for each group and the DDD.
Show solution
Step 1. Affected group DiD: .
Step 2. Unaffected group DiD: .
Step 3. DDD: .
Answer: −3%: the mandate's cost was partly shifted to targeted workers' wages. The DiD for the affected group alone (−6) includes a state-wide shock of −3.
Exercise 2 · The regression coefficient
In the saturated DDD regression, which coefficient is the DDD, and what do the two-way interactions absorb?
Show solution
Step 1. The coefficient on .
Step 2. absorbs state-wide shocks; absorbs nationwide trends for the targeted group; absorbs permanent differences.
Exercise 3 · What DDD buys
Give an example of a shock DiD cannot handle but DDD can, and one DDD cannot handle.
Show solution
Step 1. Handled: a recession hitting the treated state at the same time as the mandate, affecting all workers in the state equally.
Step 2. Not handled: a second policy in the treated state at the same time that also targets married women (for example a child-care subsidy).
Exercise 4 · One CiC counterfactual
Control-group outcomes before: 5, 8, 12, 15; after: 6, 10, 15, 20. A treated unit had 12 before. Using ranks, what is its counterfactual post-period outcome? What does DiD's additive shift imply?
Show solution
Step 1. Rank of 12 among controls before: third of four ().
Step 2. Control outcome at the same rank after: 15.
Step 3. CiC counterfactual: 15. DiD shift: control mean rises from 10 to 12.75 (+2.75), so DiD predicts .
Answer: CiC lets the change depend on the rank: higher-ranked units gained more.
Exercise 5 · Logs or levels?
Why does CiC give the same estimated effects (after transformation) whether the outcome is wages or log wages?
Show solution
Step 1. CiC uses only ranks and quantiles; a strictly increasing transformation preserves ranks.
Answer: the counterfactual of is the log of the counterfactual of (Exercise 9).
Part 2 · Proofs
Exercise 6 · DDD removes common bias
Let each subgroup DiD equal , where is its parallel-trends bias, with for the unaffected subgroup. Show if .
Show solution
Step 1. .
Step 2. With : .
Exercise 7 · The triple interaction
Show that in the saturated regression with all main effects and interactions of (treated state), (post) and (affected), the coefficient on is the DDD of cell means.
Show solution
Step 1. Eight cells and eight parameters: fitted values equal cell means.
Step 2. Within , the coefficients on plus ( times) the triple interaction give the DiD for subgroup .
Step 3. Subtracting the DiD from the DiD leaves the triple-interaction coefficient.
Exercise 8 · The CiC counterfactual
Assume , strictly increasing in , and has the same distribution in both periods. Prove (continuous distributions).
Show solution
Step 1. Controls: .
Step 2. So and ; hence .
Step 3. Treated in period 1 without treatment: .
Step 4. Since is stable, this equals .
Exercise 9 · Invariance to monotone transformations
Let be strictly increasing and apply CiC to . Show the counterfactual for a treated pre-period value becomes .
Show solution
Step 1. The distribution of satisfies and .
Step 2. Counterfactual for : .
Exercise 10 · When CiC equals DiD
Suppose (an additive time shift). Show the CiC counterfactual mean equals the DiD counterfactual.
Show solution
Step 1. Controls' distribution shifts by : .
Step 2. Each treated unit's counterfactual is its pre-period outcome plus ; averaging gives .
Step 3. That is the DiD counterfactual.
Part 3 · Applied
Exercise 11 · Mandated maternity benefits
Exercise 1's numbers resemble Gruber's study of state maternity mandates. Interpret the DDD of −3% for workers and employers.
Show solution
Step 1. Married women of child-bearing age, the group whose expected health costs rose, saw relative wage declines of 3%.
Step 2. Unaffected workers in the same states absorb the state-wide shock (−3% in the DiD for others).
Answer: employers shifted most of the mandate's cost onto targeted workers' wages, with little employment change: incidence on workers.
Exercise 12 · Medicaid expansion by income
Change in uninsured rate (points): expansion states, low-income adults −9; high-income adults −2. Non-expansion states: low-income −4; high-income −1. Compute the DDD and give its assumption.
Show solution
Step 1. Low-income DiD: .
Step 2. High-income DiD: .
Step 3. DDD: points.
Answer: expansion cut low-income uninsurance by 4 points; assumption: absent expansion, the low–high income gap in uninsurance would have evolved the same way in both sets of states. (If high-income adults also benefited, through spillovers, the DDD understates the effect.)
Exercise 13 · Distributional effects of a training programme
In the simulation below, training raises earnings by more for workers with high latent earnings capacity. Compare the DiD estimate with CiC quantile effects at the 10th, 50th and 90th percentiles.
Show solution
Step 1. DiD gives one number (the average effect).
Step 2. CiC maps each treated unit's pre-period rank through the control group's distributions to build the counterfactual distribution, then compares quantiles.
Step 3. The code shows quantile effects rising from slightly negative at the 10th percentile to large at the 90th, close to the simulated truth.
Step 4. DiD (about 2.8) also overstates the mean effect (about 1.8), because untreated earnings grow multiplicatively, so additive parallel trends fail; CiC's mean effect (1.7) is close.
Answer: CiC reveals that the programme helps those with high earnings capacity and may slightly hurt those at the bottom, information a mean DiD hides.
Exercise 14 · A threat to DDD
In Exercise 12, expansion states also launched an outreach campaign for low-income families in the same year. What happens to the DDD?
Show solution
Step 1. The campaign affects the same state × group × period cell as the expansion.
Answer: DDD attributes the campaign's effect to the expansion; it cannot separate policies that coincide in all three dimensions.
Exercise 15 · Which design?
Choose DiD, DDD or CiC: (a) a hospital-quality programme in one region, with a coinciding regional recession that affects all hospitals; patients' conditions not targeted are also observed. (b) A minimum-wage increase whose effect on the whole wage distribution is of interest. (c) A national school-meals expansion compared with a neighbouring country, with no subgroup structure.
Show solution
Step 1. (a) DDD: compare targeted with untargeted conditions within region to remove the recession.
Step 2. (b) CiC (or distributional DiD) for quantile effects.
Step 3. (c) DiD, after checking pre-trends and scale.
Verify in Python
import numpy as np
# Exercises 1 and 12
ddd = lambda tA, cA, tB, cB: (tA - cA) - (tB - cB)
print("maternity DDD:", ddd(-5, 1, -1, 2), " Medicaid DDD:", ddd(-9, -4, -2, -1))
# Exercise 4: one CiC counterfactual
c0 = np.array([5, 8, 12, 15.]); c1 = np.array([6, 10, 15, 20.])
q = (c0 <= 12).mean(); print("rank", q, "-> counterfactual", np.quantile(c1, q, method="inverted_cdf"), " DiD:", 12 + c1.mean() - c0.mean())
# Exercise 13: changes-in-changes on simulated earnings
rng = np.random.default_rng(72); n = 20_000
U0, U1 = rng.normal(0, 1, n), rng.normal(.5, 1, n) # controls, treated (different rank distributions)
h = lambda u, t: np.exp(2.5 + .4 * u + .15 * t * (1 + .3 * u)) # nonlinear, increasing in u
y00, y01 = h(U0, 0), h(rng.normal(0, 1, n), 1) # controls before / after (fresh draws, same distribution)
y10 = h(U1, 0); U1b = rng.normal(.5, 1, n)
y11_0 = h(U1b, 1); y11 = y11_0 * (1 + .05 + .1 * (U1b - .5)) # treated after, effect grows with u
cf = np.quantile(y01, np.searchsorted(np.sort(y00), y10) / n) # CiC counterfactuals for treated pre-period units
did = y11.mean() - (y10.mean() + y01.mean() - y00.mean())
print(f"DiD {did:.2f} CiC mean effect {y11.mean() - cf.mean():.2f} true mean effect {(y11 - y11_0).mean():.2f}")
for p in (.1, .5, .9):
print(f"q{int(p * 100)}: CiC {np.quantile(y11, p) - np.quantile(cf, p):.2f} truth {np.quantile(y11, p) - np.quantile(y11_0, p):.2f}")
Key takeaways
- DDD subtracts the DiD of an untargeted subgroup in the same states; it needs only that their difference would have trended in parallel.
- CiC replaces additive parallel trends with stable rank distributions, giving quantile effects and scale invariance.
- Neither can separate policies that coincide in every dimension used for comparison.
Simulation Lab: Triple Differences
Open full screen →A state shock biases DiD for the targeted group; subtracting other workers in the same state removes it.
Changes in log wages (%) before and after a state mandate that raises costs of employing married women aged 20–40 (the affected group). A state-wide shock hits everyone in the treated state; a national trend hits the affected group everywhere. DiD for the affected group picks up the state shock; DDD subtracts it using other workers in the same state. Only a shock specific to the treated state and the affected group (the violation) biases DDD.