Announcement

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

  • The relationship between two results

    Dear All, Suppose I run the following two regressions (ssc install reghdfe/ftools):
    Code:
    webuse grunfeld, clear
    drop if company > 5
    reg invest mvalue kstock i.company
    reghdfe invest mvalue kstock, a(FE=company)
    I got
    Code:
    . reg invest mvalue kstock i.company
    
          Source |       SS           df       MS      Number of obs   =       100
    -------------+----------------------------------   F(6, 93)        =    208.88
           Model |  6481660.49         6  1080276.75   Prob > F        =    0.0000
        Residual |  480962.167        93   5171.6362   R-squared       =    0.9309
    -------------+----------------------------------   Adj R-squared   =    0.9265
           Total |  6962622.66        99  70329.5218   Root MSE        =    71.914
    
    ------------------------------------------------------------------------------
          invest | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          mvalue |   .1149211   .0168364     6.83   0.000     .0814874    .1483548
          kstock |   .3211845    .024291    13.22   0.000     .2729475    .3694215
                 |
         company |
              2  |   187.4654   43.82714     4.28   0.000     100.4334    274.4974
              3  |  -151.0369    44.6898    -3.38   0.001    -239.7819   -62.29178
              4  |   65.81458   62.12928     1.06   0.292    -57.56187     189.191
              5  |  -22.84211   71.43762    -0.32   0.750    -164.7031    119.0188
                 |
           _cons |  -98.29755   70.59862    -1.39   0.167    -238.4924    41.89731
    ------------------------------------------------------------------------------
    and
    Code:
    . reghdfe invest mvalue kstock, a(FE=company) 
    (MWFE estimator converged in 1 iterations)
    
    HDFE Linear regression                            Number of obs   =        100
    Absorbing 1 HDFE group                            F(   2,     93) =     166.54
                                                      Prob > F        =     0.0000
                                                      R-squared       =     0.9309
                                                      Adj R-squared   =     0.9265
                                                      Within R-sq.    =     0.7817
                                                      Root MSE        =    71.9141
    
    ------------------------------------------------------------------------------
          invest | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          mvalue |   .1149211   .0168364     6.83   0.000     .0814874    .1483548
          kstock |   .3211845    .024291    13.22   0.000     .2729475    .3694215
           _cons |  -82.41736      29.66    -2.78   0.007    -141.3162   -23.51847
    ------------------------------------------------------------------------------
    In addition, the FE saved from the second regression:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte company int year float(invest mvalue kstock) byte time double FE
    1 1935  317.6 3078.5    2.8  1 -15.880197047496395
    1 1936  391.8 4661.7   52.6  2 -15.880197047496395
    1 1937  410.6 5387.1  156.9  3 -15.880197047496395
    1 1938  257.7 2792.2  209.2  4 -15.880197047496395
    1 1939  330.8 4313.2  203.4  5 -15.880197047496395
    1 1940  461.2 4643.9  207.2  6 -15.880197047496395
    1 1941    512 4551.2  255.2  7 -15.880197047496395
    1 1942    448 3244.1  303.7  8 -15.880197047496395
    1 1943  499.6 4053.7  264.1  9 -15.880197047496395
    1 1944  547.5 4379.3  201.6 10 -15.880197047496395
    1 1945  561.2 4840.9    265 11 -15.880197047496395
    1 1946  688.1 4900.9  402.2 12 -15.880197047496395
    1 1947  568.9 3526.5  761.5 13 -15.880197047496395
    1 1948  529.2 3254.7  922.4 14 -15.880197047496395
    1 1949  555.1 3700.2 1020.1 15 -15.880197047496395
    1 1950  642.9 3755.6   1099 16 -15.880197047496395
    1 1951  755.9   4833 1207.7 17 -15.880197047496395
    1 1952  891.2 4924.9 1430.5 18 -15.880197047496395
    1 1953 1304.4 6241.7 1777.3 19 -15.880197047496395
    1 1954 1486.7 5593.6 2226.3 20 -15.880197047496395
    2 1935  209.9 1362.4   53.8  1  171.58517985868602
    2 1936  355.3 1807.1   50.5  2  171.58517985868602
    2 1937  469.9 2676.3  118.1  3  171.58517985868602
    2 1938  262.3 1801.9  260.2  4  171.58517985868602
    2 1939  230.4 1957.3  312.7  5  171.58517985868602
    2 1940  361.6 2202.9  254.2  6  171.58517985868602
    2 1941  472.8 2380.5  261.4  7  171.58517985868602
    2 1942  445.6 2168.6  298.7  8  171.58517985868602
    2 1943  361.6 1985.1  301.8  9  171.58517985868602
    2 1944  288.2 1813.9  279.1 10  171.58517985868602
    2 1945  258.7 1850.2  213.8 11  171.58517985868602
    2 1946  420.3 2067.7  132.6 12  171.58517985868602
    2 1947  420.5 1796.7  264.8 13  171.58517985868602
    2 1948  494.5 1625.8  306.9 14  171.58517985868602
    2 1949  405.1   1667  351.1 15  171.58517985868602
    2 1950  418.8 1677.4  357.8 16  171.58517985868602
    2 1951  588.2 2289.5  342.1 17  171.58517985868602
    2 1952  645.5 2159.4  444.2 18  171.58517985868602
    2 1953    641 2031.3  623.6 19  171.58517985868602
    2 1954  459.3 2115.5  669.7 20  171.58517985868602
    3 1935   33.1 1170.6   97.8  1 -166.91705738709987
    3 1936     45 2015.8  104.4  2 -166.91705738709987
    3 1937   77.2 2803.3    118  3 -166.91705738709987
    3 1938   44.6 2039.7  156.2  4 -166.91705738709987
    3 1939   48.1 2256.2  172.6  5 -166.91705738709987
    3 1940   74.4 2132.2  186.6  6 -166.91705738709987
    3 1941    113 1834.1  220.9  7 -166.91705738709987
    3 1942   91.9   1588  287.8  8 -166.91705738709987
    3 1943   61.3 1749.4  319.9  9 -166.91705738709987
    3 1944   56.8 1687.2  321.3 10 -166.91705738709987
    3 1945   93.6 2007.7  319.6 11 -166.91705738709987
    3 1946  159.9 2208.3    346 12 -166.91705738709987
    3 1947  147.2 1656.7  456.4 13 -166.91705738709987
    3 1948  146.3 1604.4  543.4 14 -166.91705738709987
    3 1949   98.3 1431.8  618.3 15 -166.91705738709987
    3 1950   93.5 1610.5  647.4 16 -166.91705738709987
    3 1951  135.2 1819.4  671.3 17 -166.91705738709987
    3 1952  157.3 2079.7  726.1 18 -166.91705738709987
    3 1953  179.5 2371.6  800.3 19 -166.91705738709987
    3 1954  189.6 2759.9  888.9 20 -166.91705738709987
    4 1935  40.29  417.5   10.5  1   49.93437939170669
    4 1936  72.76  837.8   10.2  2   49.93437939170669
    4 1937  66.26  883.9   34.7  3   49.93437939170669
    4 1938   51.6  437.9   51.8  4   49.93437939170669
    4 1939  52.41  679.7   64.3  5   49.93437939170669
    4 1940  69.41  727.8   67.1  6   49.93437939170669
    4 1941  68.35  643.6   75.2  7   49.93437939170669
    4 1942   46.8  410.9   71.4  8   49.93437939170669
    4 1943   47.4  588.4   67.1  9   49.93437939170669
    4 1944  59.57  698.4   60.5 10   49.93437939170669
    4 1945  88.78  846.4   54.6 11   49.93437939170669
    4 1946  74.12  893.8   84.8 12   49.93437939170669
    4 1947  62.68    579   96.8 13   49.93437939170669
    4 1948  89.36  694.6  110.2 14   49.93437939170669
    4 1949  78.98  590.3  147.4 15   49.93437939170669
    4 1950 100.66  693.5  163.2 16   49.93437939170669
    4 1951 160.62    809  203.5 17   49.93437939170669
    4 1952    145    727  290.6 18   49.93437939170669
    4 1953 174.93 1001.5  346.1 19   49.93437939170669
    4 1954 172.49  703.2  414.9 20   49.93437939170669
    5 1935  39.68  157.7  183.2  1  -38.72230481579653
    5 1936  50.73  167.9    204  2  -38.72230481579653
    5 1937  74.24  192.9    236  3  -38.72230481579653
    5 1938  53.51  156.7  291.7  4  -38.72230481579653
    5 1939  42.65  191.4  323.1  5  -38.72230481579653
    5 1940  46.48  185.5    344  6  -38.72230481579653
    5 1941   61.4  199.6  367.7  7  -38.72230481579653
    5 1942  39.67  189.5  407.2  8  -38.72230481579653
    5 1943  62.24  151.2  426.6  9  -38.72230481579653
    5 1944  52.32  187.7    470 10  -38.72230481579653
    5 1945  63.21  214.7  499.2 11  -38.72230481579653
    5 1946  59.37  232.9  534.6 12  -38.72230481579653
    5 1947  58.02    249  566.6 13  -38.72230481579653
    5 1948  70.34  224.5  595.3 14  -38.72230481579653
    5 1949  67.42  237.3  631.4 15  -38.72230481579653
    5 1950  55.74  240.1  662.3 16  -38.72230481579653
    5 1951   80.3  327.3  683.9 17  -38.72230481579653
    5 1952   85.4  359.4  729.3 18  -38.72230481579653
    5 1953   91.9  398.4  774.3 19  -38.72230481579653
    5 1954  81.43  365.7  804.9 20  -38.72230481579653
    end
    format %ty year
    My question is: What is the relationship between (the four company dummies) coefficients/constant from the first regression and the FE/constant from the second regression. Thanks for your comments.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    River, in the first regression, the FE of each level of "company" is

    Code:
    company = 1: -98.3
    company = 2: -98.3 + 187.5 = 89.2
    ...
    company = 5: -98.3 + (-22.8) = -121.1
    The results above could be replicated from the second regression.

    Code:
    company = 1: -82.4 + (-15.9) = -98.3
    ...
    company = 5: -82.4 + (-38.7) = -121.1

    Comment


    • #3
      River:
      as an aside to Fei's excellent explanation, I'd only add that _cons in -fe- model should be handled with care.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Dear Fei, Thanks a lot for this helpful illustration.
        Ho-Chuan (River) Huang
        Stata 19.0, MP(4)

        Comment


        • #5
          Dear Carlo, Thanks for this comment.

          Ho-Chuan (River) Huang
          Stata 19.0, MP(4)

          Comment


          • #6
            Dear Professor Wang, Another related question. Suppose that I estimate a two-way FE model as follows.
            Code:
            reg invest mvalue kstock i.company i.year
            
            . reg invest mvalue kstock i.company i.year
            
                  Source |       SS           df       MS      Number of obs   =       100
            -------------+----------------------------------   F(25, 74)       =     47.75
                   Model |   6556217.4        25  262248.696   Prob > F        =    0.0000
                Residual |  406405.254        74   5491.9629   R-squared       =    0.9416
            -------------+----------------------------------   Adj R-squared   =    0.9219
                   Total |  6962622.66        99  70329.5218   Root MSE        =    74.108
            
            ------------------------------------------------------------------------------
                  invest | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1264177   .0239838     5.27   0.000     .0786288    .1742065
                  kstock |   .3596463   .0414726     8.67   0.000     .2770104    .4422822
                         |
                 company |
                      2  |   228.2197   58.05058     3.93   0.000     112.5514     343.888
                      3  |  -113.9821   59.31756    -1.92   0.059    -232.1749    4.210747
                      4  |   127.9459    85.2303     1.50   0.138    -41.87916     297.771
                      5  |   30.53912   98.97234     0.31   0.759    -166.6676    227.7458
                         |
                    year |
                   1936  |  -33.81667   49.40894    -0.68   0.496    -132.2661    64.63278
                   1937  |   -76.7271   53.97821    -1.42   0.159     -184.281    30.82683
                   1938  |  -65.17792   47.21846    -1.38   0.172    -159.2628    28.90692
                   1939  |  -120.7944   49.01953    -2.46   0.016     -218.468   -23.12089
                   1940  |  -70.32834   49.71261    -1.41   0.161    -169.3829    28.72619
                   1941  |  -28.99855   49.31107    -0.59   0.558     -127.253    69.25591
                   1942  |  -22.89922   47.67343    -0.48   0.632    -117.8906    72.09216
                   1943  |   -55.0651   48.23145    -1.14   0.257    -151.1684    41.03817
                   1944  |   -63.2696    48.4063    -1.31   0.195    -159.7212    33.18205
                   1945  |  -77.58326   49.56005    -1.57   0.122    -176.3338    21.16729
                   1946  |  -34.71546   50.40792    -0.69   0.493    -135.1554    65.72452
                   1947  |  -46.97244   48.94286    -0.96   0.340    -144.4932    50.54833
                   1948  |  -46.16814   49.67979    -0.93   0.356    -145.1573      52.821
                   1949  |  -97.62293   50.46508    -1.93   0.057    -198.1768    2.930943
                   1950  |  -96.75419   50.94545    -1.90   0.061    -198.2652     4.75684
                   1951  |  -81.01435   52.52534    -1.54   0.127    -185.6734    23.64466
                   1952  |  -81.37434   54.12126    -1.50   0.137    -189.2133    26.46463
                   1953  |  -83.68475   58.30655    -1.44   0.155    -199.8631    32.49359
                   1954  |   -120.453   60.22542    -2.00   0.049    -240.4548   -.4512326
                         |
                   _cons |  -107.8907   93.00581    -1.16   0.250    -293.2089    77.42739
            ------------------------------------------------------------------------------
            And
            Code:
            reghdfe invest mvalue kstock, a(FE1=company FE2=year) 
            
            dataex company year FE1 FE2
            
            * Example generated by -dataex-. For more info, type help dataex
            clear
            input byte company int year double(FE1 FE2)
            1 1935 -54.544544782446145    65.17098995556573
            1 1936 -54.544544782446145   31.354317580939515
            1 1937 -54.544544782446145   -11.55611298971022
            1 1938 -54.544544782446145 -.006928575187439634
            1 1939 -54.544544782446145    -55.6234586944184
            1 1940 -54.544544782446145   -5.157345494512492
            1 1941 -54.544544782446145    36.17244330737397
            1 1942 -54.544544782446145    42.27177249026097
            1 1943 -54.544544782446145   10.105892046918957
            1 1944 -54.544544782446145   1.9013912555651487
            1 1945 -54.544544782446145  -12.412273778520207
            1 1946 -54.544544782446145   30.455529565591945
            1 1947 -54.544544782446145    18.19854677106934
            1 1948 -54.544544782446145    19.00285087899949
            1 1949 -54.544544782446145   -32.45194083300324
            1 1950 -54.544544782446145  -31.583197152965862
            1 1951 -54.544544782446145  -15.843364478753381
            1 1952 -54.544544782446145  -16.203348140588705
            1 1953 -54.544544782446145  -18.513757848739267
            1 1954 -54.544544782446145   -55.28200586588571
            2 1935   173.6751957665929    65.17098995556573
            2 1936   173.6751957665929   31.354317580939515
            2 1937   173.6751957665929   -11.55611298971022
            2 1938   173.6751957665929 -.006928575187439634
            2 1939   173.6751957665929    -55.6234586944184
            2 1940   173.6751957665929   -5.157345494512492
            2 1941   173.6751957665929    36.17244330737397
            2 1942   173.6751957665929    42.27177249026097
            2 1943   173.6751957665929   10.105892046918957
            2 1944   173.6751957665929   1.9013912555651487
            2 1945   173.6751957665929  -12.412273778520207
            2 1946   173.6751957665929   30.455529565591945
            2 1947   173.6751957665929    18.19854677106934
            2 1948   173.6751957665929    19.00285087899949
            2 1949   173.6751957665929   -32.45194083300324
            2 1950   173.6751957665929  -31.583197152965862
            2 1951   173.6751957665929  -15.843364478753381
            2 1952   173.6751957665929  -16.203348140588705
            2 1953   173.6751957665929  -18.513757848739267
            2 1954   173.6751957665929   -55.28200586588571
            3 1935 -168.52661255192152    65.17098995556573
            3 1936 -168.52661255192152   31.354317580939515
            3 1937 -168.52661255192152   -11.55611298971022
            3 1938 -168.52661255192152 -.006928575187439634
            3 1939 -168.52661255192152    -55.6234586944184
            3 1940 -168.52661255192152   -5.157345494512492
            3 1941 -168.52661255192152    36.17244330737397
            3 1942 -168.52661255192152    42.27177249026097
            3 1943 -168.52661255192152   10.105892046918957
            3 1944 -168.52661255192152   1.9013912555651487
            3 1945 -168.52661255192152  -12.412273778520207
            3 1946 -168.52661255192152   30.455529565591945
            3 1947 -168.52661255192152    18.19854677106934
            3 1948 -168.52661255192152    19.00285087899949
            3 1949 -168.52661255192152   -32.45194083300324
            3 1950 -168.52661255192152  -31.583197152965862
            3 1951 -168.52661255192152  -15.843364478753381
            3 1952 -168.52661255192152  -16.203348140588705
            3 1953 -168.52661255192152  -18.513757848739267
            3 1954 -168.52661255192152   -55.28200586588571
            4 1935   73.40138823852315    65.17098995556573
            4 1936   73.40138823852315   31.354317580939515
            4 1937   73.40138823852315   -11.55611298971022
            4 1938   73.40138823852315 -.006928575187439634
            4 1939   73.40138823852315    -55.6234586944184
            4 1940   73.40138823852315   -5.157345494512492
            4 1941   73.40138823852315    36.17244330737397
            4 1942   73.40138823852315    42.27177249026097
            4 1943   73.40138823852315   10.105892046918957
            4 1944   73.40138823852315   1.9013912555651487
            4 1945   73.40138823852315  -12.412273778520207
            4 1946   73.40138823852315   30.455529565591945
            4 1947   73.40138823852315    18.19854677106934
            4 1948   73.40138823852315    19.00285087899949
            4 1949   73.40138823852315   -32.45194083300324
            4 1950   73.40138823852315  -31.583197152965862
            4 1951   73.40138823852315  -15.843364478753381
            4 1952   73.40138823852315  -16.203348140588705
            4 1953   73.40138823852315  -18.513757848739267
            4 1954   73.40138823852315   -55.28200586588571
            5 1935  -24.00542667074826    65.17098995556573
            5 1936  -24.00542667074826   31.354317580939515
            5 1937  -24.00542667074826   -11.55611298971022
            5 1938  -24.00542667074826 -.006928575187439634
            5 1939  -24.00542667074826    -55.6234586944184
            5 1940  -24.00542667074826   -5.157345494512492
            5 1941  -24.00542667074826    36.17244330737397
            5 1942  -24.00542667074826    42.27177249026097
            5 1943  -24.00542667074826   10.105892046918957
            5 1944  -24.00542667074826   1.9013912555651487
            5 1945  -24.00542667074826  -12.412273778520207
            5 1946  -24.00542667074826   30.455529565591945
            5 1947  -24.00542667074826    18.19854677106934
            5 1948  -24.00542667074826    19.00285087899949
            5 1949  -24.00542667074826   -32.45194083300324
            5 1950  -24.00542667074826  -31.583197152965862
            5 1951  -24.00542667074826  -15.843364478753381
            5 1952  -24.00542667074826  -16.203348140588705
            5 1953  -24.00542667074826  -18.513757848739267
            5 1954  -24.00542667074826   -55.28200586588571
            end
            format %ty year
            I have a similar question. What are the relations between (company and year) FEs in these two regressions. Thanks in advance.
            Ho-Chuan (River) Huang
            Stata 19.0, MP(4)

            Comment

            Working...
            X