TJhon / ssynthdid

https://jhonkevinfr.netlify.app/qmds/projects/ssynthdid/ssynthdid
Other
4 stars 4 forks source link

How can I get the confidence interval/standard error? #1

Open yutaaa0811 opened 1 month ago

yutaaa0811 commented 1 month ago

I am interested in applying synthetic DiD to a staggered setting and have found this package helpful. While I am confident that interval estimation can also be conducted in this setting, I am unsure how to do so using this package. Could anyone give me any clue? My data includes companies that received policy interventions in 2021 and 2022, and I have successfully estimated the ATT and ATT table as shown below.

estimate$att_estimate [1] -0.01382217 estimate$att_table A tibble: 2 × 11 time tau tau_wt weighted_tau N0 T0 N1 T1 weights_sdid Y_beta Units

1 2021 -0.0198 268 -0.0113 15594 10 134 2 2 2022 -0.00587 200 -0.00251 15594 11 200 1
TJhon commented 1 month ago

The method for estimating the standard error is handled by ss_vcov(estimate, method = c("placebo", 'bootstrap', 'jacknife'), n_reps = 5, where n_reps is irrelevant for the jackknife method. The other methods rely on random sample selection to calculate the standard error, and n_reps specifies the number of times the sampling is performed.

For the first two methods, it directly returns the standard error (SE), while for the last method, it returns a list, with the second element being the SE.

In your case, you can use the following. Keep in mind that the first two methods are based on the selection of n_reps subsamples and recalculating the ATT, which can take time. This is one reason why it's not included directly in the ssynth_estimate function.

ssynthdid::ss_vcov(estimate, 'bootstrap', n_reps = 5)
ssynthdid::ss_vcov(estimate, 'placebo', n_reps = 5)
ssynthdid::ss_vcov(estimate, 'jacknife', n_reps = 5)
yutaaa0811 commented 1 month ago

Thank you very much for the prompt and clear answer! I could calculate my SE. I understand that, with multiple treated units, it is recommended to use bootstrap rather that jacknife according to Arkhangelsky et al. Is that correct?