Announcement

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

  • How do I choose between robust RE and FE

    Hello!
    I'm doing RE/FE models with clustered SE's on panel data to then choose between them using xtoverid (since apparently Hausman test doesn’t allow clustered SE's). I get the following error:
    HTML Code:
    . xtoverid
    0b: operator invalid
    r(198);
    Can somebody please help me out?

    Here's my code:
    HTML Code:
    xtreg depvar indepvars, fe cluster(CO_ID)
    est store fixed
    xtreg depvar indepvars, re cluster(CO_ID)
    est store random
    xtoverid
    Or maybe can anybody suggest any other test that I can use?

    P.S: Initially, I firstly did the RE/FE Hausman test and then based on the model that the test chooses checked for heteroscedasticity and did robust RE/FE. Somehow, this is not the right way to go about it. Is that true?
    Last edited by Kamilla Issak; 27 May 2023, 13:26.

  • #2
    In classical panel data with two sources of variation (unit and time), economists (I don't know what field you're in) would just through two-way fixed-effects at the data they have and use cluster-robust standard errors. For the level of clustering, see the QJE paper by Abadie et al. (2023) "When should you adjust standard errors for clustering?".

    You can consult Wooldridge (2021) for an extended two-way fixed effects model.

    Comment


    • #3
      Maxence Morlet Thank you for your answer! You guessed right, I am researching The Effect on Nonconventional Factors on Firm Performance (like CEO attractiveness and facial asymmetry). I eyeballed through the literature and some of them indeed use two-way fixed effects, however, after validating the FE choice using a test. Besides, I was advised by my thesis supervisor to do a test first.

      Comment


      • #4
        Fair enough, then try the Mundlak (1978) test. It sounds like you're in the management field, perhaps not that obsessed with causality yet

        Comment


        • #5
          Maxence Morlet yet..maybe Can I ask another question: what is the intuition behind performing the Hausman test first and based on the favored model (after the heteroscedasticity test) using cluster-robust standard errors being wrong?

          Comment


          • #6
            Nothing wrong, just theory vs practice (the real world ).

            The Hausman test however makes very unrealistic distribution assumptions, see Hayashi (2000).

            Regarding FE vs RE: RE assumes regressors are uncorrelated with the unobserved heterogeneity (the fixed-effects, often called alpha_i). No economist will ever believe that, so if you have time-varying variables in economics, my advice would be to use fixed-effects and not make that unrealistic assumption.

            Even if the Hausman test indicates the RE model is appropriate, you could question the power of the test? Its robustness? Were distributional assumptions met? etc.

            Regarding standard errors; there will almost inevitably be heteroscedasticity of unknown form in your model. Same logic regarding tests for heteroscedasticity; if you fail to reject the null of homoscedasticity, was the test powerful enough? Do you have enough observations? Is it a type 2 error? etc.

            In panel data, there will probably be correlation amongst observations across time within a certain cluster.

            I had an econometrics professor who used to say: just use cluster-robust standard errors automatically, just like you brush your teeth every morning, regardless of whether you've had breakfast, nothing, only coffee,...

            But I really recommend the paper of Abadie et al. (2023) on clustered standard errors. It is really informative.
            Last edited by Maxence Morlet; 27 May 2023, 15:05. Reason: Mistake in previous response

            Comment


            • #7
              Maxence Morlet I am so lucky to get a reply from you! Thank you so much. I will check out all the literature you pointed out.

              Comment


              • #8
                You're very welcome! Let me know if you have any other questions.

                Comment


                • #9
                  Cross-posted on Stack Overflow and Reddit. https://stackoverflow.com/questions/...bust-re-and-fe
                  https://www.reddit.com/r/stata/comme..._error_urgent/

                  Please note our policy on cross-posting, which is that you should tell us about it.

                  Comment


                  • #10
                    Originally posted by Kamilla Issak View Post
                    Hello!
                    I'm doing RE/FE models with clustered SE's on panel data to then choose between them using xtoverid (since apparently Hausman test doesn’t allow clustered SE's). I get the following error:
                    HTML Code:
                    . xtoverid
                    0b: operator invalid
                    r(198);
                    Can somebody please help me out?

                    Here's my code:
                    HTML Code:
                    xtreg depvar indepvars, fe cluster(CO_ID)
                    est store fixed
                    xtreg depvar indepvars, re cluster(CO_ID)
                    est store random
                    xtoverid
                    You are probably using factor variable notation whereas xtoverid does not support factor variables. Use the -xi- prefix instead. Here are some notes:

                    1. You will only want to compare the RE and FE estimates using the test of overidentifying restrictions in case you want to estimate an RE model. FE is consistent in all cases, so you need not do any test if you choose to estimate an FE model.

                    2. You run xtoverid immediately after estimating the random effects model. You do not need to estimate the FE model in this sequence.

                    Code:
                    webuse nlswork, clear
                    xtreg ln_wage hours tenure i.year, re cluster(idcode)
                    *REPLICATES THE ERROR
                    xtoverid
                    xi: xtreg ln_wage hours tenure i.year, re cluster(idcode)
                    xtoverid

                    Res.:

                    Code:
                    . xtreg ln_wage hours tenure i.year, re cluster(idcode)
                    
                    Random-effects GLS regression                   Number of obs     =     28,036
                    Group variable: idcode                          Number of groups  =      4,698
                    
                    R-sq:                                           Obs per group:
                         within  = 0.1322                                         min =          1
                         between = 0.2004                                         avg =        6.0
                         overall = 0.1497                                         max =         15
                    
                                                                    Wald chi2(16)     =    2127.88
                    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                    
                                                 (Std. err. adjusted for 4,698 clusters in idcode)
                    ------------------------------------------------------------------------------
                                 |               Robust
                         ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                           hours |   .0007958   .0004501     1.77   0.077    -.0000864     .001678
                          tenure |   .0254145   .0011415    22.26   0.000     .0231771    .0276519
                                 |
                            year |
                             69  |   .0795902   .0102815     7.74   0.000     .0594389    .0997416
                             70  |   .0512423   .0104708     4.89   0.000     .0307199    .0717647
                             71  |   .0941771   .0109301     8.62   0.000     .0727545    .1155996
                             72  |   .1034008   .0116803     8.85   0.000     .0805079    .1262938
                             73  |   .1106309   .0117177     9.44   0.000     .0876646    .1335973
                             75  |   .1138813   .0117957     9.65   0.000      .090762    .1370005
                             77  |   .1642916   .0123885    13.26   0.000     .1400107    .1885726
                             78  |   .1915684   .0129508    14.79   0.000     .1661853    .2169515
                             80  |   .1961758   .0131747    14.89   0.000     .1703539    .2219976
                             82  |   .1959882   .0134366    14.59   0.000     .1696529    .2223235
                             83  |   .2079875   .0143194    14.52   0.000     .1799219    .2360531
                             85  |   .2486962   .0140576    17.69   0.000     .2211439    .2762486
                             87  |   .2515615   .0148809    16.90   0.000     .2223954    .2807276
                             88  |   .2888409   .0165733    17.43   0.000     .2563578    .3213239
                                 |
                           _cons |   1.398854   .0198687    70.40   0.000     1.359912    1.437795
                    -------------+----------------------------------------------------------------
                         sigma_u |  .33389046
                         sigma_e |  .29770265
                             rho |  .55710861   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    
                    . 
                    . *REPLICATES THE ERROR
                    
                    . 
                    . xtoverid
                    68b:  operator invalid
                    r(198);
                    
                    . 
                    . xi: xtreg ln_wage hours tenure i.year, re cluster(idcode)
                    i.year            _Iyear_68-88        (naturally coded; _Iyear_68 omitted)
                    
                    Random-effects GLS regression                   Number of obs     =     28,036
                    Group variable: idcode                          Number of groups  =      4,698
                    
                    R-sq:                                           Obs per group:
                         within  = 0.1322                                         min =          1
                         between = 0.2004                                         avg =        6.0
                         overall = 0.1497                                         max =         15
                    
                                                                    Wald chi2(16)     =    2127.88
                    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                    
                                                 (Std. err. adjusted for 4,698 clusters in idcode)
                    ------------------------------------------------------------------------------
                                 |               Robust
                         ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                           hours |   .0007958   .0004501     1.77   0.077    -.0000864     .001678
                          tenure |   .0254145   .0011415    22.26   0.000     .0231771    .0276519
                       _Iyear_69 |   .0795902   .0102815     7.74   0.000     .0594389    .0997416
                       _Iyear_70 |   .0512423   .0104708     4.89   0.000     .0307199    .0717647
                       _Iyear_71 |   .0941771   .0109301     8.62   0.000     .0727545    .1155996
                       _Iyear_72 |   .1034008   .0116803     8.85   0.000     .0805079    .1262938
                       _Iyear_73 |   .1106309   .0117177     9.44   0.000     .0876646    .1335973
                       _Iyear_75 |   .1138813   .0117957     9.65   0.000      .090762    .1370005
                       _Iyear_77 |   .1642916   .0123885    13.26   0.000     .1400107    .1885726
                       _Iyear_78 |   .1915684   .0129508    14.79   0.000     .1661853    .2169515
                       _Iyear_80 |   .1961758   .0131747    14.89   0.000     .1703539    .2219976
                       _Iyear_82 |   .1959882   .0134366    14.59   0.000     .1696529    .2223235
                       _Iyear_83 |   .2079875   .0143194    14.52   0.000     .1799219    .2360531
                       _Iyear_85 |   .2486962   .0140576    17.69   0.000     .2211439    .2762486
                       _Iyear_87 |   .2515615   .0148809    16.90   0.000     .2223954    .2807276
                       _Iyear_88 |   .2888409   .0165733    17.43   0.000     .2563578    .3213239
                           _cons |   1.398854   .0198687    70.40   0.000     1.359912    1.437795
                    -------------+----------------------------------------------------------------
                         sigma_u |  .33389046
                         sigma_e |  .29770265
                             rho |  .55710861   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    
                    . 
                    . xtoverid
                    
                    Test of overidentifying restrictions: fixed vs random effects
                    Cross-section time-series model: xtreg re  robust cluster(idcode)
                    Sargan-Hansen statistic 391.395  Chi-sq(16)   P-value = 0.0000

                    Last edited by Andrew Musau; 28 May 2023, 06:26.

                    Comment


                    • #11
                      Thank you Nick Cox for pointing this out, I will definitely take it into account the next time. Thank you Andrew Musau for the resolution and explanation, it indeed worked! Statalist helps me so much, I am sincerely grateful!

                      Comment


                      • #12
                        Originally posted by Maxence Morlet View Post
                        Even if the Hausman test indicates the RE model is appropriate, you could question the power of the test? Its robustness? Were distributional assumptions met? etc.
                        If the Hausman test selects RE over FE, it implies that the difference in RE coefficients and FE coefficients is not systematic. In this sense, the FE results will not much differ from the RE results, so you will prefer RE because of efficiency.


                        Comment


                        • #13
                          Originally posted by Kamilla Issak View Post
                          Hello!
                          I'm doing RE/FE models with clustered SE's on panel data to then choose between them using xtoverid (since apparently Hausman test doesn’t allow clustered SE's). I get the following error:
                          HTML Code:
                          . xtoverid
                          0b: operator invalid
                          r(198);
                          Can somebody please help me out?

                          Here's my code:
                          HTML Code:
                          xtreg depvar indepvars, fe cluster(CO_ID)
                          est store fixed
                          xtreg depvar indepvars, re cluster(CO_ID)
                          est store random
                          xtoverid
                          Or maybe can anybody suggest any other test that I can use?

                          P.S: Initially, I firstly did the RE/FE Hausman test and then based on the model that the test chooses checked for heteroscedasticity and did robust RE/FE. Somehow, this is not the right way to go about it. Is that true?
                          You may want to read up on Mundlak model. Check this link - https://ideas.repec.org/c/boc/bocode/s457601.html

                          Comment

                          Working...
                          X