Announcement

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

  • Hausman test solution for vce(cluster) options

    Hello Stata Community,
    I am using panel data and I want to execute a Hausman test to test Fixed-Effects and Random-Effects. I made the two estimates using the command xtreg with the option vce(cluster id).
    I have a problem with the command Hausman fixed random. Baically, it says I cannot run the test if I had previously used xtreg with those options. In particular, this is what Stata shows me.
    Code:
    . hausman fixed random
    hausman cannot be used with vce(robust), vce(cluster cvar), or p-weighted data
    r(198);
    I searched on the forum and the command xtoverid, cluster(idcode) should be the command I may consider.
    I installed it and ran it but it does not work. This is Stata message.
    Code:
    . xtoverid, cluster(id)
    Error - must have ivreg2/ivreg29/ivreg28 version 2.1.15 or greater installed
    r(601);
    How can I run a Hausman test yo choose between FE e RE if I am using clustered robust standard errors for my panel data analysis?

    Thanks in advance.
    Regards,

  • #2
    Install the commands that the user written command is asking you to install, fit your model with one of the suggested commands, and try again.

    Comment


    • #3
      Hello Joro, thanks for your reply:
      Are you sure that ivreg2 can be used with Fixed-Effects and Random-Effects as in the command ivreg2 description I can read only
      Extended instrumental variables/2SLS, GMM and AC/HAC, LIML and k-class regression
      ?
      Thanks.
      Could you please helping me answering this question?
      Salvatore

      Comment


      • #4
        Apparently you do not even need to use ivreg2. -xtoverid- should work after Stata Corp -xt- commands. Here is from the help file of -xtoverid-:

        (Equivalence of xtoverid statistic and standard Hausman fixed-vs-random effects test)

        . webuse abdata

        (Balanced panel)
        . xtreg n w k if year>=1978 & year<=1982, re

        (Artificial regression overid test of fixed-vs-random effects)
        . xtoverid

        . di r(j)

        . est store re

        . xtreg n w k if year>=1978 & year<=1982, fe

        . est store fe

        (In homoskedastic balanced panel case, Hausman test using sigma from FE estimation...)
        . hausman fe re, sigmaless

        (... is numerically equal to the artificial regression overid statistic)
        . di r(chi2)

        (Artificial regression overid statistic readily extends to non-homoskedastic case)

        . xtreg n w k, re cluster(id)

        . xtoverid

        Comment


        • #5
          Salvatore:
          you could also go Mundlak.
          See explanation and worked out example in Stata blog (Fixed effect or random effect: the Mundlak approach).
          Last edited by Carlo Lazzaro; 10 Aug 2022, 23:52.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            To Carlo and Joro:
            Can you please help me work out how the xtoverid command works?
            These are my steps:
            1) I run the command xtreg, re cluster (id);
            2) I run the command xtreg, fe cluster (id);
            3)
            I run the command xtoverid;

            Stata shows
            Code:
            . . xtoverid
            xtoverid not compatible with xtreg model fe
            r(198);
            I do not understand why it says that sure I am not able to read the instructions properly in the help section.
            Please let me know.
            Regards

            Comment


            • #7
              Salvatore:
              the reference case for the community-contributed module -xtoverid- is -re- (or, put differently, the null for -xtoverid- is that -re- is the way to go).
              Therefore, the correct sequence is:
              Code:
              xtreg, re cluster (id)
              xtoverid
              If the -xtoverid- outcome reaches statistical significance, you have to switch from -re- to -fe-.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X