Skip to content

Commit fc83a52

Browse files
igerberclaude
andcommitted
Fix CI review Round 11: clear bootstrap_distribution for L_max=1
P1: Clear bootstrap_results.bootstrap_distribution to None when L_max == 1. The stored DID_M distribution doesn't match the DID_1 summary statistics. Per-horizon bootstrap stats are accessible via event_study_ses/cis/p_values. P2: Add bootstrap_distribution is None assertion to the L_max=1 bootstrap sync regression test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6f26709 commit fc83a52

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

diff_diff/chaisemartin_dhaultfoeuille.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,10 @@ def fit(
16881688
if bootstrap_results.event_study_cis and 1 in bootstrap_results.event_study_cis
16891689
else (np.nan, np.nan)
16901690
)
1691+
# Clear the DID_M distribution - it doesn't match the
1692+
# DID_1 summary statistics. The per-horizon bootstrap
1693+
# stats are accessible via event_study_ses/cis/p_values.
1694+
bootstrap_results.bootstrap_distribution = None
16911695
bootstrap_results.overall_p_value = (
16921696
bootstrap_results.event_study_p_values[1]
16931697
if bootstrap_results.event_study_p_values

tests/test_chaisemartin_dhaultfoeuille.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,9 @@ def test_L_max_1_suppresses_joiner_leaver_decomposition(self):
18641864
assert not df_jl[df_jl["estimand"] == "DID_-"].iloc[0]["available"]
18651865

18661866
def test_L_max_1_bootstrap_results_overall_synced(self, data, ci_params):
1867-
"""bootstrap_results.overall_* must match event_study horizon 1."""
1867+
"""bootstrap_results.overall_* must match event_study horizon 1,
1868+
and bootstrap_distribution must be cleared (DID_M distribution
1869+
doesn't match the DID_1 summary stats)."""
18681870
n_boot = ci_params.bootstrap(99)
18691871
est = ChaisemartinDHaultfoeuille(
18701872
placebo=False, twfe_diagnostic=False, n_bootstrap=n_boot, seed=42
@@ -1881,6 +1883,8 @@ def test_L_max_1_bootstrap_results_overall_synced(self, data, ci_params):
18811883
assert br.overall_se == br.event_study_ses[1]
18821884
assert br.overall_ci == br.event_study_cis[1]
18831885
assert br.overall_p_value == br.event_study_p_values[1]
1886+
# bootstrap_distribution cleared (was DID_M, not DID_1)
1887+
assert br.bootstrap_distribution is None
18841888

18851889
def test_L_max_1_uses_per_group_path(self, data):
18861890
"""L_max=1 uses the per-group DID_{g,1} path (same as L_max >= 2

0 commit comments

Comments
 (0)