Commit 7d6ce12
feat(parity): paper-level parity + HDFE speed bench + Mixtape guide
Four parallel tracks closing the "benchmarks + docs" debt flagged
in the 2026-04-20 audit. All four add verification-first surface
that will catch regressions on the canonical identification
strategies going forward.
Track A — Honest DiD paper-level parity
tests/external_parity/test_honest_did_paper_parity.py (NEW, 9 tests)
Pins sp.breakdown_m to Rambachan-Roth (2023) Definition 2 closed
form M* = max((|θ̂| - z·SE) / n_drift, 0) at 5 parametric points,
plus clamp-at-zero, α-sensitivity, missing-e error path, and an
end-to-end smoke on a real callaway_santanna + aggte(dynamic)
result. Complements the structural smoke tests already in
tests/test_honest_did.py.
Track B — Angrist-Krueger 1991 IV published parity
tests/external_parity/test_published_replications.py (+74 lines)
New TestAngristKrueger1991Parity class exercises the existing
sp.datasets.angrist_krueger_1991() replica against the Angrist-
Krueger (1991) QJE Table V published range (0.08-0.11). IV band
tightened to ±0.02 beyond the published range after round-3
review flagged the original ±0.04 as too loose to catch real
regressions. Note: uses sp.ivreg (not sp.iv — the package
re-binds that name to the subpackage, see __init__.py L127-129).
Track C — HDFE scaled benchmark
benchmarks/bench_hdfe_scaled.py (NEW, 214 lines)
benchmarks/RESULTS.md (+21 lines)
Extends bench_hdfe.py (capped at 20k) to 10k/100k/1M rows. CLI:
--quick (skip 1M), --no-feols, --no-lm, --json-out PATH. Auto-
creates --json-out parent directory after review flagged the
crash-on-missing-dir foot-gun. Initial numbers on M-series
Apple Silicon: absorb_ols 21x faster than linearmodels at 10k,
11.7x faster at 100k — matches the "fast-HDFE" regime story.
Track D — Mixtape Ch 9 flagship guide + regression guard
docs/guides/mixtape_ch09_did.md (NEW, 243 lines)
tests/test_mixtape_ch09_guide.py (NEW, 8 tests)
End-to-end DiD tutorial mapping Cunningham (2021) Chapter 9 onto
the modern StatsPAI surface: TWFE baseline → Bacon decomposition
→ auto_did race (CS/SA/BJS) → Sun-Abraham event study → Honest
DiD breakdown_m / honest_did sensitivity → spec_curve covariate
multiverse. Every runnable code block in the guide has a
matching regression test so the guide can't silently rot when
underlying signatures shift (this already happened once during
review — unit= vs id=, M_range= vs m_grid=, effects= kwarg that
doesn't exist). Includes plot-helper availability checks after
round-3 reviewer flagged bacon_plot / enhanced_event_study_plot
as untested AttributeError risks.
Review cycle: one round of self-review caught:
- benchmark --json-out crash on missing parent dir (fixed)
- spec_curve signature mismatch in guide (fixed: guide now shows
the real covariate-multiverse API, with a callout pointing to
auto_did for the estimator-multiverse use case)
- Mixtape effect-recovery band too wide (0.3 → 0.15 for best-
of-three; 0.3 → 0.4 upper bound for any single estimator)
- AK91 IV band too loose (±0.04 → ±0.02)
- _event_study_result helper had silent-fallback foot-gun (added
explicit assert 0 in relative_times)
Regression: 190/190 pass on the focused suite (48 reference_parity
+ 31 external_parity including the new 9 Honest DiD + 4 AK91, + 31
round-1 aliases + 25 round-2 aliases + 13 auto_did/auto_iv + 20
agent + 10 workflow + 8 Mixtape guide). Zero regressions.
Deliberate non-goals (flagged, not attempted in this round):
- R fixest / Stata reghdfe numeric parity — blocked on optional
pyfixest / R dependency; sp.feols smoke call is guarded and
skipped when pyfixest is not installed.
- HV-latent MTE line — intentionally left to the in-progress
v0.9.11 branch not touched by this commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3934820 commit 7d6ce12
6 files changed
Lines changed: 862 additions & 0 deletions
File tree
- benchmarks
- docs/guides
- tests
- external_parity
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
23 | 44 | | |
24 | 45 | | |
25 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
0 commit comments