Announcement

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

  • Two-way fixed effect

    Hi all,

    I am evaluating a policy enacted at the country-level across Europe over the last 20 or so years which is a dummy variable (on or off). During this period, some countries had the policy the whole time (dummy=1), some countries never had (dummy=0), some countries adopted (dummy=0 then dummy=1) and some countries revoked (dummy=1 then dummy=0).
    I have panel data for the various countries across the time dimension with the dummy set to 0 or 1 (as above). I then estimate this linear model using two-way fixed effects:

    Code:
    xtreg Outcome i.dummy i.country i.year, cluster(robust)
    My understanding was that this was the common methodology for estimating 2WFE models. However, a colleague has commented that because some countries were always treated (dummy=1, e.g. UK) that the treatment effect will be colinear with the country fixed effects for (e.g.) UK and the coefficient of interest on the dummy variable will pick up some time-invariant cross-country difference.

    This makes sense to me but seems to contrast with what I have previously read about 2WFE models and seen in the empirical literature. Can anybody please point me in the direction of theoretical papers which explain this or empirical papers which deal with this; all the papers I have seen adopt a similar methodology to mine above.

    Thanks in advance for your help.
    Best,
    Rhys

  • #2
    Rhys:
    if you've -xtset- your dataset with -country- as panel identifier, why including -i.country- in the right-hand side of your regression equation?
    That said, probided that you have enough within-panel variation, I would stick with your code (omitting -i.country- from the set of predictors, though).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Treatment in your case is not necessarily absorbing, therefore I would turn to the user contributed command jwdid (preferred) or fuzzydid / did_multiplegt.

      The jwdid command comes from this paper: https://papers.ssrn.com/sol3/papers....act_id=3906345.

      There is an entire strand of literature on which units to use as controls in your case. I would stick with Wooldridge's (2021) recommendations.

      If there is no variation of the treatment within certain countries but in others, those countries with no variation in treatment (always treated) will not be used to calculate the coefficient on the treatment. They won't be dropped, just not considered for the analysis. But they will impact standard errors.

      You have constructed your treatment in a way that it is an interaction between units and time dummies, right?

      Comment


      • #4
        Originally posted by Carlo Lazzaro View Post
        Rhys:
        if you've -xtset- your dataset with -country- as panel identifier, why including -i.country- in the right-hand side of your regression equation?
        That said, probided that you have enough within-panel variation, I would stick with your code (omitting -i.country- from the set of predictors, though).
        Sorry Carlo, yes, I had xtset and didn't explicitly control for i.country (using xtreg, fe)

        Comment


        • #5
          Originally posted by Maxence Morlet View Post
          Treatment in your case is not necessarily absorbing, therefore I would turn to the user contributed command jwdid (preferred) or fuzzydid / did_multiplegt.

          The jwdid command comes from this paper: https://papers.ssrn.com/sol3/papers....act_id=3906345.

          There is an entire strand of literature on which units to use as controls in your case. I would stick with Wooldridge's (2021) recommendations.

          If there is no variation of the treatment within certain countries but in others, those countries with no variation in treatment (always treated) will not be used to calculate the coefficient on the treatment. They won't be dropped, just not considered for the analysis. But they will impact standard errors.

          You have constructed your treatment in a way that it is an interaction between units and time dummies, right?
          Thanks very much for this Maxence, I will check out Wooldridge (2021).

          My treatment is a dummy variable equal to zero in time periods (for the given unit) when the treatment does not occur and equal to one in time periods when the treatment does occur.

          Comment


          • #6
            With country fixed effects included, your identification will come only from time varying policy. That is, whether you include the countries for which the policy is always 0 or always 1, or you do not, you should be getting the same estimates. You can check this -- flag the countries for which the policy is constant, exclude them from the analysis, and check that your estimate is not affected.

            You can do this flagging by

            Code:
            bysort country (year) :  gen timeconstant = policy[1] == policy[_N]
              
             xtreg Outcome i.dummy i.year if !timeconstant, fe cluster(robust)
            I think your colleague is right about the collinearity, but he misinterprets the implications. Nothing is picking up anything, it is just that time constant countries do not contribute to your identification.

            Comment


            • #7
              Originally posted by Joro Kolev View Post
              With country fixed effects included, your identification will come only from time varying policy. That is, whether you include the countries for which the policy is always 0 or always 1, or you do not, you should be getting the same estimates. You can check this -- flag the countries for which the policy is constant, exclude them from the analysis, and check that your estimate is not affected.

              You can do this flagging by

              Code:
              bysort country (year) : gen timeconstant = policy[1] == policy[_N]
              
              xtreg Outcome i.dummy i.year if !timeconstant, fe cluster(robust)
              I think your colleague is right about the collinearity, but he misinterprets the implications. Nothing is picking up anything, it is just that time constant countries do not contribute to your identification.
              Hi Joro,

              Thanks for your reply - but I am not sure I follow. Surely the treatment effect still utilises the non-varying group as a control and therefore the treatment effect picks up these policy=0 (or policy=1) countries?

              To confirm, when I flag the timeconstant and estimate not including these countries, the estimate I obtain is different (which doesn't surprise me as I was under the impression that this is acting as a control). Similarly, if I were to exclude one or multiple countries (which had a time-constant policy status) from the regression the coefficient of interest would change.

              Am I missing something?

              Thanks,
              Rhys
              Last edited by Rhys Williams; 04 Sep 2022, 11:14.

              Comment


              • #8
                Show a simple dataset where there are some countries where policy is varying, and some countries where policy is constant. And then we can look at the estimates for this sample and try and interpret them.

                Comment


                • #9
                  Here is a simple dataset that seems to fit your description:

                  Code:
                  * Example generated by -dataex-. For more info, type help dataex
                  clear
                  input byte(year id) float(policy y)
                  1 1 1  .19105333
                  2 1 1 -1.1464182
                  3 1 1  -.3711763
                  1 2 0 -.57223964
                  2 2 1  1.0031062
                  3 2 0  1.3204753
                  1 3 1  1.3777045
                  2 3 0 -.55725545
                  3 3 1  -1.053698
                  1 4 0  -.3532804
                  2 4 0  -.8009477
                  3 4 0  1.2474358
                  end

                  Here are the estimates I am getting on this dataset, and the effect of policy is the same:

                  Code:
                  . xtset id year
                  
                  Panel variable: id (strongly balanced)
                   Time variable: year, 1 to 3
                           Delta: 1 unit
                  
                  . xtreg y policy, fe
                  
                  Fixed-effects (within) regression               Number of obs     =         12
                  Group variable: id                              Number of groups  =          4
                  
                  R-squared:                                      Obs per group:
                       Within  = 0.0706                                         min =          3
                       Between = 0.4003                                         avg =        3.0
                       Overall = 0.0007                                         max =          3
                  
                                                                  F(1,7)            =       0.53
                  corr(u_i, Xb) = -0.6424                         Prob > F          =     0.4894
                  
                  ------------------------------------------------------------------------------
                             y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                        policy |   .6741236   .9241557     0.73   0.489    -1.511157    2.859405
                         _cons |  -.3133318   .5553485    -0.56   0.590    -1.626522    .9998586
                  -------------+----------------------------------------------------------------
                       sigma_u |  .64839008
                       sigma_e |  1.0671231
                           rho |  .26963834   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(3, 7) = 0.65                        Prob > F = 0.6073
                  
                  . xtreg y policy if id==2 | id==3, fe
                  
                  Fixed-effects (within) regression               Number of obs     =          6
                  Group variable: id                              Number of groups  =          2
                  
                  R-squared:                                      Obs per group:
                       Within  = 0.1131                                         min =          3
                       Between = 1.0000                                         avg =        3.0
                       Overall = 0.0358                                         max =          3
                  
                                                                  F(1,3)            =       0.38
                  corr(u_i, Xb) = -0.3333                         Prob > F          =     0.5800
                  
                  ------------------------------------------------------------------------------
                             y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                        policy |   .6741236   1.089697     0.62   0.580    -2.793779    4.142026
                         _cons |  -.0840463   .7488228    -0.11   0.918    -2.467135    2.299042
                  -------------+----------------------------------------------------------------
                       sigma_u |  .62666499
                       sigma_e |   1.258274
                           rho |  .19874316   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(1, 3) = 0.66                        Prob > F = 0.4756

                  Comment


                  • #10
                    Hi Joro,

                    So with this fictional dataset:
                    Code:
                    country    year    outcome    policy
                    1    1    10    0
                    1    2    15    0
                    1    3    16    0
                    1    4    11    0
                    1    5    12    0
                    2    1    7    1
                    2    2    5    1
                    2    3    6    1
                    2    4    9    1
                    2    5    8    1
                    3    1    21    0
                    3    2    23    0
                    3    3    25    0
                    3    4    27    1
                    3    5    29    1
                    4    1    44    1
                    4    2    40    1
                    4    3    39    1
                    4    4    41    1
                    4    5    50    0
                    The estimates I get change if we exclude country==1 or separately, country==2:

                    Code:
                     xtset country year
                           panel variable:  country (strongly balanced)
                            time variable:  year, 1 to 5
                                    delta:  1 unit
                    
                    . xtreg outcome i.policy i.year, fe cluster(country)
                    
                    Fixed-effects (within) regression               Number of obs     =         20
                    Group variable: country                         Number of groups  =          4
                    
                    R-sq:                                           Obs per group:
                         within  = 0.3036                                         min =          5
                         between = 0.0211                                         avg =        5.0
                         overall = 0.0069                                         max =          5
                    
                                                                    F(3,3)            =          .
                    corr(u_i, Xb)  = -0.0293                        Prob > F          =          .
                    
                                                    (Std. Err. adjusted for 4 clusters in country)
                    ------------------------------------------------------------------------------
                                 |               Robust
                         outcome |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                           1.policy|  -.7222222   3.521148    -0.21   0.851    -11.92809    10.48364
                                 |
                            year |
                              2  |        .25   2.348062     0.11   0.922     -7.22258     7.72258
                              3  |          1   2.892931     0.35   0.752    -8.206596     10.2066
                              4  |   1.680556   1.491944     1.13   0.342    -3.067476    6.428587
                              5  |       4.25   2.036804     2.09   0.128    -2.232019    10.73202
                                 |
                           _cons |   20.86111   3.215456     6.49   0.007     10.62809    31.09413
                    -------------+----------------------------------------------------------------
                         sigma_u |  15.874169
                         sigma_e |  3.1386319
                             rho |  .96237779   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    
                    . xtreg outcome i.policy i.year if country!=1, fe cluster(country)
                    
                    Fixed-effects (within) regression               Number of obs     =         15
                    Group variable: country                         Number of groups  =          3
                    
                    R-sq:                                           Obs per group:
                         within  = 0.6141                                         min =          5
                         between = 0.1091                                         avg =        5.0
                         overall = 0.0368                                         max =          5
                    
                                                                    F(2,2)            =          .
                    corr(u_i, Xb)  = 0.0377                         Prob > F          =          .
                    
                                                    (Std. Err. adjusted for 3 clusters in country)
                    ------------------------------------------------------------------------------
                                 |               Robust
                         outcome |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                           1.policy|  -1.115385   2.033778    -0.55   0.638    -9.866024    7.635255
                                 |
                            year |
                              2  |  -1.333333   2.199888    -0.61   0.606    -10.79869     8.13202
                              3  |  -.6666667   3.247031    -0.21   0.856    -14.63751    13.30418
                              4  |   2.038462   2.975498     0.69   0.564    -10.76407      14.841
                              5  |          5   2.922758     1.71   0.229    -7.575614    17.57561
                                 |
                           _cons |   24.74359   3.554755     6.96   0.020     9.448712    40.03847
                    -------------+----------------------------------------------------------------
                         sigma_u |  17.790424
                         sigma_e |  2.6648574
                             rho |  .97805485   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    
                    . xtreg outcome i.policy i.year if country!=2, fe cluster(country)
                    
                    Fixed-effects (within) regression               Number of obs     =         15
                    Group variable: country                         Number of groups  =          3
                    
                    R-sq:                                           Obs per group:
                         within  = 0.3433                                         min =          5
                         between = 0.9885                                         avg =        5.0
                         overall = 0.0060                                         max =          5
                    
                                                                    F(2,2)            =          .
                    corr(u_i, Xb)  = -0.0683                        Prob > F          =          .
                    
                                                    (Std. Err. adjusted for 3 clusters in country)
                    ------------------------------------------------------------------------------
                                 |               Robust
                         outcome |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                           1.policy |  -.3846154   3.514736    -0.11   0.923     -15.5073    14.73807
                                 |
                            year |
                              2  |          1   3.299832     0.30   0.790    -13.19803    15.19803
                              3  |   1.666667   4.219297     0.40   0.731     -16.4875    19.82084
                              4  |   1.461538   2.264409     0.65   0.585    -8.281427     11.2045
                              5  |   5.333333   2.305444     2.31   0.147     -4.58619    15.25286
                                 |
                           _cons |   25.12821   3.199758     7.85   0.016     11.36076    38.89565
                    -------------+----------------------------------------------------------------
                         sigma_u |  15.239829
                         sigma_e |  3.6957554
                             rho |  .94445711   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    Last edited by Rhys Williams; 04 Sep 2022, 12:32.

                    Comment


                    • #11
                      The difference in our examples is that I control for time fixed effects, which I do in my main model (and this is where the correlation with the country-fixed effects comes in for, as my colleague pointed out). Are you suggesting I don't control for time fixed effects?

                      Best,
                      Rhys

                      Comment

                      Working...
                      X