jonathandroth / pretrends

R package for power calculations and visualization for pre-trends tests
Other
55 stars 11 forks source link

How to get the right plot for CS estimator? #6

Closed zhaoxiliang closed 10 months ago

zhaoxiliang commented 10 months ago

Hello, I use a balanced panel of He and Wang using the following code:

use "$path/workfile_AEJ", clear xtset village_id year drop if missing(l_poor_reg_rate) gen staggered = cgvo - L.cgvo drop if staggered==-1 by village_id: gen num=_N keep if num==12 xtdescribe

Then I estimate the event study coefficient using Callaway and Sant'Anna estimator as the following: . qui csdid l_poor_reg_rate, i(village_id) t(year) g(group) . estat event, window(-3 3) ATT by Periods Before and After treatment Event Study:Dynamic effects

     |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+---------------------------------------------------------------- Pre_avg | -.0580391 .052256 -1.11 0.267 -.1604589 .0443808 Post_avg | .1101785 .0952872 1.16 0.248 -.0765811 .296938 Tm3 | -.2551623 .093861 -2.72 0.007 -.4391266 -.0711981 Tm2 | -.0512017 .0921079 -0.56 0.578 -.2317299 .1293266 Tm1 | .1322468 .0862335 1.53 0.125 -.0367678 .3012613 Tp0 | .054736 .1338699 0.41 0.683 -.2076443 .3171163 Tp1 | .1959547 .1344969 1.46 0.145 -.0676543 .4595638 Tp2 | .130424 .1222815 1.07 0.286 -.1092433 .3700913 Tp3 | .0595991 .127955 0.47 0.641 -.1911881 .3103863

. matrix sigma = r(vv) . matrix beta = r(bb)

. pretrends power 0.5, pre(3/5) post(6/9) Slope for 50% power = .0995118

. pretrends, numpre(3) b(beta) v(sigma) slope(`r(slope)')

. ret list

scalars: r(LR) = .3055997749181426 r(Bayes) = .0521696677228135 r(Power) = .9551681111820828 r(slope) = .0995117791399886

macros: r(PreTrendsResults) : "PreTrendsResults"

matrices: r(results) : 8 x 6 r(delta) : 1 x 8

The first pretrends command ask the trend for power 0.5, and the second to plot it using the estimated slope, but it report power of 0.95, which should have been 0.5. I check the code of your R package and know that when doing event study estimate using reghdfe, you add the omitted benchmark coefficient 0 into the coefficient vector.

However, when using CS nonparametric estimator, there is no omitted benchmark, but it seems the command still add the zero into coefficient vector, as you can see in the plot it provided. How can I not add the zero into the cofficient vector using the pretrends command? Thanks and happy new year.

Best,

Xiliang Zhao