Announcement

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

  • Hausman test with reghdfe

    Hey everyone!

    I am currently trying to perform a Hausman test to decide whether to perform a Random effects or a Fixed effects regression. I am following the following steps in order to carry out the test:
    1) xtreg y1 y2 x1 x2 x3 i.id i.year, fe
    2) estimates store fe
    3) xtreg y1 y2 x1 x2 x3 i.id i.year, re
    4)estimates store re
    5) Hausman fe re

    This test gives me a p-value of 0.000 and so the result is that the null hypothesis (H0: RE model is appropriate) is rejected, meaning that I should use FE. However, as you can see I use multiple levels of fixed effects (i.id and i.year) and so I also used reghdfe instead of xtreg in the first step. Furthermore, I do not believe that you can use reghdfe for random effects and so the rest of the steps stay the same. In this case, the p-value I get is 0.1853, meaning that the null hypothesis cannot be rejected and so i should use RE. Therefore, I am wondering whether I should use xtreg or reghdfe when doing that first step as they give me contradictory results.

    Any help would be greatly appreciated! Thank you in advance!

  • #2
    What you have done is OK and enough, proceed with the fixed effects regression.

    You do not need - reghdfe -, the questions is not whether you have 1, 2, 3, etc. fixed effects. The question is whether these fixed effects (and how many of them) grow to infinity with your sample size. In your case only one fixed effect grows with the sample size.

    Comment


    • #3
      Also sloppy language "(H0: RE model is appropriate)" leads to sloppy thinking. Use the appropriate precise language "I reject the null hypothesis that the random effect, and the fixed effect estimators are the same".

      Comment


      • #4
        Hi Ricardo,

        One thing to be aware of is that one should avoid using syntax where fixed effect dummies come after the main variables of interest. This is actually a very common mistake - and can have disastrous consequences if one your x's is actually collinear with your fixed effects. You should instead use, eg,

        HTML Code:
        xtreg y1 i.id i.year y2 x1 x2 x3, fe
        The reason why this is important is that Stata does not know which variable is a fixed effect versus not and will always drop collinear variables from right to left. If a variable is only identified when a fixed effect is dropped by Stata, then it is not really identified, and you may wind up reporting a spurious estimate that actually has no meaning.

        That said, another thing that concerns me is the presence of "i.id" in your syntax. If your data is xtset by id and year, then this syntax will always include a fixed effect for each id, regardless of whether "fe" or "re" is specified. You can ignore this comment if your data is xtset by some other identifier.

        Regards,
        Tom

        Comment


        • #5
          1) xtreg y1 y2 x1 x2 x3 i.id i.year, fe
          2) estimates store fe
          3) xtreg y1 y2 x1 x2 x3 i.id i.year, re

          A couple of issues here. #1 is pointed out by Tom, if id is the panel identifier, xtreg automatically takes individual fixed effects into account, so no need to include dummies. #2, the dummies should not be part of the Hausman test as their coefficients depend on the reference category which is arbitrary. So you should just compare whether there are differences in the time-varying coefficients across FE and RE. One common mistake that is made is to consider the above (excluding the panel dummies) as a comparison between 2 way fixed effects and 2 way random effects models. In reality, you are comparing 2 way FE with RE model with year dummies. xtreg cannot estimate a 2 way RE model and for this, you need to switch to mixed. That said, the best way to compare the above models is to run a test of exclusion restrictions. You can download the community contributed command xtoverid from SSC and run the test following the RE regression.

          Comment

          Working...
          X