Skip to content

Commit aedea7f

Browse files
igerberclaude
andcommitted
stacked_did: R9 P1 — sample_share parity + DOF asserts on all variants
R9 verdict was ⚠️ still on parameter-coverage P1: sample_share had no R-parity fixture, and population/anticipation1 tests asserted SE only (not BM DOF). Source-tree additions: - benchmarks/data/stacked_did_sample_share_panel.csv (NEW): pre-stacked fixture for weighting='sample_share'. - benchmarks/R/generate_stacked_did_golden.R: added sample_share variant to the variants list; loops over all 4 variants now. - benchmarks/data/stacked_did_golden.json: regenerated with sample_share. Test additions (tests/test_methodology_stacked_did.py): - test_sample_share_weighting_hc1_matches_clubsandwich_cr1s - test_sample_share_weighting_hc2_bm_matches_clubsandwich_cr2 (+ DOF) - Extended test_population_weighting_hc2_bm_matches_clubsandwich_cr2: added per-event-time + overall BM DOF parity via CI-width inversion. - Extended test_anticipation1_hc2_bm_matches_clubsandwich_cr2: same DOF parity additions. 89 tests pass. All 3 non-default variants now have full R parity: event-study SE + overall_se + per-event BM DOF + overall BM DOF. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cfe30f5 commit aedea7f

4 files changed

Lines changed: 502 additions & 0 deletions

File tree

benchmarks/R/generate_stacked_did_golden.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ variants <- list(
5151
csv = "benchmarks/data/stacked_did_anticipation1_panel.csv",
5252
ref_period = -2L, # shifted: e = -1 - anticipation
5353
out_key = "anticipation1_unit"
54+
),
55+
sample_share = list(
56+
csv = "benchmarks/data/stacked_did_sample_share_panel.csv",
57+
ref_period = -1L,
58+
out_key = "sample_share_unit" # third Q-weight formula
5459
)
5560
)
5661

benchmarks/data/stacked_did_golden.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,37 @@
105105
"se_cr2_intercept": 0.387454300846914,
106106
"coef_es": [-0.09202034132318355, -0.1405590947363716, 2.06336107537375, 1.8472286131028, 1.910082975702512]
107107
}
108+
},
109+
"sample_share": {
110+
"meta": {
111+
"event_times_non_ref": [-2, 0, 1, 2],
112+
"es_coef_names": ["delta_neg2", "delta_0", "delta_1", "delta_2"],
113+
"ref_period": -1,
114+
"anticipation": 0
115+
},
116+
"unit": {
117+
"se_cr1_es": [0.1926945586681986, 0.1774065826127712, 0.179551540289758, 0.2122392518497908],
118+
"se_cr2_es": [0.1924916107265304, 0.1771398302930658, 0.1787869223969842, 0.211801063322419],
119+
"dof_bm_es": [43.616923190028679, 43.616923190028658, 43.616923190028672, 43.616923190028579],
120+
"dof_bm_overall": 43.616923190028821,
121+
"se_overall_cr1": 0.1513357911957259,
122+
"se_overall_cr2": 0.1509672871980841,
123+
"es_coef_names": ["delta_neg2", "delta_0", "delta_1", "delta_2"],
124+
"se_cr1_intercept": 0.4871327984687643,
125+
"se_cr2_intercept": 0.4880622063955147,
126+
"coef_es": [0.1108321656167259, 2.20608363527907, 1.950880164652265, 2.024566452331055]
127+
},
128+
"unit_subexp": {
129+
"se_cr1_es": [0.1793915271522487, 0.1770839950451901, 0.1982000403327432, 0.217155905557332],
130+
"se_cr2_es": [0.17853000329591, 0.1762727793305481, 0.1973992806659578, 0.2163342225610217],
131+
"dof_bm_es": [50.784770788284384, 50.784770788284128, 50.78477078828427, 50.784770788284149],
132+
"dof_bm_overall": 50.78477078828643,
133+
"se_overall_cr1": 0.1576457481577655,
134+
"se_overall_cr2": 0.1570178024670955,
135+
"es_coef_names": ["delta_neg2", "delta_0", "delta_1", "delta_2"],
136+
"se_cr1_intercept": 0.3600565608113597,
137+
"se_cr2_intercept": 0.3569865903344588,
138+
"coef_es": [0.1108321656167259, 2.20608363527907, 1.950880164652265, 2.024566452331055]
139+
}
108140
}
109141
}

0 commit comments

Comments
 (0)