Yes it would
you cannot add this type of fixed effect, since they would be colinear with the County fixed effect
you cannot add this type of fixed effect, since they would be colinear with the County fixed effect
use https://friosavila.github.io/playingwithstata/drdid/mpdta.dta, clear gen state=0 in 1/500 replace state=1 in 501/1000 replace state=2 in 1001/1500 replace state=3 in 1501/2000 replace state=4 in 2001/2500 bysort countyreal: gen treatment=(year>=first_treat) replace treatment=0 if first_treat==0 reghdfe lemp treatment, absorb(countyreal state#year)
csdid2 lemp state, ivar(countyreal) time(year) gvar(first_treat) csdid2 lemp i.state, ivar(countyreal) time(year) gvar(first_treat)
. csdid2 lemp state, ivar(countyreal) time(year) gvar(first_treat) Producing Long Gaps by default Using method dripw ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 ............ . estat event ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Pre_avg | .0169285 .0173361 0.98 0.329 -.0170496 .0509065 Post_avg | -.1280806 .0264225 -4.85 0.000 -.1798678 -.0762935 tm4 | .0030356 .0248078 0.12 0.903 -.0455869 .051658 tm3 | .024782 .0184956 1.34 0.180 -.0114686 .0610327 tm2 | .0229677 .0145274 1.58 0.114 -.0055055 .051441 tp0 | -.0237983 .0121392 -1.96 0.050 -.0475907 -5.90e-06 tp1 | -.0718211 .0200747 -3.58 0.000 -.1111669 -.0324753 tp2 | -.2301203 .046353 -4.96 0.000 -.3209706 -.1392701 tp3 | -.1865828 .0478486 -3.90 0.000 -.2803644 -.0928012 ------------------------------------------------------------------------------ . csdid lemp state, ivar(countyreal) time(year) gvar(first_treat) ............ . estat event ATT by Periods Before and After treatment Event Study:Dynamic effects ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Pre_avg | .0012933 .0077151 0.17 0.867 -.0138279 .0164146 Post_avg | -.3417521 .0760209 -4.50 0.000 -.4907504 -.1927538 Tm3 | .028662 .0146971 1.95 0.051 -.0001438 .0574679 Tm2 | -.0018143 .0133592 -0.14 0.892 -.0279978 .0243692 Tm1 | -.0229677 .0145274 -1.58 0.114 -.051441 .0055055 Tp0 | -.0350765 .0155179 -2.26 0.024 -.065491 -.0046619 Tp1 | -.1653035 .0504029 -3.28 0.001 -.2640915 -.0665156 Tp2 | -.6531053 .1461919 -4.47 0.000 -.9396362 -.3665744 Tp3 | -.5135231 .1376213 -3.73 0.000 -.783256 -.2437903 ------------------------------------------------------------------------------
tab year implementation_time | implementation_time year | 2008 2009 2010 2011 2012 2013 | Total -----------+------------------------------------------------------------------+---------- 2011 | 123 202 314 227 252 138 | 10,942 2013 | 152 224 272 202 262 160 | 11,622 2015 | 140 255 300 243 249 179 | 12,068 2018 | 149 242 314 263 268 181 | 12,407 2020 | 151 253 297 253 265 171 | 12,098 -----------+------------------------------------------------------------------+---------- Total | 715 1,176 1,497 1,188 1,296 829 | 59,137 | implementation_time year | 2014 2015 2016 2017 2018 2019 | Total -----------+------------------------------------------------------------------+---------- 2011 | 267 1,837 796 5,425 407 522 | 10,942 2013 | 342 1,954 874 5,727 424 521 | 11,622 2015 | 342 2,020 895 5,850 462 574 | 12,068 2018 | 358 1,946 935 6,110 481 609 | 12,407 2020 | 335 2,017 887 5,973 489 589 | 12,098 -----------+------------------------------------------------------------------+---------- Total | 1,644 9,774 4,387 29,085 2,263 2,815 | 59,137 | implementa | tion_time year | 2020 | Total -----------+-----------+---------- 2011 | 432 | 10,942 2013 | 508 | 11,622 2015 | 559 | 12,068 2018 | 551 | 12,407 2020 | 418 | 12,098 -----------+-----------+---------- Total | 2,468 | 59,137
replace year=2001 if year==2011 replace year=2003 if year==2013 replace year=2005 if year==2015 replace year=2007 if year==2018 replace year=2009 if year==2020 tab year implementation_time replace implementation_time=2001 if implementation_time<=2011 replace implementation_time=2002 if implementation_time==2012 replace implementation_time=2003 if implementation_time==2013 replace implementation_time=2004 if implementation_time==2014 replace implementation_time=2005 if implementation_time==2015 replace implementation_time=2006 if implementation_time==2016 replace implementation_time=2006 if implementation_time==2017 replace implementation_time=2007 if implementation_time==2018 replace implementation_time=2008 if implementation_time==2019 replace implementation_time=2009 if implementation_time==2020
. csdid retire $x, ivar(ID) time(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) agg(simple) Units always treated found. These will be ignored Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) .xxx...x...x...x...x.xxx.xxxxxxx Difference-in-difference with Multiple Time Periods Number of obs = 13,858 Outcome model : least squares Treatment model: inverse probability (Std. err. adjusted for 100 clusters in CITY) ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- ATT | 0.034 0.030 1.14 0.254 -0.025 0.093 ------------------------------------------------------------------------------ Control: Not yet Treated See Callaway and Sant'Anna (2021) for details . estat group ATT by group ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- GAverage | 0.052 0.032 1.63 0.103 -0.011 0.115 G2002 | 0.098 0.010 9.89 0.000 0.079 0.118 G2003 | -0.066 0.038 -1.73 0.083 -0.142 0.009 G2004 | 0.110 0.057 1.94 0.053 -0.001 0.220 G2005 | -0.032 0.048 -0.66 0.506 -0.127 0.063 G2006 | 0.086 0.049 1.75 0.080 -0.010 0.183 ------------------------------------------------------------------------------ . estat calendar ATT by Calendar Period ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- CAverage | 0.028 0.025 1.14 0.256 -0.020 0.076 T2003 | 0.095 0.020 4.64 0.000 0.055 0.135 T2005 | -0.079 0.051 -1.54 0.123 -0.179 0.021 T2007 | 0.068 0.034 2.02 0.044 0.002 0.133 ------------------------------------------------------------------------------
. csdid2 retire $x, ivar(ID) tvar(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) agg(simple) Producing Long Gaps by default Using method dripw Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 x.xxxxxxxx.xx.x.xxxxx.x.xx.xxxxxxx.xxxx Difference-in-difference with Multiple Time Periods Outcome model : least squares Treatment model: inverse probability ------------------------------------------------------------------------------ | Robust | Coefficient std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- SimpleATT | 0.096 0.040 2.42 0.016 0.018 0.174 ------------------------------------------------------------------------------ . estat group ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- GAverage | 0.094 0.042 2.22 0.026 0.011 0.177 g2002 | 0.097 0.010 9.78 0.000 0.078 0.117 g2004 | 0.128 0.061 2.08 0.037 0.007 0.248 g2006 | 0.092 0.049 1.87 0.062 -0.005 0.188 ------------------------------------------------------------------------------ . estat calendar ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- TAverage | 0.079 0.026 3.00 0.003 0.027 0.131 t2003 | 0.097 0.010 9.78 0.000 0.078 0.117 t2005 | 0.040 0.065 0.60 0.546 -0.089 0.168 t2007 | 0.100 0.045 2.23 0.026 0.012 0.188 ------------------------------------------------------------------------------
. csdid retire $x, ivar(ID) time(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) Units always treated found. These will be ignored Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) .xxx...x...x...x...x.xxx.xxxxxxx Difference-in-difference with Multiple Time Periods Number of obs = 13,858 Outcome model : least squares Treatment model: inverse probability (Std. err. adjusted for 100 clusters in CITY) ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2002 | t_2001_2003 | 0.098 0.010 9.89 0.000 0.079 0.118 t_2001_2005 | 0.000 (omitted) t_2001_2007 | 0.000 (omitted) t_2001_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2003 | t_2001_2003 | 0.089 0.050 1.78 0.075 -0.009 0.186 t_2001_2005 | -0.275 0.057 -4.80 0.000 -0.388 -0.163 t_2001_2007 | -0.276 0.148 -1.86 0.063 -0.567 0.015 t_2001_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2004 | t_2001_2003 | -0.187 0.072 -2.60 0.009 -0.328 -0.046 t_2003_2005 | 0.040 0.065 0.60 0.546 -0.089 0.168 t_2003_2007 | 0.169 0.081 2.07 0.038 0.009 0.328 t_2003_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2005 | t_2001_2003 | 0.037 0.041 0.89 0.372 -0.044 0.117 t_2003_2005 | -0.085 0.056 -1.51 0.130 -0.195 0.025 t_2003_2007 | 0.013 0.051 0.26 0.798 -0.086 0.112 t_2003_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2006 | t_2001_2003 | -0.008 0.032 -0.25 0.805 -0.070 0.054 t_2003_2005 | -0.004 0.044 -0.10 0.919 -0.091 0.082 t_2005_2007 | 0.086 0.049 1.75 0.080 -0.010 0.183 t_2005_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2007 | t_2001_2003 | 0.001 0.095 0.01 0.988 -0.186 0.188 t_2003_2005 | 0.000 (omitted) t_2005_2007 | 0.000 (omitted) t_2005_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2008 | t_2001_2003 | -0.030 0.073 -0.42 0.676 -0.173 0.112 t_2003_2005 | 0.000 (omitted) t_2005_2007 | 0.000 (omitted) t_2007_2009 | 0.000 (omitted) -------------+---------------------------------------------------------------- g2009 | t_2001_2003 | 0.000 (omitted) t_2003_2005 | 0.000 (omitted) t_2005_2007 | 0.000 (omitted) t_2007_2009 | 0.000 (omitted) ------------------------------------------------------------------------------ Control: Not yet Treated
. csdid2 retire $x, ivar(ID) tvar(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) Producing Long Gaps by default Using method dripw Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 x.xxxxxxxx.xx.x.xxxxx.x.xx.xxxxxxx.xxxx . estat attgt ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2002 | t2001_2003 | 0.097 0.010 9.78 0.000 0.078 0.117 -------------+---------------------------------------------------------------- g2004 | t2001_2003 | 0.187 0.072 2.60 0.009 0.046 0.328 t2003_2005 | 0.040 0.065 0.60 0.546 -0.089 0.168 t2003_2007 | 0.200 0.083 2.43 0.015 0.039 0.362 -------------+---------------------------------------------------------------- g2006 | t2001_2005 | 0.034 0.044 0.76 0.448 -0.053 0.121 t2003_2005 | 0.002 0.045 0.06 0.955 -0.085 0.090 t2005_2007 | 0.092 0.049 1.87 0.062 -0.005 0.188 -------------+---------------------------------------------------------------- g2008 | t2003_2007 | -0.220 0.099 -2.22 0.026 -0.414 -0.026 ------------------------------------------------------------------------------
. csdid2 retire $x, ivar(ID) tvar(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) agg(attgt) Producing Long Gaps by default Using method dripw Always Treated units have been excluded Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 x.xxxxxxxxx.xx.xx.xxxxx.x.xxxxxxxxxxxxxxx.xxxxx Difference-in-difference with Multiple Time Periods Outcome model : least squares Treatment model: inverse probability ------------------------------------------------------------------------------ | Robust | Coefficient std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2012 | t2011_2013 | 0.097 0.010 9.78 0.000 0.078 0.117 -------------+---------------------------------------------------------------- g2014 | t2011_2013 | 0.187 0.072 2.60 0.009 0.046 0.328 t2013_2015 | 0.040 0.065 0.60 0.546 -0.089 0.168 t2013_2018 | 0.200 0.083 2.43 0.015 0.039 0.362 -------------+---------------------------------------------------------------- g2016 | t2011_2015 | -0.028 0.044 -0.64 0.524 -0.115 0.059 t2013_2015 | 0.011 0.025 0.44 0.657 -0.038 0.061 -------------+---------------------------------------------------------------- g2019 | t2013_2018 | -0.220 0.099 -2.22 0.026 -0.414 -0.026 ------------------------------------------------------------------------------
. csdid2 retire $x, ivar(ID) tvar(year) gvar(implementation_time) method(dripw) notyet cluster(CITY) agg(attgt) Producing Long Gaps by default Using method dripw Always Treated units have been excluded Panel is not balanced Will use observations with Pair balanced (observed at t0 and t1) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 x.x.xx.xxxxx.xx.xx.xxxxx.x.xxx.xxxxxxxxx.x.x.xxx Difference-in-difference with Multiple Time Periods Outcome model : least squares Treatment model: inverse probability ------------------------------------------------------------------------------ | Robust | Coefficient std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2012 | t2011_2013 | 0.094 0.011 8.33 0.000 0.072 0.116 t2011_2015 | -0.000 0.019 -0.01 0.990 -0.037 0.037 t2011_2018 | 0.243 0.068 3.55 0.000 0.109 0.377 -------------+---------------------------------------------------------------- g2014 | t2011_2013 | 0.195 0.070 2.78 0.005 0.058 0.332 t2013_2015 | 0.039 0.067 0.58 0.559 -0.093 0.171 t2013_2018 | 0.148 0.070 2.11 0.035 0.010 0.285 -------------+---------------------------------------------------------------- g2016 | t2011_2015 | -0.026 0.038 -0.68 0.498 -0.101 0.049 t2013_2015 | 0.009 0.025 0.37 0.709 -0.039 0.058 t2015_2018 | 0.203 0.066 3.07 0.002 0.073 0.332 -------------+---------------------------------------------------------------- g2019 | t2011_2018 | -0.289 0.074 -3.89 0.000 -0.435 -0.144 t2013_2018 | -0.244 0.077 -3.15 0.002 -0.396 -0.093 t2015_2018 | 0.253 0.106 2.39 0.017 0.046 0.461 ------------------------------------------------------------------------------ .
. tab year implementation_time | implementation_time year | 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | Total -----------+--------------------------------------------------------------------------------------------------------------+---------- 2011 | 123 202 314 227 252 138 267 1,837 796 5,425 | 10,942 2013 | 152 224 272 202 262 160 342 1,954 874 5,727 | 11,622 2015 | 140 255 300 243 249 179 342 2,020 895 5,850 | 12,068 2018 | 149 242 314 263 268 181 358 1,946 935 6,110 | 12,407 2020 | 151 253 297 253 265 171 335 2,017 887 5,973 | 12,098 -----------+--------------------------------------------------------------------------------------------------------------+---------- Total | 715 1,176 1,497 1,188 1,296 829 1,644 9,774 4,387 29,085 | 59,137 | implementation_time year | 2018 2019 2020 | Total -----------+---------------------------------+---------- 2011 | 407 522 432 | 10,942 2013 | 424 521 508 | 11,622 2015 | 462 574 559 | 12,068 2018 | 481 609 551 | 12,407 2020 | 489 589 418 | 12,098 -----------+---------------------------------+---------- Total | 2,263 2,815 2,468 | 59,137
. estat attgt ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2012 | t2011_2013 | 0.094 0.011 8.33 0.000 0.072 0.116 t2011_2015 | -0.000 0.019 -0.01 0.990 -0.037 0.037 t2011_2018 | 0.243 0.068 3.55 0.000 0.109 0.377 -------------+---------------------------------------------------------------- g2014 | t2011_2013 | 0.195 0.070 2.78 0.005 0.058 0.332 t2013_2015 | 0.039 0.067 0.58 0.559 -0.093 0.171 t2013_2018 | 0.148 0.070 2.11 0.035 0.010 0.285 -------------+---------------------------------------------------------------- g2016 | t2011_2015 | -0.026 0.038 -0.68 0.498 -0.101 0.049 t2013_2015 | 0.009 0.025 0.37 0.709 -0.039 0.058 t2015_2018 | 0.203 0.066 3.07 0.002 0.073 0.332 -------------+---------------------------------------------------------------- g2019 | t2011_2018 | -0.289 0.074 -3.89 0.000 -0.435 -0.144 t2013_2018 | -0.244 0.077 -3.15 0.002 -0.396 -0.093 t2015_2018 | 0.253 0.106 2.39 0.017 0.046 0.461 ------------------------------------------------------------------------------
. estat attgt ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- g2012 | t2011_2013 | 0.094 0.011 8.33 0.000 0.072 0.116 t2011_2015 | -0.000 0.019 -0.01 0.990 -0.037 0.037 t2011_2018 | 0.243 0.068 3.55 0.000 0.109 0.377 -------------+---------------------------------------------------------------- g2014 | t2011_2013 | 0.195 0.070 2.78 0.005 0.058 0.332 t2013_2015 | 0.039 0.067 0.58 0.559 -0.093 0.171 t2013_2018 | 0.148 0.070 2.11 0.035 0.010 0.285 -------------+---------------------------------------------------------------- g2016 | t2011_2015 | -0.026 0.038 -0.68 0.498 -0.101 0.049 t2013_2015 | 0.009 0.025 0.37 0.709 -0.039 0.058 t2015_2018 | 0.203 0.066 3.07 0.002 0.073 0.332 ------------------------------------------------------------------------------
Comment