Announcement

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

  • Problem with command reghdfe

    Hi all,

    I used the following code to run a panel regression with both year fixed effects and industry fixed effects:

    reghdfe ROA ESG_score ceop_interaction firmsize CASH_ RandD net_ppe leverage BoardSize ,absorb(i.year i.sic2) vce(robust)
    (MWFE estimator converged in 2 iterations)

    HDFE Linear regression Number of obs = 1,220
    Absorbing 2 HDFE groups F( 8, 1178) = 14.73
    Prob > F = 0.0000
    R-squared = 0.3184
    Adj R-squared = 0.2947
    Within R-sq. = 0.2676
    Root MSE = 21.7118

    ----------------------------------------------------------------------------------
    | Robust
    ROA | Coefficient std. err. t P>|t| [95% conf. interval]
    -----------------+----------------------------------------------------------------
    ESG_score | .0413192 .0519282 0.80 0.426 -.0605629 .1432013
    ceop_interaction | .0438873 .0136014 3.23 0.001 .0172017 .070573
    firmsize | -2.542918 .7885829 -3.22 0.001 -4.090102 -.9957344
    CASH_ | .1983606 .0627574 3.16 0.002 .0752319 .3214893
    RandD | .0320461 .0376075 0.85 0.394 -.041739 .1058312
    net_ppe | -.0174186 .0374485 -0.47 0.642 -.0908919 .0560547
    leverage | .0547184 .027875 1.96 0.050 .0000282 .1094087
    BoardSize | 1.2812 .4919268 2.60 0.009 .3160497 2.246351
    _cons | 3.305921 4.034035 0.82 0.413 -4.608774 11.22062
    ----------------------------------------------------------------------------------

    Absorbed degrees of freedom:
    -----------------------------------------------------+
    Absorbed FE | Categories - Redundant = Num. Coefs |
    -------------+---------------------------------------|
    year | 5 0 5 |
    sic2 | 30 1 29 |
    -----------------------------------------------------+


    I'm wondering which code should I use to see the coefficients of the year and industry fixed effects?
    I looked into help reghdfe, but couldn't find what I was looking for.
    I'm using Stata 17 on a macOs Catalina.

    Below a sample of my panel set data:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str45 name int year long siccode float ROA double ESG_score float ceop_interaction
    "ANI PHARMACEUTICALS - ESG Combined Score"     2016 2836   12.184697 19.25  57.75
    "ANI PHARMACEUTICALS - ESG Combined Score"     2017 2836   -2.610776 21.63  43.26
    "ANI PHARMACEUTICALS - ESG Combined Score"     2018 2836  .035982016 18.12  54.36
    "ANI PHARMACEUTICALS - ESG Combined Score"     2019 2836   13.340952 19.99  59.97
    "ANI PHARMACEUTICALS - ESG Combined Score"     2020 2836  -.04889091 21.78  21.78
    "ABBVIE - ESG Combined Score"                  2016 2834    90.06187 74.88 224.64
    "ABBVIE - ESG Combined Score"                  2017 2834    75.00071 70.79 212.37
    "ABBVIE - ESG Combined Score"                  2018 2834    95.81817 50.58 151.74
    "ABBVIE - ESG Combined Score"                  2019 2834    88.44751  56.9  170.7
    "ABBVIE - ESG Combined Score"                  2020 2834   30.657856 48.59 145.77
    "ACORDA THERAPEUTICS - ESG Combined Score"     2016 2836  -.02578939 23.68  47.36
    "ACORDA THERAPEUTICS - ESG Combined Score"     2017 2836  -.18644807 24.94  49.88
    "ACORDA THERAPEUTICS - ESG Combined Score"     2018 2836   .02591589 27.45   54.9
    "ACORDA THERAPEUTICS - ESG Combined Score"     2019 2836   -.3413278  37.7   75.4
    "ACORDA THERAPEUTICS - ESG Combined Score"     2020 2836  -1.5741607  37.3   74.6
    "ACTIVISION BLIZZARD - ESG Combined Score"     2016 7372    55.35182 53.16 106.32
    "ACTIVISION BLIZZARD - ESG Combined Score"     2017 7372   14.623956 43.41  43.41
    "ACTIVISION BLIZZARD - ESG Combined Score"     2018 7372   101.65405 51.78      0
    "ACTIVISION BLIZZARD - ESG Combined Score"     2019 7372    75.73696 59.86      0
    "ACTIVISION BLIZZARD - ESG Combined Score"     2020 7372    95.07118 35.62  35.62
    "ACUITY BRANDS - ESG Combined Score"           2016 3645   .09864315  30.4  121.6
    "ACUITY BRANDS - ESG Combined Score"           2017 3645   .11094633 41.05 123.15
    "ACUITY BRANDS - ESG Combined Score"           2018 3645   .11697003 41.33 123.99
    "ACUITY BRANDS - ESG Combined Score"           2019 3645   .10414828 62.56 187.68
    "ACUITY BRANDS - ESG Combined Score"           2020 3645   .07111149 55.18 110.36
    "ADTRAN - ESG Combined Score"                  2016 3661   .05279849 52.79 158.37
    "ADTRAN - ESG Combined Score"                  2017 3661   .03563027 47.36  94.72
    "ADTRAN - ESG Combined Score"                  2018 3661  -.03079804 53.51 107.02
    "ADTRAN - ESG Combined Score"                  2019 3661  -.09719364 35.93  71.86
    "ADTRAN - ESG Combined Score"                  2020 3661    4.523673 50.83 101.66
    "ADVANSIX - ESG Combined Score"                2016 2821   .03773328 29.14  29.14
    "ADVANSIX - ESG Combined Score"                2017 2821   .13967688 47.45  47.45
    "ADVANSIX - ESG Combined Score"                2018 2821  .064027004 48.11  48.11
    "ADVANSIX - ESG Combined Score"                2019 2821  .033453103 51.71 103.42
    "ADVANSIX - ESG Combined Score"                2020 2821   .03647043 57.44 114.88
    "ALSP.HLTHCR.SLTN. - ESG Combined Score"       2016 7374 -.006693877 29.78  29.78
    "ALSP.HLTHCR.SLTN. - ESG Combined Score"       2017 7374  -.04644256 31.17      0
    "ALSP.HLTHCR.SLTN. - ESG Combined Score"       2018 7374    .1143303 37.03  74.06
    "ALSP.HLTHCR.SLTN. - ESG Combined Score"       2019 7374  -.05682871 33.89  67.78
    "ALSP.HLTHCR.SLTN. - ESG Combined Score"       2020 7374   .24006124 33.64  67.28
    "ANSYS - ESG Combined Score"                   2016 7372   .09485218 53.66  53.66
    "ANSYS - ESG Combined Score"                   2017 7372   .08813196 43.07      0
    "ANSYS - ESG Combined Score"                   2018 7372   .12840772 45.86  45.86
    "ANSYS - ESG Combined Score"                   2019 7372   .09326421  55.5   55.5
    "ANSYS - ESG Combined Score"                   2020 7372   .07303769 55.52      0
    "APPLIED OPTOELECTRONICS - ESG Combined Score" 2016 3674    .0969043 17.54  35.08
    "APPLIED OPTOELECTRONICS - ESG Combined Score" 2017 3674     1.63253 17.98  53.94
    "APPLIED OPTOELECTRONICS - ESG Combined Score" 2018 3674   -4.596864    17     51
    "APPLIED OPTOELECTRONICS - ESG Combined Score" 2019 3674  -1.4148557 17.91  35.82
    "APPLIED OPTOELECTRONICS - ESG Combined Score" 2020 3674  -.12157112  17.1   51.3
    "AVANOS MEDICAL - ESG Combined Score"          2016 3842   .01921035 52.43 104.86
    "AVANOS MEDICAL - ESG Combined Score"          2017 3842  .036112756  45.5   45.5
    "AVANOS MEDICAL - ESG Combined Score"          2018 3842  .031362496 53.75      0
    "AVANOS MEDICAL - ESG Combined Score"          2019 3842  -.02550567  52.2   52.2
    "AVANOS MEDICAL - ESG Combined Score"          2020 3842 -.016260162 45.97      0
    "AXON ENTERPRISE - ESG Combined Score"         2016 3484   .06218296 17.37  52.11
    "AXON ENTERPRISE - ESG Combined Score"         2017 3484   15.400223  25.5   76.5
    "AXON ENTERPRISE - ESG Combined Score"         2018 3484   .04058843  18.9   56.7
    "AXON ENTERPRISE - ESG Combined Score"         2019 3484 .0010429983 18.83  56.49
    "AXON ENTERPRISE - ESG Combined Score"         2020 3484    -1.24835 29.11  87.33
    "BIOGEN - ESG Combined Score"                  2016 2836    .1618583 73.86  73.86
    "BIOGEN - ESG Combined Score"                  2017 2836   .10734972 60.66  60.66
    "BIOGEN - ESG Combined Score"                  2018 2836   .17520335 80.09      0
    "BIOGEN - ESG Combined Score"                  2019 2836   .22679043 76.29  76.29
    "BIOGEN - ESG Combined Score"                  2020 2836   .16250117 56.06  56.06
    "BIO-TECHNE - ESG Combined Score"              2016 2836   .09249093 34.54  34.54
    "BIO-TECHNE - ESG Combined Score"              2017 2836   .04882882 45.33  45.33
    "BIO-TECHNE - ESG Combined Score"              2018 2836   .07918017 50.88 101.76
    "BIO-TECHNE - ESG Combined Score"              2019 2836   .05098253 65.97 131.94
    "BIO-TECHNE - ESG Combined Score"              2020 2836     .113088 56.83 113.66
    "BLACKBAUD - ESG Combined Score"               2016 7372  .031685762 35.09  70.18
    "BLACKBAUD - ESG Combined Score"               2017 7372   .03747415 48.66  97.32
    "BLACKBAUD - ESG Combined Score"               2018 7372  .027760083 38.84  77.68
    "BLACKBAUD - ESG Combined Score"               2019 7372  .005975023 47.89 143.67
    "BLACKBAUD - ESG Combined Score"               2020 7372    3.774085  54.4  108.8
    "BOSTON SCIENTIFIC - ESG Combined Score"       2016 3841    19.17551 71.58 143.16
    "BOSTON SCIENTIFIC - ESG Combined Score"       2017 3841    5.461611 74.39  74.39
    "BOSTON SCIENTIFIC - ESG Combined Score"       2018 3841    79.57522 72.01 144.02
    "BOSTON SCIENTIFIC - ESG Combined Score"       2019 3841    138.3006 83.82 167.64
    "BOSTON SCIENTIFIC - ESG Combined Score"       2020 3841   -2.664327 47.49 142.47
    "BOTTOMLINE TECHS. - ESG Combined Score"       2016 7372  -.03009403 21.99  43.98
    "BOTTOMLINE TECHS. - ESG Combined Score"       2017 7372  -.05366846 27.72  55.44
    "BOTTOMLINE TECHS. - ESG Combined Score"       2018 7372   1.4667405 29.62  88.86
    "BOTTOMLINE TECHS. - ESG Combined Score"       2019 7372    14.09383 30.15   60.3
    "BOTTOMLINE TECHS. - ESG Combined Score"       2020 7372  -1.1636072 34.49  68.98
    "BRADY NONVOTING A - ESG Combined Score"       2016 3577   .07673636  30.4      0
    "BRADY NONVOTING A - ESG Combined Score"       2017 3577   .09107114  40.6      0
    "BRADY NONVOTING A - ESG Combined Score"       2018 3577    .0861551  34.8   34.8
    "BRADY NONVOTING A - ESG Combined Score"       2019 3577   .11341666 34.85   69.7
    "BRADY NONVOTING A - ESG Combined Score"       2020 3577   .09835654 37.12  74.24
    "CTS - ESG Combined Score"                     2016 3823    .0664095 36.39 109.17
    "CTS - ESG Combined Score"                     2017 3823  .026770627 37.22 111.66
    "CTS - ESG Combined Score"                     2018 3823    .0848596 35.63 142.52
    "CTS - ESG Combined Score"                     2019 3823   .05618369 43.06 129.18
    "CTS - ESG Combined Score"                     2020 3823   .05540461  34.6  103.8
    "CABOT - ESG Combined Score"                   2016 2895    20.63712 67.72      0
    "CABOT - ESG Combined Score"                   2017 2895     33.3795 79.07      0
    "CABOT - ESG Combined Score"                   2018 2895   -15.65097 78.62      0
    "CABOT - ESG Combined Score"                   2019 2895    21.74515 76.82      0
    "CABOT - ESG Combined Score"                   2020 2895   -32.96399 73.88      0
    end
    ------------------ copy up to and including the previous line ------------------


    Thanks in advance!


  • #2
    Hi Qi

    I think you may be trying to look into something that is contradictory of what reghdfe does.

    As you may know, there are 2 ways that can be used to add fixed effects in a model.
    1) dummy variable inclusion (just add all dummies of interest)
    2) demean variables and run regressions on the newly created ones

    Option 1) is always possible if feasible (sometimes, it would create more variables that are feasible to add to the variance-covariance matrix)

    Option 2) is what reghdfe does, because you do not need the values of the fixed effects to identify the coefficients for other variables. However, doing this also implies you do not estimate the fixed effects

    Thus, if you use reghdfe, it will NOT show the coefficients for fixed effects.

    The closest thing it can do is "save" the fixed effects using syntax like this:

    reghdfe y x1 x2 x3, abs(newvar1=fe1 newvar2 = fe2)

    But again, you wont be able to make any significant test on those values, because standard errors cannot be recovered easily.

    HTH
    F

    Comment


    • #3
      Hi Fernando,

      Thank you for the reply!
      I tried option 1 and added both year fixed effects and industry fixed effects in 1 model, but since industry fixed effects are time-invariant all values were omitted.
      I used the following code:
      xtreg ROA lag_ESG_score lag_firmsize lag_CASH_lag_leverage lag_net_ppe lag_RandD BoardSize i.year i.sic2, vce(robust) fe

      Then I tried the following code:
      reg ROA lag_ESG_score lag_firmsize lag_CASH_lag_leverage lag_net_ppe lag_RandD BoardSize i.year i.sic2, vce(robust)

      with this code I get the following result:

      Linear regression Number of obs = 1,220
      F(40, 1179) = 6.74
      Prob > F = 0.0000
      R-squared = 0.3119
      Root MSE = 21.807

      ------------------------------------------------------------------------------
      | Robust
      ROA | Coefficient std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      ESG_score | .1196002 .0461104 2.59 0.010 .0291327 .2100677
      firmsize | -2.515192 .7967773 -3.16 0.002 -4.078451 -.9519319
      CASH_ | .197209 .0629202 3.13 0.002 .0737609 .3206571
      RandD | .0391573 .038923 1.01 0.315 -.0372087 .1155234
      net_ppe | -.018413 .0377133 -0.49 0.625 -.0924057 .0555796
      leverage | .0558901 .0281241 1.99 0.047 .0007111 .111069
      BoardSize | 1.056983 .486874 2.17 0.030 .1017468 2.012219
      |
      year |
      2017 | -1.33007 1.897893 -0.70 0.484 -5.053694 2.393554
      2018 | .8341936 2.113491 0.39 0.693 -3.31243 4.980817
      2019 | .2959584 2.086335 0.14 0.887 -3.797385 4.389302
      2020 | -3.117131 2.101532 -1.48 0.138 -7.24029 1.006028
      |
      sic2 |
      13 | -29.91121 16.92133 -1.77 0.077 -63.11049 3.288078
      20 | 17.07703 7.02705 2.43 0.015 3.290109 30.86394
      24 | 9.622914 6.641376 1.45 0.148 -3.407321 22.65315
      25 | 13.66613 6.65752 2.05 0.040 .6042191 26.72804
      26 | 8.779497 6.695379 1.31 0.190 -4.356689 21.91568
      28 | 14.86823 6.920875 2.15 0.032 1.289621 28.44683
      29 | 27.18192 29.38129 0.93 0.355 -30.46353 84.82737
      30 | .548305 9.365463 0.06 0.953 -17.82653 18.92314
      31 | 40.88532 26.62232 1.54 0.125 -11.34708 93.11773
      32 | 7.968456 6.857052 1.16 0.245 -5.48493 21.42184
      33 | 6.530878 7.897648 0.83 0.408 -8.964134 22.02589
      34 | 9.786912 6.669125 1.47 0.143 -3.297765 22.87159
      35 | 6.341396 6.861405 0.92 0.356 -7.120531 19.80332
      36 | 9.251197 6.610333 1.40 0.162 -3.718131 22.22052
      37 | 6.855089 7.247508 0.95 0.344 -7.364364 21.07454
      38 | 12.04973 6.75657 1.78 0.075 -1.206518 25.30597
      39 | -3.383669 9.758196 -0.35 0.729 -22.52904 15.7617
      48 | 10.86812 6.716897 1.62 0.106 -2.310288 24.04652
      49 | -2.025402 11.74602 -0.17 0.863 -25.07084 21.02003
      51 | 10.46052 6.608156 1.58 0.114 -2.504539 23.42558
      52 | 9.414179 6.811303 1.38 0.167 -3.949448 22.77781
      59 | 7.483002 6.940115 1.08 0.281 -6.133351 21.09935
      60 | 20.64918 10.4073 1.98 0.047 .2302876 41.06807
      67 | 22.42633 10.88162 2.06 0.040 1.076828 43.77584
      73 | 11.76731 6.653098 1.77 0.077 -1.285924 24.82054
      79 | 12.92036 6.643795 1.94 0.052 -.1146163 25.95534
      80 | 18.34604 32.62207 0.56 0.574 -45.65774 82.34983
      82 | 7.020703 7.126348 0.99 0.325 -6.961037 21.00244
      87 | 2.521543 7.701883 0.33 0.743 -12.58938 17.63247
      |
      _cons | -4.752711 7.635737 -0.62 0.534 -19.73386 10.22844
      ------------------------------------------------------------------------------

      Even though I added the fixed effects with i.year and i.sic2 where i.sic2 is the industry fixed effect, I'm wondering if it's possible to use reg instead of xtreg for panel data?
      So, could you please help me what I can do to include both year and industry fixed effects in 1 model?



      Comment


      • #4
        Hi
        You can do this, but you will need to at least cluster your standard errors at the panel level.
        Also, keep in mind that fixed effects do not really identify anything, which is why they are not often discussed, except in few applications.

        Why do you think you need to see the "fixed effects" coefficients?
        F

        Comment


        • #5
          Hi Fernando,

          I thought if I control for fixed effects in my master thesis, I should also say something about it and explain the fixed effects coefficients.
          But this is not the case then?

          Comment


          • #6
            Correct
            you cam say you control for them but unless tour advisor explicitly says something else , you don’t need to say anything about those fixed effects

            Comment


            • #7
              okay thank you Fernando!

              Comment

              Working...
              X