Skip to content

Commit 6f26709

Browse files
igerberclaude
andcommitted
Fix CI review Round 10: narrow bootstrap sync, gate binary-only artifacts
P1: Narrow bootstrap_results.overall_* sync to L_max == 1 only. When L_max >= 2, the cost-benefit delta overrides overall_*, so bootstrap_results.overall_* stays on the scalar DID_M bootstrap. P1: Gate binary-only Phase 1 artifacts on non-binary panels: per_period_effects emptied, single-period placebo_* set to NaN, placebo_available set to False. These are DID_M concepts that don't apply to non-binary treatment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8813170 commit 6f26709

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

diff_diff/chaisemartin_dhaultfoeuille.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,10 +1672,13 @@ def fit(
16721672
overall_t = es1["t_stat"]
16731673
overall_p = es1["p_value"]
16741674
overall_ci = es1["conf_int"]
1675-
# Also sync the nested bootstrap_results.overall_* so the
1676-
# public bootstrap object matches the top-level DID_1 surface.
1675+
# Sync nested bootstrap_results.overall_* to DID_1 only when
1676+
# L_max == 1. When L_max >= 2, the cost-benefit delta overrides
1677+
# overall_* later, so bootstrap_results.overall_* should stay
1678+
# on the scalar DID_M bootstrap (or be overridden by delta logic).
16771679
if (
1678-
bootstrap_results is not None
1680+
L_max == 1
1681+
and bootstrap_results is not None
16791682
and bootstrap_results.event_study_ses
16801683
and 1 in bootstrap_results.event_study_ses
16811684
):
@@ -1882,6 +1885,17 @@ def fit(
18821885
effective_n_treated = int(
18831886
N_mat[D_mat != D_mat[:, 0:1]].sum()
18841887
) if D_mat.shape[1] > 1 else 0
1888+
if not is_binary:
1889+
# Suppress binary-only Phase 1 artifacts on non-binary
1890+
# panels: per_period_effects and single-period placebo
1891+
# are DID_M concepts that don't apply to non-binary data.
1892+
per_period_effects = {}
1893+
placebo_effect = float("nan")
1894+
placebo_se = float("nan")
1895+
placebo_t = float("nan")
1896+
placebo_p = float("nan")
1897+
placebo_ci = (float("nan"), float("nan"))
1898+
placebo_available = False
18851899
# Suppress joiner/leaver decomposition for all L_max >= 1
18861900
# (the decomposition is a per-period DID_M concept, not
18871901
# applicable to the per-group DID_1 estimand)

0 commit comments

Comments
 (0)