Announcement

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

  • Stata for FE/RE models

    Dear All, Consider the following standard estimation of FE (fixed-effect) and RE (random-effect) model in (1) and (2):
    Code:
    webuse grunfeld, clear
    xtset company year
    // (1) fixed-effect
    xtreg invest mvalue kstock i.year, fe robust
    outreg2 using fere, word dec(4) ctitle(fe) replace
    // (2) random-effect
    xtreg invest mvalue kstock i.year, robust
    outreg2 using fere, word dec(4) ctitle(re) append
    // (3) fixed-effect + random-effect?
    xtreg invest mvalue kstock i.company i.year, robust
    outreg2 using fere, word dec(4) ctitle(fe+re) append
    However, I have seen several papers using (3) to estimate the FE model (compared to (1), same estimates but different standard errors). What would be the problem by doing so? Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    // (3) fixed-effect + random-effect? xtreg invest mvalue kstock i.company i.year, robust outreg2 using fere, word dec(4) ctitle(fe+re) append
    #3 is a FE model (there are no random effects, even though technically, you are estimating using the RE estimator). I personally don't think that there is an issue with either estimation #1 or #3. #1 is referred to as the within-estimator whereas #3 is referred to as least squares dummy variables (LSDV). The (slight) differences in the standard errors reflect the estimation method. You can get the same standard errors by adding the undocumented -dfadj- option to xtreg, fe.

    Code:
    webuse grunfeld, clear
    xtreg invest mvalue kstock i.year, fe dfadj
    xtreg invest mvalue kstock i.company i.year
    Res.:

    Code:
    . xtreg invest mvalue kstock i.year, fe dfadj
    
    Fixed-effects (within) regression               Number of obs      =       200
    Group variable: company                         Number of groups   =        10
    
    R-sq:  within  = 0.7985                         Obs per group: min =        20
           between = 0.8143                                        avg =      20.0
           overall = 0.8068                                        max =        20
    
                                                    F(21,169)          =     31.90
    corr(u_i, Xb)  = -0.3250                        Prob > F           =    0.0000
    
    ------------------------------------------------------------------------------
          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
                 |
            year |
           1936  |  -19.19741   23.67586    -0.81   0.419    -65.93593    27.54112
           1937  |  -40.69001   24.69541    -1.65   0.101    -89.44122    8.061213
           1938  |   -39.2264   23.23594    -1.69   0.093    -85.09647    6.643667
           1939  |  -69.47029   23.65607    -2.94   0.004    -116.1698   -22.77083
           1940  |  -44.23507   23.80979    -1.86   0.065      -91.238     2.76785
           1941  |  -18.80446     23.694    -0.79   0.429     -65.5788    27.96987
           1942  |  -21.13979   23.38163    -0.90   0.367    -67.29748    25.01789
           1943  |  -42.97762   23.55287    -1.82   0.070    -89.47334    3.518104
           1944  |  -43.09876    23.6102    -1.83   0.070    -89.70766    3.510134
           1945  |  -55.68303   23.89561    -2.33   0.021    -102.8554   -8.510689
           1946  |  -31.16928   24.11598    -1.29   0.198    -78.77665    16.43809
           1947  |  -39.39223   23.78368    -1.66   0.100    -86.34361    7.559141
           1948  |  -43.71651   23.96965    -1.82   0.070    -91.03501    3.601991
           1949  |   -73.4951   24.18292    -3.04   0.003    -121.2346   -25.75559
           1950  |  -75.89611   24.34553    -3.12   0.002    -123.9566    -27.8356
           1951  |   -62.4809   24.86425    -2.51   0.013    -111.5654   -13.39637
           1952  |  -64.63233    25.3495    -2.55   0.012    -114.6748   -14.58987
           1953  |  -67.71796   26.61108    -2.54   0.012    -120.2509   -15.18501
           1954  |  -93.52622   27.10786    -3.45   0.001    -147.0399   -40.01257
                 |
           _cons |  -32.83631   18.87533    -1.74   0.084     -70.0981    4.425483
    -------------+----------------------------------------------------------------
         sigma_u |  91.798268
         sigma_e |  51.724523
             rho |  .75902159   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(9, 169) = 52.36                     Prob > F = 0.0000
    
    . 
    . xtreg invest mvalue kstock i.company i.year
    
    Random-effects GLS regression                   Number of obs     =        200
    Group variable: company                         Number of groups  =         10
    
    R-sq:                                           Obs per group:
         within  = 0.7985                                         min =         20
         between = 1.0000                                         avg =       20.0
         overall = 0.9517                                         max =         20
    
                                                    Wald chi2(30)     =    3329.49
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
          invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          mvalue |   .1177158   .0137513     8.56   0.000     .0907638    .1446679
          kstock |   .3579163    .022719    15.75   0.000     .3133878    .4024447
                 |
         company |
              2  |   207.0542   35.17275     5.89   0.000     138.1169    275.9915
              3  |  -135.2308   35.70897    -3.79   0.000    -205.2191   -65.24252
              4  |    95.3538   50.72211     1.88   0.060     -4.05971    194.7673
              5  |  -5.438636   57.83052    -0.09   0.925    -118.7844    107.9071
              6  |   102.8886   54.17388     1.90   0.058    -3.290244    209.0674
              7  |   51.46657   58.17922     0.88   0.376     -62.5626    165.4957
              8  |   67.49048   50.97092     1.32   0.185     -32.4107    167.3917
              9  |   30.21752   55.72307     0.54   0.588    -78.99769    139.4327
             10  |   126.8371   58.52545     2.17   0.030     12.12931    241.5448
                 |
            year |
           1936  |  -19.19741   23.67586    -0.81   0.417    -65.60124    27.20643
           1937  |  -40.69001   24.69541    -1.65   0.099    -89.09212    7.712108
           1938  |   -39.2264   23.23594    -1.69   0.091      -84.768    6.315193
           1939  |  -69.47029   23.65607    -2.94   0.003    -115.8353   -23.10524
           1940  |  -44.23507   23.80979    -1.86   0.063    -90.90141    2.431264
           1941  |  -18.80446     23.694    -0.79   0.427    -65.24385    27.63492
           1942  |  -21.13979   23.38163    -0.90   0.366    -66.96694    24.68736
           1943  |  -42.97762   23.55287    -1.82   0.068    -89.14038     3.18515
           1944  |  -43.09876    23.6102    -1.83   0.068     -89.3739    3.176369
           1945  |  -55.68303   23.89561    -2.33   0.020    -102.5176   -8.848489
           1946  |  -31.16928   24.11598    -1.29   0.196    -78.43574    16.09718
           1947  |  -39.39223   23.78368    -1.66   0.098    -86.00739    7.222923
           1948  |  -43.71651   23.96965    -1.82   0.068    -90.69617    3.263145
           1949  |   -73.4951   24.18292    -3.04   0.002    -120.8927   -26.09745
           1950  |  -75.89611   24.34553    -3.12   0.002    -123.6125   -28.17976
           1951  |   -62.4809   24.86425    -2.51   0.012    -111.2139   -13.74786
           1952  |  -64.63233    25.3495    -2.55   0.011    -114.3164   -14.94822
           1953  |  -67.71796   26.61108    -2.54   0.011    -119.8747   -15.56119
           1954  |  -93.52622   27.10786    -3.45   0.001    -146.6567   -40.39578
                 |
           _cons |  -86.90019   56.04663    -1.55   0.121    -196.7496    22.94919
    -------------+----------------------------------------------------------------
         sigma_u |          0
         sigma_e |  51.724523
             rho |          0   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    .

    Comment


    • #3
      Dear Andrew, Thanks a lot for this explanation and illustration.
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment

      Working...
      X