lsun20 / EventStudyInteract

MIT License
34 stars 12 forks source link

Export the results #8

Open XiangShawnZhang opened 10 months ago

XiangShawnZhang commented 10 months ago

Hi Liyang,

Thanks for your great work on the package! I have a naive question on how to better export the regression results of eventstudyinteract. I met the issue of the variable names of the time period when I tried to export the results with "outreg2" or "esttab". I appreciate your suggestion on that.

Thanks! image

lsun20 commented 10 months ago

Thank you @XiangShawnZhang for trying out the package and for spotting the bug! I was able to replicate the bug, and I think the issue is that outreg2and esttab look for estimates stored in e(b) and e(V), which are default Stata matrices for regression estimates and standard errors. However, for reasons explained under saved output section of the help file, eventstudyinteract has to store the regression output in e(b_iw) and e(V_iw) instead. I just updated the help file with a workaround, which overwrites the default e(b) and e(V) with the output from eventstudyinteract. Could you please try the following to see if it resolves the bug?

matrix b = e(b_iw)
matrix V = e(V_iw)
ereturn post b V
esttab
Gofoy commented 5 months ago

Can we export more than one regression results at one time?

lsun20 commented 5 months ago

I suspect you can trick eststo similarly:

eventstudyinteract model1
matrix b = e(b_iw)
matrix V = e(V_iw)
ereturn post b V
eststo model1
eventstudyinteract model2
matrix b = e(b_iw)
matrix V = e(V_iw)
ereturn post b V
eststo model2
esttab

Hope this helps!

Gofoy commented 5 months ago

Your answer helps a lot!