Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Effect of Changing the Time Intervals on the Coefficients in Event Study

    I have a panel dataset with data for 5 cities over 10 years. The policy starts from the 5th year, with cities 1, 3, and 5 treated, and cities 2 and 4 serving as controls.

    This is a standard difference-in-differences.I encountered issues when examining parallel trends.

    First, I looked at parallel trends in two-year intervals, where the first and second years were labeled as d_2, the third and fourth years as d_1, the fifth and sixth years as d0 (baseline), the seventh and eighth years as d1, and the ninth and tenth years as d2. The regression codes and results were as follows.
    Code:
    gen _tintra=.
    replace _tintra=-2 if year==1|year==2
    replace _tintra=-1 if year==3|year==4
    replace _tintra=0 if year==5|year==6
    replace _tintra=1 if year==7|year==8
    replace _tintra=2 if year==9|year==10
    tab _tintra, missing
    forvalues t=2(-1)1{
      gen d_`t'=(_tintra == -`t' & treated==1)
    }
    forvalues t=1/2{
      gen  d`t'=(_tintra == +`t' & treated==1)
    }
    reghdfe y d_2-d_1 d1-d2 , a(city year i.city#c.year) cl(city)
    Code:
     reghdfe y d_2-d_1 d1-d2 , a(city year i.city#c.year) cl(city)
    (MWFE estimator converged in 3 iterations)
    warning: missing F statistic; dropped variables due to collinearity or too few clusters
    
    HDFE Linear regression                            Number of obs   =         50
    Absorbing 3 HDFE groups                           F(   4,      4) =          .
    Statistics robust to heteroskedasticity           Prob > F        =          .
                                                      R-squared       =     0.5326
                                                      Adj R-squared   =     0.1518
                                                      Within R-sq.    =     0.0248
    Number of clusters (city)    =          5         Root MSE        =     1.6327
    
                                       (Std. err. adjusted for 5 clusters in city)
    ------------------------------------------------------------------------------
                 |               Robust
               y | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             d_2 |   .8833333   4.557133     0.19   0.856     -11.7693    13.53596
             d_1 |         .4   1.597524     0.25   0.815    -4.035438    4.835438
              d1 |  -1.733333   1.044199    -1.66   0.172    -4.632496    1.165829
              d2 |  -1.633333   3.542602    -0.46   0.669    -11.46917    8.202507
           _cons |       5.45   .2365338    23.04   0.000     4.793277    6.106723
    ------------------------------------------------------------------------------

    Then, without changing d_2, d_1, and d0, I changed the ninth year from d2 to d1, still using d0 as the baseline. The regression codes and results were as follows.
    Code:
    gen _tintra=.
    replace _tintra=-2 if year==1|year==2
    replace _tintra=-1 if year==3|year==4
    replace _tintra=0 if year==5|year==6
    replace _tintra=1 if year==7|year==8|year==9
    replace _tintra=2 if year==10
    tab _tintra, missing
    
    forvalues t=2(-1)1{
      gen d_`t'=(_tintra == -`t' & treated==1)
    }
    forvalues t=1/2{
      gen  d`t'=(_tintra == +`t' & treated==1)
    }
    
    reghdfe y d_2-d_1 d1-d2 , a(city year i.city#c.year) cl(city)
    Code:
     reghdfe y d_2-d_1 d1-d2 , a(city year i.city#c.year) cl(city)
    (MWFE estimator converged in 3 iterations)
    warning: missing F statistic; dropped variables due to collinearity or too few clusters
    
    HDFE Linear regression                            Number of obs   =         50
    Absorbing 3 HDFE groups                           F(   4,      4) =          .
    Statistics robust to heteroskedasticity           Prob > F        =          .
                                                      R-squared       =     0.5583
                                                      Adj R-squared   =     0.1984
                                                      Within R-sq.    =     0.0784
    Number of clusters (city)    =          5         Root MSE        =     1.5873
    
                                       (Std. err. adjusted for 5 clusters in city)
    ------------------------------------------------------------------------------
                 |               Robust
               y | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             d_2 |  -1.630952   2.057308    -0.79   0.472    -7.342956    4.081051
             d_1 |  -.8571429   1.853294    -0.46   0.668    -6.002713    4.288427
              d1 |  -.5119048   1.722089    -0.30   0.781    -5.293192    4.269382
              d2 |   2.345238   2.835821     0.83   0.455    -5.528264    10.21874
           _cons |       5.45   .2365338    23.04   0.000     4.793277    6.106723
    ------------------------------------------------------------------------------

    Why did the coefficients of d_2 and d_1 before the shock change in the second regression? My understanding is that parallel trends are compared against the baseline, and since the baseline remains unchanged, the coefficients of d_2 and d_1 should also remain unchanged. However, the coefficients of d_2 and d_1 in the regressions changed despite the baseline (d0) remaining constant. What could be the reason for this?

    Thanks!

    Here is the data I use.
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(year city treated y _tintra d_2 d_1 d1 d2)
     1 1 1 5 -2 1 0 0 0
     2 1 1 6 -2 1 0 0 0
     3 1 1 4 -1 0 1 0 0
     4 1 1 3 -1 0 1 0 0
     5 1 1 5  0 0 0 0 0
     6 1 1 4  0 0 0 0 0
     7 1 1 5  1 0 0 1 0
     8 1 1 6  1 0 0 1 0
     9 1 1 2  1 0 0 1 0
    10 1 1 4  2 0 0 0 1
     1 2 0 3 -2 0 0 0 0
     2 2 0 7 -2 0 0 0 0
     3 2 0 8 -1 0 0 0 0
     4 2 0 3 -1 0 0 0 0
     5 2 0 5  0 0 0 0 0
     6 2 0 6  0 0 0 0 0
     7 2 0 7  1 0 0 0 0
     8 2 0 4  1 0 0 0 0
     9 2 0 7  1 0 0 0 0
    10 2 0 3  2 0 0 0 0
     1 3 1 1 -2 1 0 0 0
     2 3 1 5 -2 1 0 0 0
     3 3 1 6 -1 0 1 0 0
     4 3 1 2 -1 0 1 0 0
     5 3 1 6  0 0 0 0 0
     6 3 1 3  0 0 0 0 0
     7 3 1 3  1 0 0 1 0
     8 3 1 5  1 0 0 1 0
     9 3 1 6  1 0 0 1 0
    10 3 1 7  2 0 0 0 1
     1 4 0 7 -2 0 0 0 0
     2 4 0 6 -2 0 0 0 0
     3 4 0 5 -1 0 0 0 0
     4 4 0 4 -1 0 0 0 0
     5 4 0 5  0 0 0 0 0
     6 4 0 6  0 0 0 0 0
     7 4 0 7  1 0 0 0 0
     8 4 0 8  1 0 0 0 0
     9 4 0 5  1 0 0 0 0
    10 4 0 5  2 0 0 0 0
     1 5 1 6 -2 1 0 0 0
     2 5 1 7 -2 1 0 0 0
     3 5 1 8 -1 0 1 0 0
     4 5 1 4 -1 0 1 0 0
     5 5 1 6  0 0 0 0 0
     6 5 1 8  0 0 0 0 0
     7 5 1 9  1 0 0 1 0
     8 5 1 4  1 0 0 1 0
     9 5 1 5  1 0 0 1 0
    10 5 1 4  2 0 0 0 1
    end
    Last edited by Jenny Chen; 09 May 2024, 02:44.
Working...
X