Announcement

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

  • Difference between clustered standard errors produced by "reghdfe" and "xtreg, fe"

    In my model, I regress wages by country-occupation on explanatory variables and country-occupation fixed effects, clustering standard errors at the country level. To automatically drop singletons and reduce computation time, I considered using the user-written program "reghdfe" by Sergio Correia instead of "xreg, fe" (although there is just a single fixed effect, namely the country-occupation identifier). As it should be, point estimates are identical when using both commands. However, standard errors are identical only if I do not cluster standard errors at the country level. With clustering, they are quite a bit smaller when using "reghdfe". Has anybody encountered this issue/ has an idea where the difference comes from?

    In the "reghdfe" help-file and online discussions, I only found that xtreg, fe and reghdfe use the same degrees-of-freedom adjustment to account for the fact that my panel variable (country-occupation) is nested in my cluster variable (country)- hence this should not explain the difference.

  • #2
    The reghdfe documentation mentions clustering for with-in group correlations but doesn't say the estimates are robust to heteroscedasticity (cross-group differences in variance) while xtreg's cluster is automatically robust. I don't know if this is just that reghdfe's documentation didn't mention robust to heterscedasticity when things are clustered or whether this is a read difference.

    Comment


    • #3
      Thanks for your thoughts, Phil! Sergio Correia has been so nice to answer my question by mail- I post his reply below:

      "This is what's going on:
      When you run xtreg, if the cluster variable is the same as the fixed effect variable, then xtreg will not penalize from the degrees of freedom the number of FEs (remember that your DoF adjustment is usually q = (N-1)/(N-K) ... ; then the K will not take into account the number of fixed effects, only the other regressors).

      However, here your fixed effects are not the same as your cluster, but your clusters actually encompass the fixed effect levels (e.g. you are clustering by state, and have zipcode fixed effects, or you are clustering by year and have monthly fixed effects).

      This is a case that xtreg does not recognize, but reghdfe does"
      Hence, xtreg seems to apply the correct DoF adjustment only when clustering at the level of the fixed effects- not when the fixed effects are nested in the clusters. This was not apparent to me from the reghdfe helpfile, which suggests xtreg applies the same DoF adjustment as reghdfe:

      "clusters will check if a fixed effect is nested within a clustervar. In that case, it will set e(K#)==e(M#) and no degrees-of-freedom will be lost due to this fixed effect. The rationale is that we are already assuming that the number of effective observations is the number of cluster levels. This is the same adjustment that xtreg, fe does, but areg does not use it."
      Hence, this seems to be an important thing to be aware of. The only thing I'm wondering about now is why xtreg does not have this DoF adjustment in-built, as it appears to be unambiguously superior. Or can anyone see a reason why one may not want to apply this DoF adjustment, and leave the xtreg command as it is?



      Comment

      Working...
      X