https://github.com/gregorsteiner/staggeredsynthdid
Synthetic DiD estimation in staggered adoption settings
https://github.com/gregorsteiner/staggeredsynthdid
causal-inference difference-in-differences staggered-adoption synthetic-control
Last synced: 8 months ago
JSON representation
Synthetic DiD estimation in staggered adoption settings
- Host: GitHub
- URL: https://github.com/gregorsteiner/staggeredsynthdid
- Owner: gregorsteiner
- Created: 2022-08-26T08:03:16.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-11T07:13:02.000Z (about 1 year ago)
- Last Synced: 2025-06-11T08:28:07.058Z (about 1 year ago)
- Topics: causal-inference, difference-in-differences, staggered-adoption, synthetic-control
- Language: R
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# StaggeredSynthDiD: Synthetic Difference-in-Differences Estimation in Staggered Adoption Settings
This package is a simple extension of the [**synthdid**](https://synth-inference.github.io/synthdid/) package. It implements the Synthetic Difference-in-Differences (DiD) estimator by Arkhangelsky et al. (2021) for staggered adoption settings. As proposed in the Appendix of Arkhangelsky et al. (2021), the estimator is applied repeatedly, once for every adoption date, and a weighted average is calculated.
### Installation
The current development version can be installed from Github:
```R
devtools::install_github("gregorsteiner/StaggeredSynthDiD")
```
### Example
```R
# simulate simple example dataset with staggered treatment
set.seed(1)
N <- 10 # number of units
TT <- 10 # number of time periods
tau <- 0.5 # actual treatment effect
data <- data.frame("Unit" = rep(1:N, each = TT),
"Time" = rep(1:TT, N),
"W" = 0)
data <- within(data, {
# add staggered treatment (for units 1, 2, and 3 with different start timing)
W[Unit == 1 & Time >= 3] <- 1
W[Unit == 2 & Time >= 4] <- 1
W[Unit == 3 & Time >= 5] <- 1
# dependent variable
Y <- tau * W + rnorm(N * TT)
})
# use function
StaggeredSynthDiD(data)
```
### References
Arkhangelsky, Dmitry, Susan Athey, David A. Hirshberg, Guido W. Imbens, and Stefan Wager. 2021. "Synthetic Difference-in-Differences." American Economic Review, 111 (12): 4088-4118.