# st: hausman speficiation test using both xthaus and hausman

 From "Jun Xu" To statalist@hsphsun2.harvard.edu Subject st: hausman speficiation test using both xthaus and hausman Date Sun, 06 Apr 2003 17:56:02 -0500

Why the results from the two commands xthaus (old command) and hausman (new command in version 8) are different in the following example even though the two columns of estiamtes and the third column of differences in estiamtes are the same, but the chi2 test statistic is completely different. Thanks a lot.

Jun Xu
Department of Sociology
Indiana University at Bloomington

****************************************************************
* fixed effects
. xtreg lcrmrte lprbarr lprbconv lprbpris lavgsen lpolpc /*

```   */ d82 d83 d84 d85 d86 d87, fe
```
Fixed-effects (within) regression Number of obs = 630
Group variable (i): county Number of groups = 90

R-sq: within = 0.4342 Obs per group: min = 7
between = 0.4066 avg = 7.0
overall = 0.4042 max = 7

F(11,529) = 36.91
corr(u_i, Xb) = 0.2068 Prob > F = 0.0000

------------------------------------------------------------------------------
lcrmrte | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lprbarr | -.3597944 .0324192 -11.10 0.000 -.4234806 -.2961083
lprbconv | -.2858733 .0212173 -13.47 0.000 -.3275538 -.2441928
lprbpris | -.1827812 .0324611 -5.63 0.000 -.2465496 -.1190127
lavgsen | -.0044879 .0264471 -0.17 0.865 -.0564421 .0474663
lpolpc | .4241142 .0263661 16.09 0.000 .3723191 .4759093
d82 | .0125802 .0215416 0.58 0.559 -.0297373 .0548977
d83 | -.0792813 .0213399 -3.72 0.000 -.1212027 -.0373598
d84 | -.1177281 .0216145 -5.45 0.000 -.1601888 -.0752673
d85 | -.1119561 .0218459 -5.12 0.000 -.1548715 -.0690407
d86 | -.0818268 .0214266 -3.82 0.000 -.1239185 -.0397352
d87 | -.0404704 .0210392 -1.92 0.055 -.0818011 .0008602
_cons | -1.604135 .1685739 -9.52 0.000 -1.935292 -1.272979
-------------+----------------------------------------------------------------
sigma_u | .43487416
sigma_e | .13871215
rho | .90765322 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(89, 529) = 45.87 Prob > F = 0.0000

.
. * version 8
. estimates store fixed

.
. * random effects
. xtreg lcrmrte lprbarr lprbconv lprbpris lavgsen lpolpc /*

```   */ d82 d83 d84 d85 d86 d87, re
```
........random effects output..........
.......................................
.......................................
.
. * version 8
. estimates store random

.
. * Hausman specification test
. xthaus
(Warning: xthausman is no longer a supported command; use -hausman-. For instructions, see help hausman.)

Hausman specification test

---- Coefficients ----
| Fixed Random
lcrmrte | Effects Effects Difference
-------------+-----------------------------------------
lprbarr | -.3597944 -.4252097 .0654153
lprbconv | -.2858733 -.3271464 .0412731
lprbpris | -.1827812 -.1793507 -.0034305
lavgsen | -.0044879 -.0083696 .0038816
lpolpc | .4241142 .4294148 -.0053005
d82 | .0125802 .0137442 -.001164
d83 | -.0792813 -.075388 -.0038933
d84 | -.1177281 -.1130975 -.0046306
d85 | -.1119561 -.1057261 -.00623
d86 | -.0818268 -.0795307 -.0022962
d87 | -.0404704 -.0424581 .0019876

Test: Ho: difference in coefficients not systematic

chi2( 11) = (b-B)'[S^(-1)](b-B), S = (S_fe - S_re)
= 121.31
Prob>chi2 = 0.0000

.
. * version 8
. hausman fixed random

---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| fixed random Difference S.E.
-------------+----------------------------------------------------------------
lprbarr | -.3597944 -.4252097 .0654153 .0059393
lprbconv | -.2858733 -.3271464 .0412731 .0032245
lprbpris | -.1827812 -.1793507 -.0034305 .
lavgsen | -.0044879 -.0083696 .0038816 .
lpolpc | .4241142 .4294148 -.0053005 .0033778
d82 | .0125802 .0137442 -.001164 .
d83 | -.0792813 -.075388 -.0038933 .
d84 | -.1177281 -.1130975 -.0046306 .
d85 | -.1119561 -.1057261 -.00623 .
d86 | -.0818268 -.0795307 -.0022962 .
d87 | -.0404704 -.0424581 .0019876 .
------------------------------------------------------------------------------
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(11) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= -36.92 chi2<0 ==> model fitted on these
data fails to meet the asymptotic
assumptions of the Hausman test;
see suest for a generalized test

_________________________________________________________________