Announcement

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

  • Difference of xtivreg2 and reghdfe with absorb

    Dear Community,

    I am writing to you regarding a simple estimation problem. I was curious about the command reghdfe to estimate panel data fixed effects models. However, in a simple example for illustration purpose below, I do not get the same coefficients as for xtivreg2, and wondered where the difference can come from. In the first two regressions (with ivreg2 and reghdfe), without any fixed effects, results are the same (besides marginal differences in standard errors, presumably due to different estimation procedures). However, in the next two regressions where I used xtivreg fixed effects model and reghdfe absorbing year and id fixed effects, the coefficient is different.


    Code:
    webuse nlswork.dta, clear
    
    
    xtset id year
    
    ivreg2 ln_wage tenure
    reghdfe ln_wage tenure, noabsorb 
    
    
    xtivreg2 ln_wage tenure, fe 
    reghdfe ln_wage tenure, absorb(year id) noconstant

    Thanks a lot for any help or comments and have a nice day,
    Elio

  • #2
    xtset id year
    xtivreg2 ln_wage tenure, fe
    reghdfe ln_wage tenure, absorb(year id) noconstant
    xtivreg2 (SSC) only includes the panel fixed effects (id). Absorbing year is equivalent to including year indicators, so to estimate the same model, you need


    Code:
    xtivreg2 ln_wage tenure i.year, fe

    Comment


    • #3
      Dear Andrew,

      That's it, thanks a lot! Even though xtivreg2 does not allow for factor variables like this. Thanks, this really helped, I appreciate it!

      Comment


      • #4
        Even though xtivreg2 does not allow for factor variables like this.
        Just precede the command with xi:
        xi: xtivreg2 ln_wage tenure i.year, fe

        Comment


        • #5
          Eric de Souza , thanks you are right, that works perfectly!

          Comment

          Working...
          X