Announcement

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

  • Reghdfe year fixed effects

    I am trying to see if age has an impact on school performance. I am adding year fixed effects and individual fixed effects. My code is

    reghdfe performance age, a(year individual) vce(cl school)

    I am confused as to why age gets omitted. I think of year fixed effects as dummies for each year. Age is not year-invariant, it increases by one each year (like a trend variable). I am not seeing how this creates problematic collinearity.

    When I use:
    xtset individual year
    xtreg performance age i.year, fe vce(cl school)

    It estimates the impact of age without omission of the variable.

    Thank you so much for your help in advance!

  • #2
    I am trying to see if age has an impact on school performance. I am adding year fixed effects and individual fixed effects. My code is

    reghdfe performance age, a(year individual) vce(cl school)

    I am confused as to why age gets omitted.
    The difference between age and year for an individual in the panel is a constant. For example, for the year sequence 2001 2002 2003 and the age sequence 12 13 14, the difference is (2001-12 = 2002-13= 2003-14 = 1989). Therefore, for this individual, we can express year as 1989+age. Age is thus collinear with year. It is harder to notice this collinearity with xtreg, fe, but see #2 of the following on how to go about it.

    https://www.statalist.org/forums/for...-using-reghdfe

    Comment


    • #3
      Andrew Musau Thank you for your response! I see what you mean. I am still slightly confused though. In the help reghdfe file, it says I can use i. var to absorb a variable. So instead of running

      reghdfe performance age, a(year individual) vce(cl school)

      I tried,

      reghdfe performance age i.year, a(individual) vce(cl school)

      Then the age variable is no longer omitted.

      Comment


      • #4
        reghdfe performance age i.year, a(individual) vce(cl school)
        Then the age variable is no longer omitted.
        Then you are back to the xtreg, fe situation. The collinearity is disguised when you use dummies, but notice that if you change the base year, you will get different coefficient estimates for age. This signals collinearity.

        Code:
        qui sum year
        local max= r(max)
        reghdfe performance age ib`=r(min)'.year, a(individual) vce(cl school)
        reghdfe performance age ib`max'.year, a(individual) vce(cl school)
        Last edited by Andrew Musau; 06 May 2020, 09:52.

        Comment


        • #5
          Andrew Musau Thank you for quick response! I ran the code, and the age variable was not omitted and got the same coefficient estimates for both regressions.

          Comment


          • #6
            This is literally your situation

            Code:
            webuse grunfeld
            forval i=1/10{
               replace time = time+`i'12 if company==`i'
            }
            reghdfe invest mvalue kstock time, a(company year)
            reghdfe invest mvalue kstock time i.year, a(company)
            reghdfe invest mvalue kstock time ib1936.year, a(company)
            Res.:

            Code:
            . reghdfe invest mvalue kstock time, a(company year)
            note: time is probably collinear with the fixed effects (all partialled-out values are close
            > to zero; tol = 1.0e-09)
            (MWFE estimator converged in 2 iterations)
            note: time omitted because of collinearity
            
            HDFE Linear regression                            Number of obs   =        200
            Absorbing 2 HDFE groups                           F(   2,    169) =     217.44
                                                              Prob > F        =     0.0000
                                                              R-squared       =     0.9517
                                                              Adj R-squared   =     0.9431
                                                              Within R-sq.    =     0.7201
                                                              Root MSE        =    51.7245
            
            ------------------------------------------------------------------------------
                  invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1177158   .0137513     8.56   0.000     .0905694    .1448623
                  kstock |   .3579163    .022719    15.75   0.000     .3130667    .4027659
                    time |          0  (omitted)
                   _cons |  -80.16378   14.84402    -5.40   0.000    -109.4674   -50.86019
            ------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            -----------------------------------------------------+
             Absorbed FE | Categories  - Redundant  = Num. Coefs |
            -------------+---------------------------------------|
                 company |        10           0          10     |
                    year |        20           1          19     |
            -----------------------------------------------------+
            
            .
            . reghdfe invest mvalue kstock time i.year, a(company)
            (MWFE estimator converged in 1 iterations)
            note: 1954.year omitted because of collinearity
            
            HDFE Linear regression                            Number of obs   =        200
            Absorbing 1 HDFE group                            F(  21,    169) =      31.90
                                                              Prob > F        =     0.0000
                                                              R-squared       =     0.9517
                                                              Adj R-squared   =     0.9431
                                                              Within R-sq.    =     0.7985
                                                              Root MSE        =    51.7245
            
            ------------------------------------------------------------------------------
                  invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1177158   .0137513     8.56   0.000     .0905694    .1448623
                  kstock |   .3579163    .022719    15.75   0.000     .3130667    .4027659
                    time |  -4.922433    1.42673    -3.45   0.001     -7.73894   -2.105925
                         |
                    year |
                   1936  |  -14.27497   23.03831    -0.62   0.536    -59.75492    31.20497
                   1937  |  -30.84514   23.40988    -1.32   0.189    -77.05859    15.36831
                   1938  |  -24.45911     21.546    -1.14   0.258    -66.99308    18.07487
                   1939  |  -49.78056    21.3735    -2.33   0.021      -91.974   -7.587114
                   1940  |  -19.62291   21.11328    -0.93   0.354    -61.30264    22.05682
                   1941  |   10.73013   20.69003     0.52   0.605    -30.11407    51.57434
                   1942  |   13.31724   20.34251     0.65   0.514    -26.84092    53.47539
                   1943  |  -3.598157   20.22262    -0.18   0.859    -43.51964    36.32333
                   1944  |   1.203129   20.23529     0.06   0.953    -38.74336    41.14962
                   1945  |  -6.458706   20.37149    -0.32   0.752    -46.67408    33.75666
                   1946  |   22.97748   20.54484     1.12   0.265    -17.58009    63.53505
                   1947  |   19.67696   20.59218     0.96   0.341    -20.97407    60.32798
                   1948  |   20.27511    20.9264     0.97   0.334    -21.03569    61.58592
                   1949  |  -4.581039   21.24419    -0.22   0.830    -46.51921    37.35713
                   1950  |  -2.059619   21.55591    -0.10   0.924    -44.61315    40.49391
                   1951  |   16.27802   21.72716     0.75   0.455    -26.61357    59.16962
                   1952  |   19.04903   22.13418     0.86   0.391    -24.64607    62.74412
                   1953  |   20.88583   22.61691     0.92   0.357    -23.76223    65.53389
                   1954  |          0  (omitted)
                         |
                   _cons |   2738.493   810.5269     3.38   0.001     1138.432    4338.555
            ------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            -----------------------------------------------------+
             Absorbed FE | Categories  - Redundant  = Num. Coefs |
            -------------+---------------------------------------|
                 company |        10           0          10     |
            -----------------------------------------------------+
            
            .
            . reghdfe invest mvalue kstock time ib1936.year, a(company)
            (MWFE estimator converged in 1 iterations)
            note: 1954.year omitted because of collinearity
            
            HDFE Linear regression                            Number of obs   =        200
            Absorbing 1 HDFE group                            F(  21,    169) =      31.90
                                                              Prob > F        =     0.0000
                                                              R-squared       =     0.9517
                                                              Adj R-squared   =     0.9431
                                                              Within R-sq.    =     0.7985
                                                              Root MSE        =    51.7245
            
            ------------------------------------------------------------------------------
                  invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1177158   .0137513     8.56   0.000     .0905694    .1448623
                  kstock |   .3579163    .022719    15.75   0.000     .3130667    .4027659
                    time |  -4.129378   1.460213    -2.83   0.005    -7.011985   -1.246772
                         |
                    year |
                   1935  |   15.06803   24.31822     0.62   0.536    -32.93858    63.07464
                   1937  |  -17.36322   22.78679    -0.76   0.447    -62.34664     27.6202
                   1938  |  -11.77024   22.27873    -0.53   0.598    -55.75069    32.21021
                   1939  |  -37.88475   21.47974    -1.76   0.080    -80.28791    4.518415
                   1940  |  -8.520154   21.05828    -0.40   0.686    -50.09131      33.051
                   1941  |   21.03984   20.73666     1.01   0.312    -19.89642    61.97609
                   1942  |   22.83389    20.8268     1.10   0.274    -18.28031    63.94808
                   1943  |   5.125439   20.43505     0.25   0.802    -35.21539    45.46627
                   1944  |    9.13367   20.34535     0.45   0.654    -31.03009    49.29743
                   1945  |   .6787806   20.27703     0.03   0.973    -39.35011    40.70767
                   1946  |   29.32191   20.36506     1.44   0.152    -10.88076    69.52458
                   1947  |   25.22834   20.81236     1.21   0.227    -15.85735    66.31402
                   1948  |   25.03344   21.15523     1.18   0.238     -16.7291    66.79598
                   1949  |  -.6157689   21.42184    -0.03   0.977    -42.90464     41.6731
                   1950  |   1.112598   21.65586     0.05   0.959    -41.63824    43.86344
                   1951  |   18.65718   21.68691     0.86   0.391    -24.15496    61.46933
                   1952  |   20.63514   22.10018     0.93   0.352    -22.99284    64.26311
                   1953  |   21.67888   22.57027     0.96   0.338    -22.87709    66.23485
                   1954  |          0  (omitted)
                         |
                   _cons |   2276.936   832.5594     2.73   0.007     633.3798    3920.492
            ------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            -----------------------------------------------------+
             Absorbed FE | Categories  - Redundant  = Num. Coefs |
            -------------+---------------------------------------|
                 company |        10           0          10     |
            -----------------------------------------------------+
            If you are not getting the same result, provide a data example using dataex showing this.
            Last edited by Andrew Musau; 06 May 2020, 13:12.

            Comment


            • #7
              Andrew Musau Thanks for this! That is exactly what is happening. I had hard time understanding why. I think I understand now. You are saying that using year dummies or xtreg, fe does not capture collinearity as well as reghdfe, a(year) does.

              Comment


              • #8
                Yes, you might think that you have identified the effect of the collinear variable if using dummies and not carrying out any further investigations, but that is not the case. Absorbing the year dummy will make it apparent that the effect is not identified.
                Last edited by Andrew Musau; 06 May 2020, 13:25.

                Comment


                • #9
                  Andrew Musau Thank you! It resolved my question.

                  Comment

                  Working...
                  X