EDIT: made several changes to try to clarify what I meant.
Hi everyone,
My question is the following. I want to use the "csdid" command to generate event study estimates as well as the ATT estimate and p-value that is obtained through the command's "agg(simple)" option. I want to send them to a regression table and then plot them in a graph.
The current replication code:
However, two problems:
1) Is there a way to do this while running csdid only once? this is consequential because in reality I am using a very large dataset and each specification takes many hours to run.
2) Why does "outreg2" not allow me to drop variables/parameters like "Tm4", but "coefplot" does?
Hi everyone,
My question is the following. I want to use the "csdid" command to generate event study estimates as well as the ATT estimate and p-value that is obtained through the command's "agg(simple)" option. I want to send them to a regression table and then plot them in a graph.
The current replication code:
Code:
use "https://friosavila.github.io/playingwithstata/drdid/mpdta.dta", clear
csdid lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) rseed(1) long2 agg(simple)
mat reg_tab = r(table)
local att_coef = string(round(reg_tab[1,1],0.001),"%9.3f")
display `att_coef'
local att_pval = string(round(reg_tab[4,1],0.001),"%9.3f")
display `att_pval'
csdid lemp lpop , ivar(countyreal) time(year) gvar(first_treat) method(dripw) rseed(1) long2 agg(event)
outreg2 using "table2.xls", bdec(3) sdec(3) adec(3) nocons label replace ///
addtext(Year FEs, Y, Municipality FEs, Y, Individual FEs, Y) ///
addstat(ATT coef,`att_coef',ATT p-value,`att_pval') nonotes
estimates store depvar_qp
coefplot depvar_qp, ///
drop(_cons Tm4 Pre_avg Post_avg) yline(0) xline(2.5) vertical ///
ytitle(Regression coefficient) ylabel(-0.2(0.1)0.2, format(%9.1f)) ///
xtitle(Years relative to treatment) ///
coeflabels(Tm3 = "-3" Tm2 = "-2" Tp0 = "0" Tp1 = "1" Tp2= "2" Tp3= "3") ///
text(0.15 5 "{bf:ATT = } `att_coef' (`att_pval')", placement(c) box fcolor(none))
graph export "figure2.png", replace
1) Is there a way to do this while running csdid only once? this is consequential because in reality I am using a very large dataset and each specification takes many hours to run.
2) Why does "outreg2" not allow me to drop variables/parameters like "Tm4", but "coefplot" does?

Comment