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
Implement the TripleDifference estimator following Ortiz-Villavicencio &
Sant'Anna (2025) methodology for DDD designs requiring two treatment
criteria (group and partition).
Features:
- Regression adjustment, IPW, and doubly robust estimation methods
- Proper covariate handling (unlike naive DDD implementations)
- sklearn-like API with fit(), get_params(), set_params()
- Rich results object with cell means, diagnostics, and inference
- Convenience function triple_difference() for quick estimation
Includes:
- Core estimator in diff_diff/triple_diff.py
- 45 comprehensive tests in tests/test_triple_diff.py
- Tutorial notebook (08_triple_diff.ipynb)
- API documentation in docs/api/estimators.rst
- README updates with usage examples and API reference
- Updated CLAUDE.md and ROADMAP.md
Reference: Ortiz-Villavicencio, M., & Sant'Anna, P. H. C. (2025).
"Better Understanding Triple Differences Estimators." arXiv:2505.09942.
# If results differ substantially, investigate heterogeneity
867
870
```
868
871
872
+
### Triple Difference (DDD)
873
+
874
+
Triple Difference (DDD) is used when treatment requires satisfying two criteria: belonging to a treated **group** AND being in an eligible **partition**. The `TripleDifference` class implements the methodology from Ortiz-Villavicencio & Sant'Anna (2025), which correctly handles covariate adjustment (unlike naive implementations).
875
+
876
+
```python
877
+
from diff_diff import TripleDifference, triple_difference
DDD allows for violations of parallel trends that are:
938
+
- Group-specific (e.g., economic shocks in treatment states)
939
+
- Partition-specific (e.g., trends affecting women everywhere)
940
+
941
+
As long as these biases are additive, DDD differences them out. The key assumption is that the *differential* trend between eligible and ineligible units would be the same across groups.
942
+
869
943
### Event Study Visualization
870
944
871
945
Create publication-ready event study plots:
@@ -1661,6 +1735,60 @@ SunAbraham(
1661
1735
|`print_summary(alpha)`| Print summary to stdout |
1662
1736
|`to_dataframe(level)`| Convert to DataFrame ('event_study' or 'cohort') |
1663
1737
1738
+
### TripleDifference
1739
+
1740
+
```python
1741
+
TripleDifference(
1742
+
estimation_method='dr', # 'dr' (doubly robust), 'reg', or 'ipw'
|`is_significant`| Boolean for significance at alpha |
1781
+
|`significance_stars`| String of significance stars |
1782
+
1783
+
**Methods:**
1784
+
1785
+
| Method | Description |
1786
+
|--------|-------------|
1787
+
|`summary(alpha)`| Get formatted summary string |
1788
+
|`print_summary(alpha)`| Print summary to stdout |
1789
+
|`to_dict()`| Convert to dictionary |
1790
+
|`to_dataframe()`| Convert to pandas DataFrame |
1791
+
1664
1792
### HonestDiD
1665
1793
1666
1794
```python
@@ -2024,6 +2152,18 @@ This library implements methods from the following scholarly works:
2024
2152
2025
2153
-**Arkhangelsky, D., Athey, S., Hirshberg, D. A., Imbens, G. W., & Wager, S. (2021).** "Synthetic Difference-in-Differences." *American Economic Review*, 111(12), 4088-4118. [https://doi.org/10.1257/aer.20190159](https://doi.org/10.1257/aer.20190159)
2026
2154
2155
+
### Triple Difference (DDD)
2156
+
2157
+
-**Ortiz-Villavicencio, M., & Sant'Anna, P. H. C. (2025).** "Better Understanding Triple Differences Estimators." *Working Paper*. [https://arxiv.org/abs/2505.09942](https://arxiv.org/abs/2505.09942)
2158
+
2159
+
This paper shows that common DDD implementations (taking the difference between two DiDs, or applying three-way fixed effects regressions) are generally invalid when identification requires conditioning on covariates. The `TripleDifference` class implements their regression adjustment, inverse probability weighting, and doubly robust estimators.
2160
+
2161
+
-**Gruber, J. (1994).** "The Incidence of Mandated Maternity Benefits." *American Economic Review*, 84(3), 622-641. [https://www.jstor.org/stable/2118071](https://www.jstor.org/stable/2118071)
2162
+
2163
+
Classic paper introducing the Triple Difference design for policy evaluation.
2164
+
2165
+
-**Olden, A., & Møen, J. (2022).** "The Triple Difference Estimator." *The Econometrics Journal*, 25(3), 531-553. [https://doi.org/10.1093/ectj/utac010](https://doi.org/10.1093/ectj/utac010)
2166
+
2027
2167
### Parallel Trends and Pre-Trend Testing
2028
2168
2029
2169
-**Roth, J. (2022).** "Pretest with Caution: Event-Study Estimates after Testing for Parallel Trends." *American Economic Review: Insights*, 4(3), 305-322. [https://doi.org/10.1257/aeri.20210236](https://doi.org/10.1257/aeri.20210236)
-**Sensitivity analysis**: Honest DiD (Rambachan-Roth), Pre-trends power analysis (Roth 2022)
17
17
-**Study design**: Power analysis tools
18
18
19
19
---
20
20
21
-
## Near-Term Enhancements (v1.3)
21
+
## Near-Term Enhancements (v1.4)
22
22
23
23
High-value additions building on our existing foundation.
24
24
@@ -42,14 +42,14 @@ Two-stage approach gaining traction in applied work. First residualizes outcomes
42
42
43
43
**Reference**: Gardner (2022). *Working Paper*.
44
44
45
-
### Triple Difference (DDD) Estimators
45
+
### Staggered Triple Difference (DDD)
46
46
47
-
Extends DiD to settings requiring a third differencing dimension. Common DDD implementations are invalid when covariates are needed for identification.
47
+
Extend the existing `TripleDifference` estimator to handle staggered adoption settings.
48
48
49
-
-Regression adjustment, IPW, and doubly robust DDD estimators
50
-
-Staggered adoption support with multiple comparison groups
51
-
-Proper covariate integration (naive "two DiD difference" approaches fail)
52
-
-Bias reduction and precision gains over standard approaches
49
+
-Group-time ATT(g,t) for DDD designs with variation in treatment timing
50
+
-Event study aggregation for dynamic treatment effects
51
+
-Multiple comparison groups (never-treated, not-yet-treated in either dimension)
52
+
-Bootstrap inference for staggered DDD
53
53
54
54
**Reference**: [Ortiz-Villavicencio & Sant'Anna (2025)](https://arxiv.org/abs/2505.09942). *Working Paper*. R package: `triplediff`.
55
55
@@ -61,7 +61,7 @@ Extends DiD to settings requiring a third differencing dimension. Common DDD imp
61
61
62
62
---
63
63
64
-
## Medium-Term Enhancements (v1.4+)
64
+
## Medium-Term Enhancements (v1.5+)
65
65
66
66
Extending diff-diff to handle more complex settings.
0 commit comments