lsun20 / EventStudyInteract

MIT License
35 stars 12 forks source link

Aggregated ATT #3

Closed mingyuqi0914 closed 2 years ago

mingyuqi0914 commented 2 years ago

Hi lsun20,

I wonder if I can generate an aggregated average treatment effect after fitted eventstudyinteract? Something like option estat simple in CSDID?

Thank you! Mingyu

lsun20 commented 2 years ago

Hi Mingyu,

Thank you very much for your interest in our package! I recently updated the package so that e(V_iw) also returns the the estimated covariance between the coefficient estimates for time_p0, time_p, … . So “lincom (time_p0+ time_p1+ time_p2+ time_p3+ time_p4)/5.” should work for you to get the averaged effect once you update the package (via GitHub)! Take a look at “Examples / Aggregating event study estimates” in the help file of the updated package (also explained below)

Since “lincom” looks for coefficients and variance covariance matrix stored in e(b) and e(V), a workaround is that after you estimate the coefficients on time_p0, time_p1, time_p2, time_p3, and time_p4, try the following commands:

. matrix b = e(b_iw) . matrix V = e(V_iw) . ereturn post b V . lincom (time_p0+ time_p1+ time_p2+ time_p3+ time_p4)/5

It seems "ereturn post b V” can replace e(b) and e(V). The above code works on the example I included in the helpful (after updating the package). But please let me know if you run into any bug!

Thanks, Liyang

mingyuqi0914 commented 2 years ago

Hi Liyang,

This is very helpful! Thank you very much for your explanation!

Best, Mingyu