Announcement

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

  • Hausman test

    Hey, when running the hausman test, should I include all variables? So dependent, independent, moderator (how? with #?) and controll variables?
    Do I need to define them somehow?
    Because if I run the test like that I get the note: the rank of the differenced variance matrix (4) does not equal the number of coefficients being tested (5); be sure this is what you expect, or there may be problems computing the test. Examine the output of your estimators for anything unexpected and possibly consider scaling your variables so that the coefficients are on a similar scale.

    Thank you!

  • #2
    Normally, you run the two models and then run the hausman, just as the documentation shows. If a variable appears in one estimation and not the other, you may get this message. It can also be a scale problem just as Stata says - you could have the variable but the variable's parameter is so small or the standard error is so small that it looks like the matrix is not of full rank. You can almost always rescale variables without changing the real results.

    Comment


    • #3
      But was it right to include interaction term variables (like a normal variable, so without any definition with ##) and the control variable in the fe and re regression and then run the hausman based on that?

      Comment


      • #4
        Vanessa:
        I can't get the need to include interaction without using -fvvarlist-, as -fvvarlist- has no role in influencing -hausman- outcome:
        Code:
        . use http://www.stata-press.com/data/r15/nlswork.dta
        (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
        
        . quietly xtreg ln_wage i.race##c.age, fe
        
        . estimates store fe
        
        . quietly xtreg ln_wage i.race##c.age, re
        
        . estimates store re
        
        . hausman fe re
        
                         ---- Coefficients ----
                     |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
                     |       fe           re         Difference          S.E.
        -------------+----------------------------------------------------------------
                 age |    .0176492     .0181609       -.0005117        .0001257
          race#c.age |
                  2  |     .001983     .0014711        .0005119         .000237
                  3  |   -.0050728    -.0021524       -.0029204        .0012504
        ------------------------------------------------------------------------------
                                   b = consistent under Ho and Ha; obtained from xtreg
                    B = inconsistent under Ha, efficient under Ho; obtained from xtreg
        
            Test:  Ho:  difference in coefficients not systematic
        
                          chi2(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                  =       24.19
                        Prob>chi2 =      0.0000
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hello, thank you for your answer! If I do it like that, hausman is not working anymore and I don't know why. Do you know what I did wrong? (leverage, advertisingintensityy, rdintensity are the interaction terms, sale is the control variable)
          Thank you!!



          Code:
          quietly xtreg logtobinsqeins CSR_pos CSR_pos##c.leverage advertisingintensity rdintensity sale, fe
          
          . estimate store fe
          
          . quietly xtreg logtobinsqeins CSR_pos CSR_pos##c.leverage advertisingintensity rdintensity sale, re
          
          . estimate store re
          
          . hausman fe re
          
          Note: the rank of the differenced variance matrix (37) does not equal the number of coefficients being tested (41); be sure this
          is what you expect, or there may be problems computing the test. Examine the output of your estimators for anything
          unexpected and possibly consider scaling your variables so that the coefficients are on a similar scale.
          
          ---- Coefficients ----
          | (b) (B) (b-B) sqrt(diag(V_b-V_B))
          | fe re Difference S.E.
          -------------+----------------------------------------------------------------
          CSR_pos | .0071581 .0093285 -.0021705 .
          CSR_pos |
          1 | .2720308 .1276698 .1443611 .
          2 | .0547224 -.0020898 .0568122 .
          3 | -.0255384 -.074679 .0491406 .
          4 | .0240319 .005253 .0187788 .
          5 | .1550791 .1183636 .0367155 .
          6 | .079513 .0658546 .0136584 .
          7 | .1339133 .1225627 .0113506 .
          8 | .134954 .1457873 -.0108333 .
          9 | .1087686 .0870228 .0217458 .
          10 | .0674736 .0825307 -.0150572 .
          11 | .1637958 .1805605 -.0167647 .
          12 | .4496584 .4080383 .0416201 .
          13 | -.25117 -.2044134 -.0467566 .
          14 | -.01211 -.0030617 -.0090483 .
          15 | .5514951 .3981349 .1533601 .
          16 | -.1768383 -.0324166 -.1444217 .
          17 | .3080458 .3991086 -.0910629 .
          18 | -.3320619 -.2558017 -.0762603 .
          leverage | .0142061 .0143141 -.0001081 .
          CSR_pos#|
          c.leverage |
          1 | -.1837343 -.0677893 -.115945 .
          2 | -.0129821 -.0147961 .001814 .
          3 | .0023256 .0034805 -.0011549 .
          4 | -.0188387 -.0301695 .0113309 .
          5 | -.0193967 -.0211935 .0017967 .
          6 | -.0467167 -.0540065 .0072897 .
          7 | -.0095062 -.0097111 .000205 .
          8 | .0002423 -.0059381 .0061804 .
          9 | -.0029156 -.0276889 .0247733 .
          10 | -.1798818 -.2067777 .0268959 .
          11 | -.0287404 -.0412108 .0124704 .
          12 | -.2538528 -.2495695 -.0042834 .
          13 | .1084779 .0417531 .0667248 .
          14 | .1592517 .0980375 .0612142 .
          15 | -.7291865 -.6683676 -.0608189 .
          16 | .1588145 .0500573 .1087571 .
          17 | -1.518158 -1.700635 .1824772 .
          18 | .5002656 .3814716 .1187941 .
          advertisin~y | -11.47187 -5.477158 -5.994715 1.997446
          rdintensity | 1.764547 5.845293 -4.080747 3.433167
          sale | -3.84e-06 -2.85e-06 -9.86e-07 5.22e-07
          ------------------------------------------------------------------------------
          b = consistent under Ho and Ha; obtained from xtreg
          B = inconsistent under Ha, efficient under Ho; obtained from xtreg
          
          Test: Ho: difference in coefficients not systematic
          
          chi2(37) = (b-B)'[(V_b-V_B)^(-1)](b-B)
          = -40.64 chi2<0 ==> model fitted on these
          data fails to meet the asymptotic
          assumptions of the Hausman test;
          see suest for a generalized test

          Comment


          • #6
            Or if I do it with all of them, it's still not working

            quietly xtreg logtobinsqeins CSR_pos CSR_pos##c.leverage CSR_pos##c.advertisingintensity CSR_pos##c.rdintensity sale, fe

            . estimate store fe

            . quietly xtreg logtobinsqeins CSR_pos CSR_pos##c.leverage CSR_pos##c.advertisingintensity CSR_pos##c.rdintensity sale, re

            . estimate store re

            . hausman fe re

            Note: the rank of the differenced variance matrix (33) does not equal the number of coefficients being tested (74); be sure this
            is what you expect, or there may be problems computing the test. Examine the output of your estimators for anything
            unexpected and possibly consider scaling your variables so that the coefficients are on a similar scale.

            ---- Coefficients ----
            | (b) (B) (b-B) sqrt(diag(V_b-V_B))
            | fe re Difference S.E.
            -------------+----------------------------------------------------------------
            CSR_pos | .2059901 .2083556 -.0023655 .
            CSR_pos |
            1 | -.1440331 -.7666645 .6226314 .
            2 | -1.351515 -1.312525 -.0389899 .
            3 | -1.188152 -1.202977 .0148254 .
            4 | -1.448062 -1.544936 .0968738 .
            5 | -1.578659 -1.644776 .0661172 .
            6 | -1.845883 -1.900165 .0542821 .
            7 | -1.932771 -1.994222 .0614513 .
            8 | -2.192626 -2.19198 -.0006459 .
            9 | -2.384043 -2.413794 .0297508 .
            10 | -2.537011 -2.488647 -.048364 .
            11 | -2.451344 -2.443526 -.0078182 .
            12 | -2.544705 -2.625623 .0809176 .
            13 | -2.908363 -2.887664 -.020699 .
            14 | -3.505902 -3.510647 .0047451 .
            15 | -3.192118 -4.287711 1.095593 .
            16 | -3.172825 -3.11717 -.0556551 .
            17 | -7.293291 -7.617846 .3245558 .
            18 | -6.127469 -5.837292 -.2901773 .
            leverage | -.2785807 -.2843561 .0057754 .
            CSR_pos#|
            c.leverage |
            1 | -.8657862 -.0534653 -.8123208 .
            2 | .2856466 .287999 -.0023524 .
            3 | .2916255 .2974927 -.0058672 .
            4 | .2722934 .2700172 .0022762 .
            5 | .2734087 .2775154 -.0041066 .
            6 | .2468692 .2465185 .0003507 .
            7 | .2832818 .2889635 -.0056817 .
            8 | .2915719 .2910381 .0005339 .
            9 | .2558584 .2338296 .0220288 .
            10 | .10761 .0891523 .0184577 .
            11 | .1948638 .1607922 .0340716 .
            12 | .082505 .090535 -.00803 .
            13 | .2893337 .2501464 .0391873 .
            14 | .4944817 .4333927 .061089 .
            15 | -.2305941 .5791034 -.8096975 .328581
            16 | .2121942 .1422193 .0699748 .
            17 | 2.462537 3.054758 -.5922219 .
            18 | .6341079 .6015303 .0325776 .
            advertisin~y | -125.2593 -121.0168 -4.242563 .
            CSR_pos#|
            c. |
            advertisin~y |
            1 | 115.4695 121.278 -5.808442 .
            2 | 125.4874 123.8558 1.631595 .
            3 | 103.776 101.5088 2.267108 .
            4 | 113.4492 117.3747 -3.925536 .
            5 | 116.1007 117.3949 -1.294136 .
            6 | 115.593 117.2623 -1.669271 .
            7 | 113.3318 115.3155 -1.983763 .
            8 | 116.0769 116.4044 -.3275378 .
            9 | 114.4756 114.7356 -.2600261 .
            10 | 111.9753 110.911 1.064285 .
            11 | 106.6808 106.2884 .3923601 .
            12 | 109.2562 110.5886 -1.332334 .
            13 | 96.9421 96.22437 .7177241 .
            14 | 114.588 114.7713 -.1833061 .
            15 | 109.2312 118.0084 -8.777226 .
            16 | 92.4966 93.05304 -.5564437 .
            17 | 135.4805 132.3601 3.120422 .
            18 | 153.3632 145.3431 8.020058 .
            rdintensity | 1668.039 1699.333 -31.2935 .
            CSR_pos#|
            c. |
            rdintensity |
            1 | -1321.598 -1597.368 275.7703 .
            2 | -1673.939 -1698.156 24.21742 .
            3 | -1662.591 -1687.534 24.94297 .
            4 | -1670.981 -1692.391 21.41002 .
            5 | -1667.436 -1694.015 26.57937 .
            6 | -1672.868 -1693.44 20.57143 .
            7 | -1672.309 -1693.995 21.68585 .
            8 | -1679.745 -1699.852 20.10727 .
            9 | -1494.598 -1448.975 -45.62343 .
            10 | -1674.304 -1692.712 18.40816 .
            11 | -1483.464 -1368.161 -115.3028 .
            13 | -1530.63 -1523.952 -6.677341 .
            15 | -1491.54 -874.5518 -616.988 .
            16 | -2395.611 -2203.061 -192.5498 .
            17 | 737.8829 1087.167 -349.2839 .
            sale | -3.91e-06 -2.75e-06 -1.16e-06 5.90e-07
            ------------------------------------------------------------------------------
            b = consistent under Ho and Ha; obtained from xtreg
            B = inconsistent under Ha, efficient under Ho; obtained from xtreg

            Test: Ho: difference in coefficients not systematic

            chi2(33) = (b-B)'[(V_b-V_B)^(-1)](b-B)
            = 34.97
            Prob>chi2 = 0.3746
            (V_b-V_B is not positive definite)


            Comment


            • #7
              Vanessa:
              you may find the following thread helpful: https://www.statalist.org/forums/for...d-with-haumsna
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Unfortunately not because I'm struggling so much with the moderator/interaction term :/

                Comment


                • #9
                  Vanessa:
                  what about -sigmamore- option?
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    but with what option? Without moderator/interaction terms, with the moderator/interaction terms (undefined), with them all defined? (If I do it like the normal regression, so defining one interaction term after the other, hausman takes the value of the last one).

                    Comment

                    Working...
                    X