You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Four-in-one DID polish round, all scoped to the DID module:
1. etwfe(xvar=...) — covariate-moderated heterogeneity
New _etwfe_with_xvar helper adds cohort × post × (x - mean(x))
interactions so the baseline coefficient is ATT(g) evaluated at
the sample mean of xvar and the slope coefficient measures how
ATT(g) shifts per unit of xvar. Closes the last R-etwfe feature
gap. Backward compatible: etwfe(xvar=None) is byte-identical to
wooldridge_did().
2. tests/test_did_summary.py — DID consistency + parity tests
Seven pytest cases covering: did_summary ↔ direct etwfe / BJS
numeric match; etwfe ≡ wooldridge_did under xvar=None; xvar=
random-covariate sanity bound; Markdown + LaTeX exports shape +
content; non-did_summary input correctly rejected; forest plot
render via Agg backend. pytest exit 0 (7 passed in 6.34s).
3. Custom result.summary() on did_summary output
Prints a Markdown table (via did_summary_to_markdown) plus a
header block with fitted/failed methods, cross-method mean,
dispersion SD, and breakdown M* (when sensitivity was run).
Base CausalResult.summary's single-estimate layout was a poor
fit for a multi-method comparison; this customisation gives
researchers a paste-ready console dump.
4. did_report(data, ..., save_to=dir) — one-call bundle
Fits did_summary with include_sensitivity=True by default and
writes five files into save_to/:
- did_summary.txt (summary dump)
- did_summary.md (GFM table)
- did_summary.tex (booktabs LaTeX fragment)
- did_summary.png (forest plot, matplotlib-optional)
- did_summary.json (detail + model_info, replay-friendly)
Returns the underlying CausalResult for programmatic use.
READMEs updated (EN + CN). Commit staged with explicit file list to
avoid the earlier `git add -A` sweep regression.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments