Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# re: re:st: Hausman test

 From Ricardo Ovaldia To statalist@hsphsun2.harvard.edu Subject re: re:st: Hausman test Date Tue, 3 Jan 2012 11:17:43 -0800 (PST)

```Thank you again  Kit.

Yes I used sigmamore. I also get the message if I use -sigmaless- or nothing at all.

Here is the output, is the Hausman test valid?:

. xtset fam
panel variable:  fam (unbalanced)

.
.         xtreg chol l1 l2 l3  i.sex i.marker, fe

Fixed-effects (within) regression               Number of obs      =       416
Group variable: fam                             Number of groups   =         9

R-sq:  within  = 0.1368                         Obs per group: min =        27
between = 0.7881                                        avg =      46.2
overall = 0.5725                                        max =        73

F(9,398)           =      7.01
corr(u_i, Xb)  = 0.3937                         Prob > F           =    0.0000

------------------------------------------------------------------------------
chol |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
l1 |   4.064901   1.649737     2.46   0.014     .8216118    7.308189
l2 |  -.1133366   .0582016    -1.95   0.052    -.2277575    .0010844
l3 |   .0012481   .0006428     1.94   0.053    -.0000155    .0025118
2.sex |   3.799992   .8166467     4.65   0.000     2.194512    5.405472
|
marker |
2  |  -.9134657   1.173933    -0.78   0.437    -3.221351    1.394419
3  |  -1.346317    1.20109    -1.12   0.263    -3.707591    1.014957
4  |   .5833598   2.476976     0.24   0.814    -4.286232    5.452952
5  |     .53107   1.352041     0.39   0.695    -2.126964    3.189104
6  |   2.271173   3.366584     0.67   0.500    -4.347337    8.889682
|
_cons |   9.321154   14.70398     0.63   0.526    -19.58602    38.22833
-------------+----------------------------------------------------------------
sigma_u |  5.0827273
sigma_e |  8.1937869
rho |  .27786908   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(8, 398) =     9.45              Prob > F = 0.0000

.         est store fixed

.         xtreg chol l1 l2 l3  i.sex i.marker

Random-effects GLS regression                   Number of obs      =       416
Group variable: fam                             Number of groups   =         9

R-sq:  within  = 0.1185                         Obs per group: min =        27
between = 0.8693                                        avg =      46.2
overall = 0.6005                                        max =        73

Wald chi2(9)       =    610.15
corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
chol |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
l1 |   6.341376   1.317354     4.81   0.000      3.75941    8.923342
l2 |   -.170823   .0489787    -3.49   0.000    -.2668195   -.0748265
l3 |   .0016893    .000569     2.97   0.003      .000574    .0028046
2.sex |    3.77881   .8776635     4.31   0.000     2.058621    5.498999
|
marker |
2  |  -1.579155   1.217692    -1.30   0.195    -3.965788    .8074783
3  |  -1.128749    1.26016    -0.90   0.370    -3.598617     1.34112
4  |   1.295496   2.350917     0.55   0.582    -3.312217    5.903209
5  |  -.8996998   1.409237    -0.64   0.523    -3.661753    1.862353
6  |   11.06828   3.289858     3.36   0.001     4.620282    17.51629
|
_cons |  -16.71301    11.0348    -1.51   0.130    -38.34082    4.914797
-------------+----------------------------------------------------------------
sigma_u |          0
sigma_e |  8.1937869
rho |          0   (fraction of variance due to u_i)
------------------------------------------------------------------------------

.         noi hausman fixed ., sigmamore

Note: the rank of the differenced variance matrix (8) does not equal the number of coefficients being tested (9); 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))
|     fixed          .          Difference          S.E.
-------------+----------------------------------------------------------------
l1 |    4.064901     6.341376       -2.276476         1.19984
l2 |   -.1133366     -.170823        .0574864         .039406
l3 |    .0012481     .0016893       -.0004412        .0003977
2.sex |    3.799992      3.77881        .0211814        .0878687
2bn.marker |   -.9134657    -1.579155        .6656893         .353452
3.marker |   -1.346317    -1.128749       -.2175685        .3081298
4.marker |    .5833598     1.295496       -.7121362        1.276993
5.marker |      .53107    -.8996998         1.43077        .3828838
6.marker |    2.271173     11.06828       -8.797112        1.548825
------------------------------------------------------------------------------
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(8) = (b-B)'[(V_b-V_B)^(-1)](b-B)
=       64.84
Prob>chi2 =      0.0000

Ricardo Ovaldia, MS
Statistician
Oklahoma City, OK

--- On Tue, 1/3/12, Christopher Baum <kit.baum@bc.edu> wrote:

> From: Christopher Baum <kit.baum@bc.edu>
> Subject: re: re:st: Hausman test
> To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> Date: Tuesday, January 3, 2012, 12:39 PM
> <>
> "the rank of the differenced variance matrix (8) does not
> equal the number of coefficients being tested (9)..."
>
> The two -xtreg- model are the same. Only difference is the
> -fe- option in the first model. I get estimates for all the
> covariates in both models so I am not sure why I am getting
> this message. Any ideas?
>
>
> Without seeing the output from both models and from the
> test, hard to tell. But note that xtreg, re can include
> time-invariant variables (such as race or gender)
> while xtreg,fe will drop them. That's probably not the
> case, as you say you get coefficients for all variables, but
> there has to be some reason that the
> differenced VCE is rank-deficient. You are using the
> sigmamore or sigmaless option on hausman, per the help file
> suggestion, right?
>
> KIt
>
>
> Kit Baum   |   Boston College
> Economics & DIW
> Berlin   |   http://ideas.repec.org/e/pba1.html
>
>              An
> Introduction to Stata Programming
> |   http://www.stata-press.com/books/isp.html
>   An Introduction to Modern Econometrics Using
> Stata  |   http://www.stata-press.com/books/imeus.html
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```