Announcement

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

  • XTREG vs REGHDFE: DIFFERENT OUTCOMES

    Dear Statalist community,
    I am puzzled as two command that should be equivalent are not, and I cannot explain myself the reason.

    I am analyzing panel data, defined with id (firms - 3500 firms) and year (time - 16 years).
    I tried using the classical xtreg with fixed effects and then also reghdfe in the code written below. I use them with the same dependent, independent and covariates (which i denote with "covariates" in this particular code) variables.

    The dv is a continuous variable, the iv is a binary variable (a treatment) and some covariates are continuous and some are binary.

    The codes that I have written are:


    Code:
     reghdfe dv iv covariates, absorb(industry year id) vce(robust)
    Code:
    xtset id year
    xtreg dv iv covariates i.year i.industry ,fe vce(robust)
    I expect exactly same results both coefficient and standard errors are different between the two outcomes.
    Is anybody aware of what I am missing?


    Thank you very much in advance for you help,
    and I apologize in advance if I haven't met some rules.
    Alberto

  • #2
    I speculate that one source of such a difference is the calculation of SE. For example, see the warning in reghdfe's help file as follows:
    "Warning: in a FE panel regression, using robust will lead to inconsistent standard errors if, for every fixed effect, the other dimension is fixed. For instance, in a standard panel with individual and time fixed effects, we require both the number of individuals and time periods to grow asymptotically. If that is not the case, an alternative may be to use clustered errors, which as discussed below will still have their own asymptotic requirements. For a discussion, see Stock and Watson, "Heteroskedasticity-robust standard errors for fixed-effects panel-data regression," Econometrica 76 (2008): 155-174"
    Last edited by Amin Sofla; 01 Jun 2018, 07:14.

    Comment


    • #3
      Thank you very much Amin,

      In facts if I run:

      Code:
       eghdfe dv iv covariates, absorb(industry year id) vce(cluster industry)

      Code:
       xtset id year
       xtreg dv iv covariates i.year i.industry ,fe vce(cluster industry)
      both the coefficient and the SE result the same, with the benefit of having a much clearer outcome structure in reghdfe.

      The only difference now remains the within R Squared:
      xtreg - 0.0296
      reghdfe - 0.0177

      My sense is that it has something to do with this table:



      Absorbed FE | Num. Coefs. = Categories - Redundant |
      -----------------+-------------------------------------------------|
      comp_strata | 0 111 111 * |
      Anno | 13 14 1 |
      CF | 0 3419 3419 * |
      -------------------------------------------------------------------+
      * = fixed effect nested within cluster; treated as redundant for DoF computation




      If anyone knows how to interpret this table I'd be very thankful.

      Thank you very much!

      Last edited by Alberto Poletto; 01 Jun 2018, 09:28.

      Comment


      • #4
        Hi Alberto,
        That question is somewhat easier to answer. The xtreg is estimating the R2 based on the variation of iv your covariates, the year dummies and industry dummies, after "absorbing" the contribution of "id" FE.
        In contrast the reghdfe is estimating the within R2 between dv iv covariates, AFTER absorbing not only the ID fixed effect, but also year and industry.
        HTH
        Fernando

        Comment


        • #5
          Thank you very very much Armin and Fernando,

          extremely helpful!
          this community is great!

          Regards,
          Alberto

          Comment

          Working...
          X