I want to update my traditional DiD analyses with Callaway and Sant’Anna's (2021) semi-parametric DiD estimator using the csdid command. Here is a dataex of my sample:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(emp_ratio_sa intsmall_ta_1 intsmall_tb_1 intsmall_ta_2 intsmall_tb_2 intsmall_ta_3 intsmall_tb_3 intsmall_ta_4 intsmall_tb_4 intsmall_ta_5 intsmall_tb_5 intsmall_ta_6 intsmall_tb_6 intsmall_0 statefip time treat_qpdmp eventT) .7219443 0 0 0 0 0 0 0 0 0 0 0 0 0 1 96 0 6 .7270641 0 0 0 0 0 0 0 0 0 0 0 0 0 1 97 0 6 .722241 0 0 0 0 0 0 0 0 0 0 0 0 0 1 98 0 6 .731342 0 0 0 0 0 0 0 0 0 0 0 0 0 1 99 0 6 .7264431 0 0 0 0 0 0 0 0 0 0 0 0 0 1 100 0 6 .7278489 0 0 0 0 0 0 0 0 0 0 0 0 0 1 101 0 6 .7415584 0 0 0 0 0 0 0 0 0 0 0 0 0 1 102 0 6 .7661154 0 0 0 0 0 0 0 0 0 0 0 0 0 1 103 0 6 .742871 0 0 0 0 0 0 0 0 0 0 0 0 0 1 104 0 6 .7310079 0 0 0 0 0 0 0 0 0 0 0 0 0 1 105 0 6 .7459943 0 0 0 0 0 0 0 0 0 0 0 0 0 1 106 0 6 .7434144 0 0 0 0 0 0 0 0 0 0 0 0 0 1 107 0 6 .7512739 0 0 0 0 0 0 0 0 0 0 0 0 0 1 108 0 6 .7619339 0 0 0 0 0 0 0 0 0 0 0 0 0 1 109 0 6 .7568708 0 0 0 0 0 0 0 0 0 0 0 0 0 1 110 0 6 .7509231 0 0 0 0 0 0 0 0 0 0 0 0 0 1 111 0 6 .75106 0 0 0 0 0 0 0 0 0 0 0 0 0 1 112 0 6 .7469623 0 0 0 0 0 0 0 0 0 0 0 0 0 1 113 0 6 .7410953 0 0 0 0 0 0 0 0 0 0 0 0 0 1 114 0 6 .7331818 0 0 0 0 0 0 0 0 0 0 0 0 0 1 115 0 6 .7517717 0 0 0 0 0 0 0 0 0 0 0 0 0 1 116 0 6 .7682488 0 0 0 0 0 0 0 0 0 0 0 0 0 1 117 0 6 .7614667 0 0 0 0 0 0 0 0 0 0 0 0 0 1 118 0 6 .7746972 0 0 0 0 0 0 0 0 0 0 0 0 0 1 119 0 6 .7701825 0 0 0 0 0 0 0 0 0 0 0 0 0 1 120 0 6 .7691069 0 0 0 0 0 0 0 0 0 0 0 0 0 1 121 0 6 .7497196 0 0 0 0 0 0 0 0 0 0 0 0 0 1 122 0 6 .7749722 0 0 0 0 0 0 0 0 0 0 0 0 0 1 123 0 6 .7229774 0 0 0 0 0 0 0 0 0 0 0 0 0 1 124 0 6 .7317652 0 0 0 0 0 0 0 0 0 0 0 0 0 1 125 0 6 .7542 0 0 0 0 0 0 0 0 0 0 0 0 0 1 126 0 6 .7434831 0 0 0 0 0 0 0 0 0 0 0 0 0 1 127 0 6 .7431633 0 0 0 0 0 0 0 0 0 0 0 0 0 1 128 0 6 .7390506 0 0 0 0 0 0 0 0 0 0 0 0 0 1 129 0 6 .7738222 0 0 0 0 0 0 0 0 0 0 0 0 0 1 130 0 6 .7451106 0 0 0 0 0 0 0 0 0 0 0 0 0 1 131 0 6 .7595577 0 0 0 0 0 0 0 0 0 0 0 0 0 1 132 0 6 .7639228 0 0 0 0 0 0 0 0 0 0 0 0 0 1 133 0 6 .7485735 0 0 0 0 0 0 0 0 0 0 0 0 0 1 134 0 6 .7524864 0 0 0 0 0 0 0 0 0 0 0 0 0 1 135 0 6 .7646362 0 0 0 0 0 0 0 0 0 0 0 0 0 1 136 0 6 .7876217 0 0 0 0 0 0 0 0 0 0 0 0 0 1 137 0 6 .7759739 0 0 0 0 0 0 0 0 0 0 0 0 0 1 138 0 6 .7897649 0 0 0 0 0 0 0 0 0 0 0 0 0 1 139 0 6 .7795818 0 0 0 0 0 0 0 0 0 0 0 0 0 1 140 0 6 .7496525 0 0 0 0 0 0 0 0 0 0 0 0 0 1 141 0 6 .7717182 0 0 0 0 0 0 0 0 0 0 0 0 0 1 142 0 6 .7859297 0 0 0 0 0 0 0 0 0 0 0 0 0 1 143 0 6 .7857348 0 0 0 0 0 0 0 0 0 0 0 0 0 1 144 0 6 .7631013 0 0 0 0 0 0 0 0 0 0 0 0 0 1 145 0 6 .8003568 0 0 0 0 0 0 0 0 0 0 0 0 0 1 146 0 6 .790067 0 0 0 0 0 0 0 0 0 0 0 0 0 1 147 0 6 .7887953 0 0 0 0 0 0 0 0 0 0 0 0 0 1 148 0 6 .804588 0 0 0 0 0 0 0 0 0 0 0 0 0 1 149 0 6 .7865897 0 0 0 0 0 0 0 0 0 0 0 0 0 1 150 0 6 .7946309 0 0 0 0 0 0 0 0 0 0 0 0 0 1 151 0 6 .7958547 0 0 0 0 0 0 0 0 0 0 0 0 0 1 152 0 6 .7819211 0 0 0 0 0 0 0 0 0 0 0 0 0 1 153 0 6 .7804796 0 0 0 0 0 0 0 0 0 0 0 0 0 1 154 0 6 .7998914 0 0 0 0 0 0 0 0 0 0 0 0 0 1 155 0 6 .808333 0 0 0 0 0 0 0 0 0 0 0 0 0 1 156 0 6 .8037804 0 0 0 0 0 0 0 0 0 0 0 0 0 1 157 0 6 .8006392 0 0 0 0 0 0 0 0 0 0 0 0 0 1 158 0 6 .7885816 0 0 0 0 0 0 0 0 0 0 0 0 0 1 159 0 6 .8076813 0 0 0 0 0 0 0 0 0 0 0 0 0 1 160 0 6 .7850609 0 0 0 0 0 0 0 0 0 0 0 0 0 1 161 0 6 .7776859 0 0 0 0 0 0 0 0 0 0 0 0 0 1 162 0 6 .7701354 0 0 0 0 0 0 0 0 0 0 0 0 0 1 163 0 6 .7665312 0 0 0 0 0 0 0 0 0 0 0 0 0 1 164 0 6 .7779756 0 0 0 0 0 0 0 0 0 0 0 0 0 1 165 0 6 .7685159 0 0 0 0 0 0 0 0 0 0 0 0 0 1 166 0 6 .7648834 0 0 0 0 0 0 0 0 0 0 0 0 0 1 167 0 6 .7512071 0 0 0 0 0 0 0 0 0 0 0 0 0 1 168 0 6 .7527735 0 0 0 0 0 0 0 0 0 0 0 0 0 1 169 0 6 .7590218 0 0 0 0 0 0 0 0 0 0 0 0 0 1 170 0 6 .7660882 0 0 0 0 0 0 0 0 0 0 0 0 0 1 171 0 6 .7786498 0 0 0 0 0 0 0 0 0 0 0 0 0 1 172 0 6 .7688466 0 0 0 0 0 0 0 0 0 0 0 0 0 1 173 0 6 .7708621 0 0 0 0 0 0 0 0 0 0 0 0 0 1 174 0 6 .764181 0 0 0 0 0 0 0 0 0 0 0 0 0 1 175 0 6 .7689334 0 0 0 0 0 0 0 0 0 0 0 0 0 1 176 0 6 .7696679 0 0 0 0 0 0 0 0 0 0 0 0 0 1 177 0 6 .7451332 0 0 0 0 0 0 0 0 0 0 0 0 0 1 178 0 6 .755814 0 0 0 0 0 0 0 0 0 0 0 0 0 1 179 0 6 .7509971 0 0 0 0 0 0 0 0 0 0 0 0 0 1 180 0 6 .7730986 0 0 0 0 0 0 0 0 0 0 0 0 0 1 181 0 6 .7907968 0 0 0 0 0 0 0 0 0 0 0 0 0 1 182 0 6 .7697361 0 0 0 0 0 0 0 0 0 0 0 0 0 1 183 0 6 .7392074 0 0 0 0 0 0 0 0 0 0 0 0 0 1 184 0 6 .7659248 0 0 0 0 0 0 0 0 0 0 0 0 0 1 185 0 6 .767098 0 0 0 0 0 0 0 0 0 0 0 0 0 1 186 0 6 .7616657 0 0 0 0 0 0 0 0 0 0 0 0 0 1 187 0 6 .7849947 0 0 0 0 0 0 0 0 0 0 0 0 0 1 188 0 6 .7597136 0 0 0 0 0 0 0 0 0 0 0 0 0 1 189 0 6 .7601928 0 0 0 0 0 0 0 0 0 0 0 0 0 1 190 0 6 .7775874 0 0 0 0 0 0 0 0 0 0 0 0 0 1 191 0 6 .7807354 0 0 0 0 0 0 0 0 0 0 0 0 0 1 192 0 6 .7515444 0 0 0 0 0 0 0 0 0 0 0 0 0 1 193 0 6 .7349452 0 0 0 0 0 0 0 0 0 0 0 0 0 1 194 0 6 .7434267 0 0 0 0 0 0 0 0 0 0 0 0 0 1 195 0 6 end format %tq time
Initially, I successfully ran the DiD and was able to calculate the total effect in each event-time period of the policy in "small geographies" using margins:
Code:
foreach outcome in `outcomes' { use "$fin_data/fig5_data_illicit.dta", clear forval i=2/6 { reghdfe `outcome' i.cq tb_6 tb_5 tb_4 tb_3 tb_2 t_0 ta_1 /// ta_2 ta_3 ta_4 ta_5 ta_6 smallillicit /// intsmall_tb_6 intsmall_tb_5 /// intsmall_tb_4 intsmall_tb_3 /// intsmall_tb_2 intsmall_0 /// intsmall_ta_1 intsmall_ta_2 /// intsmall_ta_3 intsmall_ta_4 /// intsmall_ta_5 intsmall_ta_6 /// [fweight=civpop], /// absorb(i.statefip) vce(cluster statefip) margins, expression(_b[tb_`i']+_b[intsmall_tb_`i']) post qui esttab, ci mat ci_tb`i' = r(coefs) } }
Code:
. foreach outcome in `outcomes' { 2. . use "$fin_data/fig5_data_illicit.dta", clear 3. est clear 4. csdid `outcome' intsmall*, ivar(statefip) time(time) gvar(treat_qpdmp) agg(event) 5. . *store event study statistics/estimates . estat event , window(-6, 6) esave(m1) replace // save only the prior 6 and post 6 estimates 6. . **#: MARGINS TEST . margins, expression(_b[e(b)[1,3]]) // THE PROBLEM HERE IS THAT NOT SURE WHICH COEFICEIENTS IN OUTPUT TO USE TO GET THE TOTAL EFFECT 7. . *load and store event study stats in a matrix and save matrix as .dta file . estimates use m1 8. mat list r(table) 9. matrix table = r(table) 10. matsave table, replace saving path("$fin_data") 11. . *load event study stats .dta file for formatting. Goal is to create 2way graph . use "$fin_data/table.dta", clear 12. . * drop extraneous rows and vars . drop if _rowname == "eform" | _rowname == "df" 13. drop Pre_avg Post_avg 14. . * rename and reshape for formatting reasons . rename (Tm6 Tm5 Tm4 Tm3 Tm2 Tm1 Tp0 Tp1 Tp2 Tp3 Tp4 Tp5 Tp6) /// > (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12) 15. reshape long T, i(_rowname) j(time) 16. . * keep only coef and CI bands estimates. merge into one .dta file . keep if _rowname == "b" | _rowname == "ll" | _rowname == "ul" 17. preserve 18. keep if _rowname == "ll" 19. rename T ci_lower 20. tempfile ll 21. save `ll' 22. restore 23. preserve 24. keep if _rowname == "ul" 25. rename T ci_upper 26. tempfile ul 27. save `ul' 28. restore 29. . keep if _rowname == "b" 30. rename T coef 31. . * merge in the lower CI estimate column . merge 1:1 time using `ll' 32. drop _merge 33. . * merge in the upper CI estimate column . merge 1:1 time using `ul' 34. drop _merge _rowname 35. . * define time value labels and apply . label define time_csdid 0 "-6" 1 "-5" 2"-4" 3 "-3" 4 "-2" 5 "-1" /// > 6 "0" 7 "+1" 8 "+2" 9 "+3" 10 "+4" 11 "+5" 12 "+6" 36. label values time time_csdid 37. . . graph twoway /// > (rcap ci_upper ci_lower time, /// > lstyle(thin) lcolor(gs13) lwidth(*2) msize(vtiny)) /// > (scatter coef time, /// > graphregion(color(white)) bgcolor(white) /// > msymbol(circle) msize(small) mcolor(purple) /// > title("Difference: `cpsquarterly_`outcome''") /// > xtitle("`xtitle'", size(small) height(5)) /// > ytitle("`c_`outcome''") /// > xlabel(0(1)12,labsize(vsmall) valuelabel) /// > ylabel(,labsize(vsmall) nogrid angle(0)) /// > yline(0, lpattern(dot) lwidth(thin) lcolor(black)) /// > xline(5, lwidth(vthin) lcolor(black)) /// > plotregion(lstyle(none)) graphregion(margin(zero)) /// > legend(off)), /// > name("csdid_`outcome'_g3", replace) 38. . graph export "$graphs/Figure 5/`date'/csdid_`outcome'_diff.png", replace 39. } .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ..................................... Difference-in-difference with Multiple Time Periods Number of obs = 7,344 Outcome model : weighted least squares Treatment model: inverse probability tilting ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- T-128 | -.0038994 .002398 -1.63 0.104 -.0085994 .0008007 T-127 | .011263 .0069984 1.61 0.108 -.0024537 .0249797 T-126 | -.0029164 .0060814 -0.48 0.632 -.0148358 .0090029 T-125 | -.0071741 .0041964 -1.71 0.087 -.0153989 .0010508 T-124 | .0086744 .0026999 3.21 0.001 .0033827 .0139661 T-123 | -.0029752 .0028089 -1.06 0.290 -.0084805 .0025302 T-122 | -.0049747 .0044493 -1.12 0.264 -.0136952 .0037457 T-121 | .0024769 .0040247 0.62 0.538 -.0054114 .0103653 T-120 | .0024723 .003154 0.78 0.433 -.0037093 .0086539 T-119 | -.0035079 .0033814 -1.04 0.300 -.0101354 .0031195 T-118 | .0034128 .0032696 1.04 0.297 -.0029954 .0098211 T-117 | .004966 .001937 2.56 0.010 .0011696 .0087624 T-116 | -.0013375 .0029865 -0.45 0.654 -.0071908 .0045159 T-115 | -.0001271 .0021956 -0.06 0.954 -.0044305 .0041763 T-114 | .001878 .0031095 0.60 0.546 -.0042166 .0079726 T-113 | -.0015993 .0028235 -0.57 0.571 -.0071332 .0039346 T-112 | .0035643 .0045386 0.79 0.432 -.0053312 .0124598 T-111 | .0022065 .0032561 0.68 0.498 -.0041752 .0085883 T-110 | -.0061921 .0021869 -2.83 0.005 -.0104784 -.0019058 T-109 | -.0028732 .0023366 -1.23 0.219 -.007453 .0017065 T-108 | -.0017538 .0016822 -1.04 0.297 -.0050508 .0015433 T-107 | .0002055 .0024355 0.08 0.933 -.004568 .0049791 T-106 | .0007294 .0025281 0.29 0.773 -.0042256 .0056844 T-105 | -.002054 .0025307 -0.81 0.417 -.0070141 .0029061 T-104 | -.0023996 .002338 -1.03 0.305 -.0069819 .0021827 T-103 | -.0011283 .0031629 -0.36 0.721 -.0073274 .0050708 T-102 | .0029173 .0022172 1.32 0.188 -.0014284 .007263 T-101 | -.001756 .0030409 -0.58 0.564 -.007716 .004204 T-100 | -.0033694 .0027438 -1.23 0.219 -.0087472 .0020085 T-99 | -.0029343 .0027502 -1.07 0.286 -.0083247 .002456 T-98 | -.0005361 .0028091 -0.19 0.849 -.0060418 .0049695 T-97 | -.0021415 .0021108 -1.01 0.310 -.0062787 .0019956 T-96 | -.0000833 .0033721 -0.02 0.980 -.0066924 .0065259 T-95 | .0018972 .0028361 0.67 0.504 -.0036615 .0074558 T-94 | -.0038235 .0033355 -1.15 0.252 -.0103609 .002714 T-93 | -.0012526 .0043483 -0.29 0.773 -.0097751 .0072699 T-92 | .0027288 .0027234 1.00 0.316 -.002609 .0080666 T-91 | -.0012465 .0031355 -0.40 0.691 -.0073919 .0048989 T-90 | -.0013619 .0039355 -0.35 0.729 -.0090753 .0063515 T-89 | .0051595 .0029894 1.73 0.084 -.0006996 .0110186 T-88 | -.0019034 .0037745 -0.50 0.614 -.0093013 .0054945 T-87 | -.0045874 .00252 -1.82 0.069 -.0095266 .0003518 T-86 | -.0012883 .0033857 -0.38 0.704 -.0079241 .0053475 T-85 | .0075664 .0024828 3.05 0.002 .0027002 .0124325 T-84 | .0024097 .0038059 0.63 0.527 -.0050498 .0098692 T-83 | -.0004293 .002227 -0.19 0.847 -.0047942 .0039355 T-82 | -.0010582 .0019803 -0.53 0.593 -.0049394 .0028231 T-81 | -.0023748 .0019575 -1.21 0.225 -.0062115 .0014619 T-80 | .0024216 .003036 0.80 0.425 -.0035287 .008372 T-79 | -.0001846 .0035462 -0.05 0.958 -.007135 .0067657 T-78 | .001593 .0030387 0.52 0.600 -.0043628 .0075488 T-77 | -.003404 .0029436 -1.16 0.248 -.0091733 .0023653 T-76 | .0000364 .0030397 0.01 0.990 -.0059213 .0059941 T-75 | .0065255 .0028417 2.30 0.022 .0009559 .0120951 T-74 | -.0028602 .002865 -1.00 0.318 -.0084755 .0027552 T-73 | .0011511 .0028124 0.41 0.682 -.0043611 .0066632 T-72 | -.0033078 .0035737 -0.93 0.355 -.0103121 .0036965 T-71 | .0018136 .0028645 0.63 0.527 -.0038006 .0074279 T-70 | .0003638 .0030569 0.12 0.905 -.0056276 .0063552 T-69 | .0014643 .002361 0.62 0.535 -.0031631 .0060917 T-68 | .0008133 .003283 0.25 0.804 -.0056213 .0072478 T-67 | -.0038067 .0027904 -1.36 0.172 -.0092757 .0016623 T-66 | -.0009422 .003207 -0.29 0.769 -.0072279 .0053434 T-65 | .0017713 .0029168 0.61 0.544 -.0039454 .0074881 T-64 | .0027834 .0033562 0.83 0.407 -.0037945 .0093614 T-63 | .0003457 .0030793 0.11 0.911 -.0056897 .0063811 T-62 | -.0002905 .003587 -0.08 0.935 -.0073209 .0067399 T-61 | .0035518 .0022845 1.55 0.120 -.0009257 .0080293 T-60 | -.0007902 .0029157 -0.27 0.786 -.0065049 .0049244 T-59 | .0040283 .0032535 1.24 0.216 -.0023484 .0104049 T-58 | -.0063999 .0026296 -2.43 0.015 -.0115538 -.0012461 T-57 | .0028872 .0026871 1.07 0.283 -.0023793 .0081538 T-56 | -.0014128 .0023458 -0.60 0.547 -.0060105 .0031849 T-55 | -.0011947 .0024568 -0.49 0.627 -.00601 .0036205 T-54 | .0020811 .0020269 1.03 0.305 -.0018915 .0060537 T-53 | -.0004961 .0032295 -0.15 0.878 -.0068257 .0058336 T-52 | -.0006216 .0027893 -0.22 0.824 -.0060886 .0048454 T-51 | -.0005572 .0031187 -0.18 0.858 -.0066697 .0055553 T-50 | .0047685 .0021391 2.23 0.026 .0005759 .0089611 T-49 | -.0052805 .0030655 -1.72 0.085 -.0112887 .0007277 T-48 | .0025296 .0026271 0.96 0.336 -.0026195 .0076787 T-47 | -.0020436 .0025257 -0.81 0.418 -.0069939 .0029068 T-46 | -.0003554 .0023396 -0.15 0.879 -.004941 .0042301 T-45 | .0019743 .002164 0.91 0.362 -.0022671 .0062158 T-44 | -.0010374 .00281 -0.37 0.712 -.0065449 .0044701 T-43 | .0058304 .0024319 2.40 0.017 .001064 .0105968 T-42 | -.0026484 .0036348 -0.73 0.466 -.0097725 .0044757 T-41 | .0001173 .0036966 0.03 0.975 -.007128 .0073626 T-40 | -.0024488 .0032077 -0.76 0.445 -.0087357 .0038381 T-39 | -.0010829 .0017788 -0.61 0.543 -.0045693 .0024034 T-38 | -.0012993 .0026665 -0.49 0.626 -.0065255 .0039268 T-37 | .0032848 .0025825 1.27 0.203 -.0017767 .0083464 T-36 | -.0053405 .0025026 -2.13 0.033 -.0102455 -.0004355 T-35 | .0006545 .0031029 0.21 0.833 -.0054271 .0067361 T-34 | .0023185 .0017974 1.29 0.197 -.0012044 .0058414 T-33 | -.001526 .0030538 -0.50 0.617 -.0075114 .0044594 T-32 | .0003437 .0031169 0.11 0.912 -.0057652 .0064527 T-31 | -.0047286 .0026527 -1.78 0.075 -.0099279 .0004707 T-30 | .0039166 .0033308 1.18 0.240 -.0026117 .0104449 T-29 | .0061783 .0031426 1.97 0.049 .0000189 .0123377 T-28 | -.0004335 .0031523 -0.14 0.891 -.0066119 .005745 T-27 | -.0020271 .0028577 -0.71 0.478 -.007628 .0035738 T-26 | .0018796 .0025069 0.75 0.453 -.0030339 .0067931 T-25 | -.0001574 .0029059 -0.05 0.957 -.0058528 .005538 T-24 | .001797 .0031501 0.57 0.568 -.004377 .0079711 T-23 | .0010855 .0034263 0.32 0.751 -.0056299 .007801 T-22 | -.0084413 .0043402 -1.94 0.052 -.0169479 .0000653 T-21 | .0039316 .0031939 1.23 0.218 -.0023282 .0101915 T-20 | .0053024 .0023553 2.25 0.024 .000686 .0099187 T-19 | -.000722 .0038188 -0.19 0.850 -.0082068 .0067627 T-18 | -.0041015 .0040248 -1.02 0.308 -.0119899 .0037869 T-17 | -.0012231 .0024455 -0.50 0.617 -.0060163 .00357 T-16 | -.000033 .0033951 -0.01 0.992 -.0066873 .0066213 T-15 | .0072438 .0025245 2.87 0.004 .0022958 .0121917 T-14 | -.0006471 .0024552 -0.26 0.792 -.0054593 .0041651 T-13 | -.0045405 .0022248 -2.04 0.041 -.0089009 -.00018 T-12 | -.0057636 .0028684 -2.01 0.045 -.0113856 -.0001417 T-11 | .0059804 .0039886 1.50 0.134 -.0018371 .0137979 T-10 | -.0030996 .003193 -0.97 0.332 -.0093579 .0031586 T-9 | .0007201 .0032885 0.22 0.827 -.0057252 .0071653 T-8 | .0023677 .0023576 1.00 0.315 -.0022531 .0069884 T-7 | -.0003027 .0029223 -0.10 0.917 -.0060304 .005425 T-6 | -.0023616 .0026732 -0.88 0.377 -.0076009 .0028778 T-5 | .0018408 .0033694 0.55 0.585 -.004763 .0084447 T-4 | -.0006476 .0029742 -0.22 0.828 -.006477 .0051818 T-3 | .0010017 .0033283 0.30 0.763 -.0055217 .0075251 T-2 | .0029037 .0037752 0.77 0.442 -.0044956 .010303 T-1 | -.0061838 .0032727 -1.89 0.059 -.0125982 .0002306 T+0 | .0081809 .0028068 2.91 0.004 .0026796 .0136822 T+1 | -.0023625 .003672 -0.64 0.520 -.0095594 .0048344 T+2 | -.0040996 .0034869 -1.18 0.240 -.0109339 .0027346 T+3 | .0019913 .0044057 0.45 0.651 -.0066437 .0106263 T+4 | -.0039832 .0044561 -0.89 0.371 -.012717 .0047507 T+5 | -.0011873 .0050038 -0.24 0.812 -.0109946 .0086199 T+6 | .0015952 .005285 0.30 0.763 -.0087632 .0119535 T+7 | .0014604 .0065849 0.22 0.824 -.0114458 .0143665 T+8 | -.0045589 .0066347 -0.69 0.492 -.0175626 .0084449 T+9 | .0008087 .0055703 0.15 0.885 -.010109 .0117264 T+10 | .0002163 .0048391 0.04 0.964 -.0092682 .0097008 T+11 | .000389 .0059787 0.07 0.948 -.011329 .0121071 T+12 | -.0005101 .0062377 -0.08 0.935 -.0127358 .0117156 T+13 | .0041018 .005362 0.76 0.444 -.0064074 .0146111 T+14 | .010907 .0060666 1.80 0.072 -.0009833 .0227973 T+15 | .0049799 .0047421 1.05 0.294 -.0043144 .0142742 T+16 | .0057155 .00659 0.87 0.386 -.0072006 .0186317 T+17 | .003413 .0079198 0.43 0.667 -.0121096 .0189356 T+18 | -.0016702 .0066542 -0.25 0.802 -.0147123 .0113719 T+19 | -.0003214 .005816 -0.06 0.956 -.0117204 .0110777 T+20 | .0014124 .0077852 0.18 0.856 -.0138463 .0166712 T+21 | -.0028021 .008095 -0.35 0.729 -.018668 .0130638 T+22 | -.0016207 .0081708 -0.20 0.843 -.0176351 .0143938 T+23 | .0019917 .0077358 0.26 0.797 -.0131703 .0171536 T+24 | .0019442 .0064272 0.30 0.762 -.0106528 .0145412 T+25 | .0024827 .0071242 0.35 0.727 -.0114805 .0164459 T+26 | -.0179738 .0159027 -1.13 0.258 -.0491425 .0131949 T+27 | -.0074342 .0139019 -0.53 0.593 -.0346814 .0198129 T+28 | .0050378 .0118902 0.42 0.672 -.0182667 .0283422 T+29 | .0113423 .0182562 0.62 0.534 -.0244392 .0471238 T+30 | .0302177 .0040121 7.53 0.000 .0223541 .0380814 ------------------------------------------------------------------------------ Control: Never Treated See Callaway and Sant'Anna (2021) for details ATT by Periods Before and After treatment Event Study:Dynamic effects file m1.ster saved ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Pre_avg | -.0005745 .0006988 -0.82 0.411 -.001944 .0007951 Post_avg | .0000192 .003332 0.01 0.995 -.0065113 .0065498 Tm6 | -.0023616 .0026732 -0.88 0.377 -.0076009 .0028778 Tm5 | .0018408 .0033694 0.55 0.585 -.004763 .0084447 Tm4 | -.0006476 .0029742 -0.22 0.828 -.006477 .0051818 Tm3 | .0010017 .0033283 0.30 0.763 -.0055217 .0075251 Tm2 | .0029037 .0037752 0.77 0.442 -.0044956 .010303 Tm1 | -.0061838 .0032727 -1.89 0.059 -.0125982 .0002306 Tp0 | .0081809 .0028068 2.91 0.004 .0026796 .0136822 Tp1 | -.0023625 .003672 -0.64 0.520 -.0095594 .0048344 Tp2 | -.0040996 .0034869 -1.18 0.240 -.0109339 .0027346 Tp3 | .0019913 .0044057 0.45 0.651 -.0066437 .0106263 Tp4 | -.0039832 .0044561 -0.89 0.371 -.012717 .0047507 Tp5 | -.0011873 .0050038 -0.24 0.812 -.0109946 .0086199 Tp6 | .0015952 .005285 0.30 0.763 -.0087632 .0119535 ------------------------------------------------------------------------------ warning: option expression() does not contain option predict() or xb(). variable T not found r(111); end of do-file r(111);
(1) Am I correct in retaining only the prior 6 and post 6 estimates if I am interested in considering the trends in outcome 6 periods prior to the policy and 6 periods post the policy (see line 5 of my code)? My suspicion is that this is incorrect as the event time estimates for the 6 periods pre and post must be a weighted average of the 159 coefficients in the output table?
(2) How can I do a post csdid margins, similar to "margins, expression(_b[tb_`i']+_b[intsmall_tb_`i']) post " to calculate the total effect at each event time.
Many thanks in advance for your help. And apologies for some basic questions.
Sincerely,
Sumedha
0 Response to Margins after csdid.
Post a Comment