cdid: An R Package for Chained Difference-in-Differences
A flexible toolkit for estimating treatment effects with staggered adoption and heterogeneous dynamics
Difference-in-differences (DiD) is one of the most widely used tools in applied economics, but the standard two-way fixed effects approach can produce severely biased estimates when treatment is staggered and effects are heterogeneous. A growing literature has proposed solutions, and the cdid package brings one of the most flexible approaches — chained DiD — into a practical, easy-to-use R implementation.
What cdid does
The package implements chained difference-in-differences estimators that allow researchers to recover average treatment effects under staggered adoption designs. Instead of relying on a single comparison between treated and control units, chained DiD constructs a sequence of local comparisons that are robust to heterogeneous treatment dynamics.
Key features include support for multiple time periods and cohorts, flexible specification of comparison groups, and built-in tools for aggregation and visualization of treatment effect estimates.
Interactive documentation
For a detailed walkthrough of the package — including installation, usage examples, and the underlying methodology — visit the full cdid documentation page.
The package is available on GitHub and is under active development. Feedback and contributions are welcome.
Benatia, D. (2024). cdid: Chained Difference-in-Differences. R package.