Announcement

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

  • Hausman test- xtreg in Stata 13.1

    Hello,
    I have a data set that looks at the association between land inequality and counts of violence over six years (2000-2005) and for 798 municipalities. The unit of analysis is the municipality-year. I am using xtreg in Stata 13.1, and deciding whether to report the results of a fixed effects or a random effects model. The Hausman test suggests that I report the fixed effects model. However, there are several variables that are time invariant in the fixed effects model, but for which I would still like to report results (variables that are historical measures of violence from the 1970s). What are the implications if I report the results of the random effects model?

    I have a second question- I get an error message in Stata as follows: “the rank of the differenced variance matrix (4) does not equal the number of coefficients being tested (5)…” Does anyone have any ideas on why I would get such an error message? The output is below. Thank you in advance,

    Gabriel Nelson
    PhD Sociology

    xtreg Ginitierra gueract_1 paract_1 coca lpop rainfall temperature totplots60_00 displaced totviolencia85 anucraids1971_78, re

    Random-effects GLS regression Number of obs = 3588
    Group variable: origmun Number of groups = 798

    R-sq: within = 0.0082 Obs per group: min = 1
    between = 0.0924 avg = 4.5
    overall = 0.0954 max = 5

    Wald chi2(10) = 105.03
    corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

    ----------------------------------------------------------------------------------
    Ginitierra | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
    gueract_1 | -.0006076 .0002667 -2.28 0.023 -.0011303 -.0000849
    paract_1 | .0004025 .0004813 0.84 0.403 -.0005407 .0013458
    coca | -.002265 .0008711 -2.60 0.009 -.0039724 -.0005577
    lpop | .0256829 .0038513 6.67 0.000 .0181345 .0332312
    rainfall | -.0000101 4.02e-06 -2.51 0.012 -.000018 -2.22e-06
    temperature | -.0041859 .000782 -5.35 0.000 -.0057186 -.0026531
    totplots60_00 | -.0000124 5.87e-06 -2.11 0.035 -.0000239 -8.82e-07
    displaced | -2.13e-07 8.08e-07 -0.26 0.792 -1.80e-06 1.37e-06
    totviolencia85 | .0260579 .0074101 3.52 0.000 .0115344 .0405814
    anucraids1971_78 | .0021563 .0014217 1.52 0.129 -.0006302 .0049429
    _cons | .904592 .0256888 35.21 0.000 .854243 .9549411
    -----------------+----------------------------------------------------------------
    sigma_u | .09862827
    sigma_e | .0185865
    rho | .96570455 (fraction of variance due to u_i)
    ----------------------------------------------------------------------------------

    . estimates store re

    . xtreg Ginitierra gueract_1 paract_1 coca lpop rainfall temperature totplots60_00 displaced totviolencia85 anucraids1971_78, fe
    note: rainfall omitted because of collinearity
    note: temperature omitted because of collinearity
    note: totplots60_00 omitted because of collinearity
    note: totviolencia85 omitted because of collinearity
    note: anucraids1971_78 omitted because of collinearity

    Fixed-effects (within) regression Number of obs = 3588
    Group variable: origmun Number of groups = 798

    R-sq: within = 0.0107 Obs per group: min = 1
    between = 0.0221 avg = 4.5
    overall = 0.0194 max = 5

    F(5,2785) = 6.03
    corr(u_i, Xb) = -0.3879 Prob > F = 0.0000

    ----------------------------------------------------------------------------------
    Ginitierra | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
    gueract_1 | -.0005059 .0002664 -1.90 0.058 -.0010283 .0000166
    paract_1 | .0003712 .0004795 0.77 0.439 -.000569 .0013115
    coca | -.0018003 .0008731 -2.06 0.039 -.0035123 -.0000884
    lpop | .0601981 .0129071 4.66 0.000 .0348897 .0855066
    rainfall | 0 (omitted)
    temperature | 0 (omitted)
    totplots60_00 | 0 (omitted)
    displaced | 1.43e-07 8.07e-07 0.18 0.860 -1.44e-06 1.73e-06
    totviolencia85 | 0 (omitted)
    anucraids1971_78 | 0 (omitted)
    _cons | .949552 .0543716 17.46 0.000 .8429394 1.056165
    -----------------+----------------------------------------------------------------
    sigma_u | .11322651
    sigma_e | .0185865
    rho | .97376077 (fraction of variance due to u_i)
    ----------------------------------------------------------------------------------
    F test that all u_i=0: F(797, 2785) = 130.44 Prob > F = 0.0000

    . estimates store fe

    . hausman re fe, sigmamore

    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.

    ---- Coefficients ----
    | (b) (B) (b-B) sqrt(diag(V_b-V_B))
    | re fe Difference S.E.
    -------------+----------------------------------------------------------------
    gueract_1 | -.0006076 -.0005059 -.0001017 .
    paract_1 | .0004025 .0003712 .0000313 .
    coca | -.002265 -.0018003 -.0004647 .
    lpop | .0256829 .0601981 -.0345152 .
    displaced | -2.13e-07 1.43e-07 -3.56e-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(4) = (b-B)'[(V_b-V_B)^(-1)](b-B)
    = -38.18 chi2<0 ==> model fitted on these
    data fails to meet the asymptotic
    assumptions of the Hausman test;
    see suest for a generalized test


  • #2
    Gabriel:
    welcome to the list.
    Luckily, this is a trivial issue.
    To fulfill the theoretical requirements of -hausman- machinery, your line of code:
    Code:
    . hausman re fe, sigmamore
    should have been:

    Code:
    . hausman fe re, sigmamore
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Hello Carlo,
      Thank you so much for your reply. I have tried changing the code as you suggested, but unfortunately I receive the same error message: "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."

      The panel data set is strongly balanced. Any other ideas you have would be greatly appreciated.
      Thank you in advance,
      Gabriel

      Comment


      • #4
        Gabriel:
        what if you run -husman- with -sigmamore- or -sigmaless- options?
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Carlo,
          I apologize for the delay, I was traveling for a conference and was unable to try your suggestion. Using the sigmaless option with the Hausman test returns the same error message unfortunately.
          Any other ideas?

          Comment


          • #6
            Gabriel:
            what if you get rid of the coefficients omitted due to collinearity?
            Last edited by Carlo Lazzaro; 31 Aug 2015, 01:45.
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment


            • #7
              The error message appears again unfortunately, similar to before:

              xtreg Ginitierra gueract_1 paract_1 coca lpop displaced, fe

              Fixed-effects (within) regression Number of obs = 3744
              Group variable: origmun Number of groups = 833

              R-sq: within = 0.0101 Obs per group: min = 1
              between = 0.0361 avg = 4.5
              overall = 0.0259 max = 5

              F(5,2906) = 5.95
              corr(u_i, Xb) = -0.3508 Prob > F = 0.0000

              ------------------------------------------------------------------------------
              Ginitierra | Coef. Std. Err. t P>|t| [95% Conf. Interval]
              -------------+----------------------------------------------------------------
              gueract_1 | -.0004935 .0002596 -1.90 0.057 -.0010025 .0000155
              paract_1 | .000383 .000468 0.82 0.413 -.0005347 .0013007
              coca | -.0011465 .0007301 -1.57 0.116 -.0025781 .000285
              lpop | .0597006 .0125077 4.77 0.000 .0351758 .0842255
              displaced | -8.88e-08 7.30e-07 -0.12 0.903 -1.52e-06 1.34e-06
              _cons | .9425576 .0527286 17.88 0.000 .8391684 1.045947
              -------------+----------------------------------------------------------------
              sigma_u | .11660462
              sigma_e | .01832412
              rho | .97589985 (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              F test that all u_i=0: F(832, 2906) = 142.04 Prob > F = 0.0000

              . estimates store fe

              . xtreg Ginitierra gueract_1 paract_1 coca lpop displaced, re

              Random-effects GLS regression Number of obs = 3744
              Group variable: origmun Number of groups = 833

              R-sq: within = 0.0071 Obs per group: min = 1
              between = 0.0409 avg = 4.5
              overall = 0.0306 max = 5

              Wald chi2(5) = 57.49
              corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

              ------------------------------------------------------------------------------
              Ginitierra | Coef. Std. Err. z P>|z| [95% Conf. Interval]
              -------------+----------------------------------------------------------------
              gueract_1 | -.0006025 .0002612 -2.31 0.021 -.0011145 -.0000905
              paract_1 | .0004088 .0004722 0.87 0.387 -.0005167 .0013342
              coca | -.0017761 .0007324 -2.43 0.015 -.0032115 -.0003407
              lpop | .0243337 .0035558 6.84 0.000 .0173644 .031303
              displaced | -5.78e-07 7.34e-07 -0.79 0.431 -2.02e-06 8.60e-07
              _cons | .7927306 .0157397 50.36 0.000 .7618812 .8235799
              -------------+----------------------------------------------------------------
              sigma_u | .10516327
              sigma_e | .01832412
              rho | .97053351 (fraction of variance due to u_i)
              ------------------------------------------------------------------------------

              . estimates store re

              . hausman fe re, sigmamore

              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.

              ---- Coefficients ----
              | (b) (B) (b-B) sqrt(diag(V_b-V_B))
              | fe re Difference S.E.
              -------------+----------------------------------------------------------------
              gueract_1 | -.0004935 -.0006025 .000109 .000024
              paract_1 | .000383 .0004088 -.0000258 .0000266
              coca | -.0011465 -.0017761 .0006295 .0000887
              lpop | .0597006 .0243337 .035367 .0121282
              displaced | -8.88e-08 -5.78e-07 4.90e-07 6.89e-08
              ------------------------------------------------------------------------------
              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(4) = (b-B)'[(V_b-V_B)^(-1)](b-B)
              = 65.91
              Prob>chi2 = 0.0000

              . hausman fe re, sigmaless

              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.

              ---- Coefficients ----
              | (b) (B) (b-B) sqrt(diag(V_b-V_B))
              | fe re Difference S.E.
              -------------+----------------------------------------------------------------
              gueract_1 | -.0004935 -.0006025 .000109 .0000238
              paract_1 | .000383 .0004088 -.0000258 .0000263
              coca | -.0011465 -.0017761 .0006295 .0000878
              lpop | .0597006 .0243337 .035367 .0120025
              displaced | -8.88e-08 -5.78e-07 4.90e-07 6.82e-08
              ------------------------------------------------------------------------------
              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(4) = (b-B)'[(V_b-V_B)^(-1)](b-B)
              = 67.29
              Prob>chi2 = 0.0000

              Comment


              • #8
                When I run the collin command, I find low vif values for all the variables. Do I simply need to rescale some of the variables?

                collin Ginitierra coca gueract_1 paract_1 lpop rainfall temperature displaced anucraids1971_78 totplots60_00 totviolencia85
                (obs=3588)

                Collinearity Diagnostics

                SQRT R-
                Variable VIF VIF Tolerance Squared
                ----------------------------------------------------
                Ginitierra 1.14 1.07 0.8769 0.1231
                coca 1.17 1.08 0.8583 0.1417
                gueract_1 1.40 1.18 0.7123 0.2877
                paract_1 1.37 1.17 0.7311 0.2689
                lpop 1.41 1.19 0.7113 0.2887
                rainfall 1.19 1.09 0.8397 0.1603
                temperature 1.25 1.12 0.8001 0.1999
                displaced 1.64 1.28 0.6089 0.3911
                anucraids1971_78 1.17 1.08 0.8551 0.1449
                totplots60_00 1.37 1.17 0.7313 0.2687
                totviolencia85 1.07 1.03 0.9386 0.0614
                ----------------------------------------------------
                Mean VIF 1.29

                Cond
                Eigenval Index
                ---------------------------------
                1 6.2770 1.0000
                2 1.7089 1.9165
                3 0.9697 2.5442
                4 0.7859 2.8261
                5 0.6285 3.1602
                6 0.5087 3.5128
                7 0.4626 3.6837
                8 0.4252 3.8422
                9 0.1524 6.4177
                10 0.0446 11.8635
                11 0.0313 14.1521
                12 0.0051 35.1343
                ---------------------------------
                Condition Number 35.1343
                Eigenvalues & Cond Index computed from scaled raw sscp (w/ intercept)
                Det(correlation matrix) 0.2067

                Comment


                • #9
                  Gabriel:
                  this thread http://www.stata.com/statalist/archi.../msg00094.html could be helpful.
                  Kind regards,
                  Carlo
                  (Stata 18.0 SE)

                  Comment


                  • #10
                    Hi Gabriel,

                    This is in respect to your second question about the Note you're getting...

                    I was running into this problem myself but I found the answer at
                    http://www.albany.edu/faculty/krethe.../PanelData.pdf

                    (see second to last page of the pdf if you only care about the solution)

                    Apparently it has to do with having all the coefficients to the same scale just as the last line of the error says.

                    For example, I initially ran the hausman test and I got the following results


                    . hausman fe re, sigmamore

                    Note: the rank of the differenced variance matrix (3) does not equal the number of coefficients being tested (4); 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.

                    revenue 1.00e-06 1.52e-06 -5.19e-07 3.88e-07
                    varcost -7.22e-06 -6.13e-06 -1.09e-06 9.42e-07
                    Age .0082234 .0028719 .0053515 .0008647
                    length .0004048 -.0010959 .0015007 .0023228

                    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)
                    = 42.43
                    Prob>chi2 = 0.0000

                    However, as you can see my coefficients for revenue and varcost are not in similar scale as Age and Length. I then generated 2 new variables dividing revenues and varcost by 1000000 (since its e-06) and reran the test with the new variables and it worked (since they are now all on comparable scale).
                    Last edited by Sanmitra Gokhale; 19 Jun 2017, 07:03. Reason: Link at bottom of the page doesn't work, so I added the link into the message

                    Comment

                    Working...
                    X