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
"## 8. Pre-Treatment Effects and Parallel Trends Testing\n",
465
+
"\n",
466
+
"The Callaway-Sant'Anna estimator can compute **pre-treatment effects** ATT(g,t) for periods before treatment. These should be near zero if parallel trends holds.\n",
467
+
"\n",
468
+
"The `base_period` parameter controls how the reference period is selected:\n",
469
+
"- `\"varying\"` (default): For pre-treatment periods, compares t to t-1 (consecutive comparisons)\n",
470
+
"- `\"universal\"`: Always compares to g-1 (or g-anticipation-1 when anticipation > 0)\n",
471
+
"\n",
472
+
"Both produce identical post-treatment effects; they differ only for pre-treatment diagnostics."
473
+
]
474
+
},
475
+
{
476
+
"cell_type": "code",
477
+
"execution_count": null,
478
+
"metadata": {},
479
+
"outputs": [],
480
+
"source": [
481
+
"# CallawaySantAnna with explicit base_period for pre-treatment effects\n",
482
+
"cs_pretrends = CallawaySantAnna(\n",
483
+
" control_group=\"never_treated\",\n",
484
+
" base_period=\"varying\" # Default: consecutive comparisons for pre-periods\n",
485
+
")\n",
486
+
"\n",
487
+
"results_pretrends = cs_pretrends.fit(\n",
488
+
" df,\n",
489
+
" outcome=\"outcome\",\n",
490
+
" unit=\"unit\",\n",
491
+
" time=\"period\",\n",
492
+
" first_treat=\"first_treat\",\n",
493
+
" aggregate=\"event_study\"\n",
494
+
")\n",
495
+
"\n",
496
+
"# The base_period is recorded in results\n",
497
+
"print(f\"Base period method: {results_pretrends.base_period}\")"
498
+
]
499
+
},
500
+
{
501
+
"cell_type": "code",
502
+
"execution_count": null,
503
+
"metadata": {},
504
+
"outputs": [],
505
+
"source": [
506
+
"# Examine pre-treatment effects (event time < 0)\n",
"The Sun-Abraham (2021) estimator provides an alternative approach to staggered DiD. While Callaway-Sant'Anna aggregates 2x2 DiD comparisons, Sun-Abraham uses an **interaction-weighted regression** approach:\n",
603
774
"\n",
@@ -630,7 +801,7 @@
630
801
" outcome=\"outcome\",\n",
631
802
" unit=\"unit\",\n",
632
803
" time=\"period\",\n",
633
-
" first_treat=\"cohort\" # Column with first treatment period (0 = never treated)\n",
804
+
" first_treat=\"first_treat\" # Column with first treatment period (0 = never treated)\n",
634
805
")\n",
635
806
"\n",
636
807
"# View summary\n",
@@ -664,7 +835,7 @@
664
835
"cell_type": "markdown",
665
836
"metadata": {},
666
837
"source": [
667
-
"## 13. Comparing CS and SA as a Robustness Check\n",
838
+
"## 14. Comparing CS and SA as a Robustness Check\n",
668
839
"\n",
669
840
"Running both estimators provides a useful robustness check. When they agree, results are more credible."
670
841
]
@@ -716,7 +887,7 @@
716
887
" - Only using valid comparison groups\n",
717
888
" - Properly aggregating effects\n",
718
889
"4. **Sun-Abraham** provides an alternative approach using:\n",
719
-
" - Interaction-weighted regression with cohort × relative-time indicators\n",
890
+
" - Interaction-weighted regression with cohort x relative-time indicators\n",
720
891
" - Different weighting scheme than CS\n",
721
892
" - More efficient under homogeneous effects\n",
722
893
"5. **Run both CS and SA** as a robustness check—when they agree, results are more credible\n",
@@ -728,7 +899,12 @@
728
899
" - Use `n_bootstrap` parameter to enable multiplier bootstrap\n",
729
900
" - Choose weight type: `'rademacher'`, `'mammen'`, or `'webb'`\n",
730
901
" - Bootstrap results include SEs, CIs, and p-values for all aggregations\n",
731
-
"8. **Control group choices** affect efficiency and assumptions:\n",
902
+
"8. **Pre-treatment effects** provide parallel trends diagnostics:\n",
903
+
" - Use `base_period=\"varying\"` for consecutive period comparisons\n",
904
+
" - Pre-treatment ATT(g,t) should be near zero\n",
905
+
" - 95% CIs including zero is consistent with parallel trends\n",
906
+
" - See Tutorial 07 for pre-trends power analysis (Roth 2022)\n",
907
+
"9. **Control group choices** affect efficiency and assumptions:\n",
0 commit comments