Announcement

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

  • Different r-squared in xtreg vs rghdfe

    Hi all,

    I've been using the -xtreg- to estimate the first-stage of a 2SLS model, but switched to -reghdfe- because of faster run-time and better compatibility with Stata 13.

    One issue I'm running into is differences in how the within r-squared is calculated in fixed-effects model.

    Here is the code I'm running:

    Code:
    xtset id year
    xtreg y x i.year, vce(cluster id) fe  
    
    tsset id year
    reghdfe y x, vce(cluster id) absorb(id year)
    As I understand it, the within r-squared should be the same for both models. But it isn't. The r-squared I'm getting for -xtreg- is 0.49, while it's about 0.07 for -reghdfe-.

    Any suggestions for identifying the discrepancy?

  • #2
    It seems to me your xtreg "within" will adjust for just the fixed effects for id, while the reghdfe "within" will adjust for the fixed effects for both id and year.

    Comment


    • #3
      Hmm. Why would that result in a lower r-squared for reghdfe?

      Comment


      • #4
        In your case, because substantial yearly fixed effects are "between" in your reghdfe model but "within" in your xtreg model. For more details on the xtreg framework, see the section "Assessing Goodness of Fit" in the full documentation for xtreg in the [XT] Stata Longitudinal-Data/Panel-Data Reference Manual PDF included in your Stata installation and accessible from Stata's Help menu.

        Comment

        Working...
        X