synth-inference / synthdid

Synthetic difference in differences
https://synth-inference.github.io/synthdid
BSD 3-Clause "New" or "Revised" License
262 stars 98 forks source link

The package cannot use this data. Treatment adoption is not simultaneous. #125

Open Machine855 opened 4 months ago

Machine855 commented 4 months ago

Dear all:

I run the following code in R to test whether your synth function does work on my panel dataset:

library(haven) testen <- read_dta("test files/testen.dta") View(testen) library(dplyr) setup = panel.matrices(as.data.frame(as_tibble(testen)))

I got the following error message:

library(haven) testen <- read_dta("test files/testen.dta") View(testen) library(dplyr) setup = panel.matrices(as.data.frame(as_tibble(testen))) Error in panel.matrices(as.data.frame(as_tibble(testen))) : The package cannot use this data. Treatment adoption is not simultaneous. In addition: There were 50 or more warnings (use warnings() to see the first 50)

Any help to solve this issue is greatly appreciated. Is this package also available for staggered treatments?

davidahirshberg commented 4 months ago

The current version of the package does not handle staggered treatments automatically. But it's fairly easy to make a few calls to synthdid_estimate to to implement your own approach to staggered adoption. See Section 8 of the synthetic diff-in-diff paper.

In this we are a bit behind the Stata, Julia, and Python packages, which do automate a version of what is described in Section 8.

Machine855 commented 4 months ago

Thank you so much for your reply. Can you please change the STATA code so you can run it in Parallel? Parallel execution -> parallel(#) partial out variables in # separate Stata processes, speeding up execution depending on data size and computer characteristics. Requires the parallel package.

davidahirshberg commented 4 months ago

That's a request for the stata package authors. Post an issue here if you like: https://github.com/Daniel-Pailanir/sdid

Machine855 commented 3 months ago

I am unfortunately unable to program in R. Could you please implement it in R?