From ATE to CATE — and why heterogeneity matters
Does mining help or hurt local development? The headline answer is an ATE
— a single number, averaged over every district in the sample. But the post's central
claim is sharper: the effect of mining on nighttime lights is not the same
everywhere. It depends on institutional quality. Stata 19's
cate command lets us trace this dependence as a function
τ(x) — the Conditional Average Treatment Effect.
This app lets you turn the dials yourself. In four tabs you will: visualise the ATE → GATE → CATE → IATE hierarchy with a small animation; explore the actual GATE estimates from the post's six binary contrasts; simulate how institutional moderation can flip findings depending on the DGP; and audit the §7 ATE table against the known ground truth.
One ATE, many CATEs — a chalkboard view
The animation below contrasts a constant treatment effect (steel-blue line, every unit gets the same lift) with a conditional treatment effect (orange curve, τ varies with institutional quality x). When the orange curve is flat, ATE = CATE = GATE for every group. When it slopes, the post's institutional-moderation finding becomes visible.
GATE Explorer
Six GATE estimates from the post. Pick a contrast (NTL 1v0, NTL 3v1, Conflict 1v0…) and a grouping variable (executive constraints or quality of government quartiles). Reproduce the post's §8 plots.
Heterogeneity Simulator
Slide the moderation strength θ and watch the GATE curve tilt. Run 100 small panels to see how often the heterogeneity test rejects homogeneity. Stress-test the §8 chi-squared.
ATE Forest Plot
The §7 ATE table, interactively. Toggle the NTL contrasts and the Conflict outcomes, compare PO / AIPW / Naive against the known ground truth, and see how close cross-fit estimates land.
Glossary (open a card if a term is unfamiliar)
ATE
CATE — τ(x)
GATE
estat gatetest.IATE
categraph histogram and categraph iateplot.PO estimator
AIPW estimator
Cross-fitting
xfolds(5) in the post means each fold's nuisance predictions come from a model trained on the other four.Heterogeneity test
Three findings the app helps you see
- Finding 1 — Mining lifts nighttime lights. §7 reports five well-identified ATEs spanning 0.149 to 0.611 log-NTL. Forest-plot tab (4) shows them next to the ground-truth column.
- Finding 2 — Price effects are non-linear. NTL 2v1 (medium vs low prices) is essentially zero (−0.011, p = 0.90); NTL 3v1 (high vs low) is large and significant (0.405). The step from low to medium does nothing; the step to high does a lot.
- Finding 3 — Institutions moderate mining, not prices. The mining-effect GATEs slope clearly with executive constraints (χ²(5) = 96.90); the price-effect GATEs by QoG are flat (χ²(3) = 5.81, p = 0.121). Tab 2 lets you switch between them.
GATE Explorer — heterogeneity by institutions
The post estimates six GATE patterns. Pick one and see the per-group estimates, their 95% CIs, and the formal χ² heterogeneity test. The contrast between the NTL 1v0 by exec_con panel (steep, χ² = 96.9) and the NTL 3v1 by qog_cat panel (flat, χ² = 5.8) is the picture behind Finding 3.
Pick a GATE panel
What to look for
- Slope direction. NTL 1v0 by exec_con drops monotonically from 0.275 (group 1) to 0.051 (group 6) — the mining effect shrinks as institutions strengthen. In the simulated DGP, weaker governance leaves more room for mining-led growth.
- Flat vs sloped. Compare NTL 3v1 by QoG quartile (flat, χ²(3) = 5.81, p = 0.12) against NTL 1v0 by QoG quartile (steep, χ²(3) = 69.19, p < 0.001). Institutions systematically moderate the mining effect, not the price premium.
- Conflict 1v0 panel. Range 0.033–0.106 across exec_con levels, χ²(5) = 5.00, p = 0.42. The test cannot reject homogeneity — mining raises conflict, but not differentially by institutions.
Heterogeneity Simulator — DGP with tunable moderation
Simulate a small resource-curse panel with a known data-generating process. Pick the ATE baseline τ₀ and the institutional-moderation slope θ. When θ ≠ 0, units with stronger institutions get a systematically different treatment effect, so the heterogeneity test should reject. When θ = 0, every unit gets τ₀ and rejection is a false positive. Run 100 simulations to see how often that happens.
Truth Implied GATE by exec_con
τ(x) at each of the 6 institutional levels (analytic, no estimation noise)
Estimate Cross-fit GATE (one panel)
Sample mean of y(1) − y(0) within each exec_con cell, after randomising treatment 50/50
What to look for
- θ = 0 ⇒ flat curve. The cross-fit GATE bars should look noisy around τ₀. The χ² test should rarely exceed the 95% critical value (≈ 11.07 for df = 5). Anything more is sample-size dependent noise.
- θ < 0 ⇒ downward slope. The §8 finding. Lower exec_con groups have larger GATEs; the heterogeneity test should reject for most random seeds.
- Noise σ matters. Crank σ up: even strong moderation (θ = ±0.10) becomes hard to detect when n = 100. This is the small-sample warning the post gives for the within-mining price comparisons.
Sampling distribution over 100 panels
Single runs are noisy. Re-simulate the same parameters 100 times to see the bias-variance picture and the empirical rejection rate of the χ² test.
ATE Forest Plot — §7 estimates vs ground truth
These numbers come straight from §7 of the post — the same Stata 19
cate po / cate aipw output. Each estimator is plotted
with its 95% CI for every NTL and Conflict contrast. The dashed orange
column on the right shows the known ground-truth ATE from the DGP, so you
can audit how close cross-fit Stata estimates land.
What to look for
- Toggle Conflict outcomes off to focus on the NTL contrasts. PO and AIPW agree on direction for every contrast and overlap on most. The largest gap is NTL 3v1 (PO 0.595 vs AIPW 0.405), where the within-mining n = 300 limits precision.
- Hover any point for SE, 95% CI, and the number of CATE variables the estimator used (always 10 — the catevarlist in §6.2).
- Compare against ground truth. NTL 1v0 truth = 0.25, AIPW estimate = 0.149 (under-shoot). NTL 3v0 truth = 0.55, AIPW = 0.611 (slight over-shoot). Both are within a few SEs of the truth — random forests + 5-fold cross-fitting are not perfect on n = 2,700.
Outcomes
Methods
Subpopulation ATEs (estat ate)
The post's §9.3 splits the sample by exec_constraints to ask: "what is the average mining effect specifically in weakly-governed districts?" The answer is striking — three times larger than in strongly-governed districts.
Weak institutions (exec_con ≤ 2)
Strong institutions (exec_con ≥ 4)
Connecting the four tabs
- Tab 1's animation showed the abstract picture: τ(x) constant vs τ(x) sloped.
- Tab 2's GATE explorer made that picture concrete using the post's six §8 panels — and showed which contrasts have monotone slopes and which do not.
- Tab 3's simulator stress-tested the heterogeneity test on a known DGP — confirming that the §8 χ² = 96.9 is well above what θ = 0 produces, even on a small n = 300 panel.
- This forest plot closes the loop: every binary contrast in §7, all estimators, against the known ground truth. Together they reproduce the post's three findings without rerunning Stata.