Fix CS event study SEs (missing WIF) + simultaneous confidence bands#189
Fix CS event study SEs (missing WIF) + simultaneous confidence bands#189
Conversation
…bands Event study aggregation SEs were missing the weight influence function (WIF) adjustment that R's did::aggte(..., type="dynamic") includes. This caused systematic SE underestimation because uncertainty in group-size weight estimation was unaccounted for. The bootstrap path also used fixed-weight re-aggregation instead of perturbing combined IFs. Both analytical and bootstrap paths now include WIF for event study and overall ATT. Additionally adds simultaneous confidence bands (cband=True, default) using sup-t bootstrap critical values, matching R's did::aggte(..., cband=TRUE). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Overall Assessment: Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Fix critical bug where _compute_aggregated_se_with_wif() used local unit set instead of global panel size N for pg computation, causing SE overestimation at extreme event times. Add use_cband parameter to plot_event_study() for opting out of simultaneous confidence bands. Add cband docstrings and plot tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment: Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
The multiplier bootstrap in _run_multiplier_bootstrap() was building the unit set from influence_func_info (local units only), causing pg = n_g / n_local to overestimate group shares in unbalanced panels where some units don't appear in any influence function. Now uses precomputed['all_units'] (or df fallback) matching the analytical path fix from 9758a19. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks good Executive summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
The DataFrame branch of _extract_plot_data() always returned None for cband overrides, silently dropping cband_lower/cband_upper columns. Now detects and extracts these columns when present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: Executive summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
…shold P2: DataFrame cband extraction now filters NaN values, falling back to pointwise CIs when cband columns are all-NaN (common when cband=False). P1: sup-t cband critical value now requires ≥50% finite bootstrap draws, matching the validity threshold used in bootstrap_utils. Warns and returns None when threshold not met. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks good Executive summary:
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Extend _get_r_mpdta_and_results helper to also run aggte(type="dynamic") and aggte(type="dynamic", cband=TRUE) in the same R process. Add two new tests: test_mpdta_event_study_ses_match_r validates ATT/SE per event time, test_mpdta_cband_crit_value_vs_r validates sup-t critical values match R. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks good Executive summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
If you want, I can do a deeper dive comparing the WIF/cband formulae against the exact R |
Summary
did::aggte(..., type="dynamic")cband=True, default) using sup-t bootstrap critical values, matching R'sdid::aggte(..., cband=TRUE)cband_crit_valueto results,cband_lower/cband_uppercolumns into_dataframe(), and simultaneous CI display insummary()plot_event_study()to use simultaneous CIs when availableMethodology references (required if estimator / math changes)
did::aggte()— WIF formula inAGGTEobj.R, sup-t cband incompute.aggte()didpackage behaviorValidation
tests/test_methodology_callaway.py: 10 new tests inTestEventStudySEWithWIF(4) andTestSimultaneousConfidenceBands(6)Security / privacy
Generated with Claude Code