Commit b02dff6
committed
fix(did): harden /did-event-study from Card-Krueger validation (real bug found by running it)
Validated against Pedro's DiD_book Card-Krueger to his 1e-6 standard:
- PRINCIPLE PASSES: DRDID reproduces his canonical 2x2 DiD (2.913982357…) to ~1e-14.
- REAL BUG: the skill prescribed DRDID(panel=TRUE, idname=id), which ERRORS on Card-Krueger — an unbalanced panel (409 stores, 389 in both waves) with 2 duplicate (id,wave) rows.
Fixes:
- Phase 3: pre-flight idname-unique-by-period + balance check; full-sample 2x2 via panel=FALSE + row-unique id (matches feols ~1e-10); balancing → panel=TRUE flagged as a DIFFERENT estimand (2.914 full-sample vs 2.972 balanced — recorded as a named alternative, the EXPLAINED pattern).
- did-conventions: idname-unique-by-period + check-balance-before-panel-mode now HARD.
- quality_reports/did_validation_card_krueger.md: the verification record.
Not yet validated: staggered att_gt path + HonestDiD/didFF sensitivity (packages not installed).1 parent 91f874e commit b02dff6
3 files changed
Lines changed: 42 additions & 2 deletions
File tree
- .claude
- rules
- skills/did-event-study
- quality_reports
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
| 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 | + | |
0 commit comments