A reproducible panel with known dynamic treatment effects
This simulation compares matrix-panel counterfactual estimators with two PyFixest event-study specifications. It replaces the earlier vignette that required a private Hainmueller–Hangartner CSV. The results below are synthetic, not estimates from that empirical study.
Every crabbymetrics panel estimator receives fit(Y, W): a units-by-periods outcome matrix and a same-shaped, absorbing binary treatment matrix.
Data-generating process
There are 240 units and 18 periods. Three cohorts adopt in periods 6, 9, and 12; the remaining units are never treated. Untreated outcomes contain unit effects, common time effects, and independent noise. Treatment effects vary with cohort and grow with exposure, so a single constant-effect TWFE coefficient is not automatically the relevant dynamic effect.
HorizontalPanelRidge, MatrixCompletion, and SyntheticDID provide scalar effects and nested event-study summaries. Always inspect convergence diagnostics where available. MatrixCompletion can retain a nonconverged iterate on budget exhaustion; returning from fit alone is not a convergence check.
These scalar outputs do not necessarily use the same weighting as the raw treated-cell average. SyntheticDID’s scalar ATT uses both unit and time weights; its event path is a period-specific weighted gap. Counterfactual-model assumptions and cohort weights matter even when every method accepts the same matrices.
Two-way fixed effects and saturated event studies
The first PyFixest fit pools event-time effects across cohorts. The second fits cohort-specific effects and aggregates them using the saturated/Sun-Abraham-style interface. Both use unit-clustered intervals and period -1 as the reference. The outermost TWFE event times are binned.
For display, matrix-estimator paths are centered on their own period -1 estimate. This makes their normalization explicit; it does not make their weighting identical to PyFixest’s. The truth curve averages effects among the ever-treated units observed at each event time. Restricting to interior periods avoids interpreting the binned TWFE endpoints as single-period effects.
A single simulated sample is not a coverage study. The matrix curves are point estimates without event-time confidence bands; the regression intervals reflect their own clustered covariance assumptions. Use the panel DGP Monte Carlo for repeated-sample comparisons, and the real panel case studies for empirical examples with bundled data.