# RE: st: hausman type test after xtlogit or xtprobit?

 From "David M. Drukker, StataCorp" To statalist@hsphsun2.harvard.edu Subject RE: st: hausman type test after xtlogit or xtprobit? Date Mon, 26 Jan 2004 17:52:11 -0600

```I think that John Emmet <johnemmet@uk2.net> asked whether he could do a
Hausman to test a fixed versus random effects specification in a panel logit
model.

The answer is yes.

Here is an example using the union dataset used in the -xtlogit- manual
entry.

. webuse union
(NLS Women 14-24 in 1968)

. xtlogit union age grade not_smsa south southXt , i(id) re nolog

Random-effects logistic regression              Number of obs      =     26200
Group variable (i): idcode                      Number of groups   =      4434

Random effects u_i ~ Gaussian                   Obs per group: min =         1
avg =       5.9
max =        12

Wald chi2(5)       =    221.95
Log likelihood  = -10556.294                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
union |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0092401   .0044368     2.08   0.037     .0005441    .0179361
grade |   .0840066   .0181622     4.63   0.000     .0484094    .1196038
not_smsa |  -.2574574   .0844771    -3.05   0.002    -.4230294   -.0918854
south |  -1.152854   .1108294   -10.40   0.000    -1.370075   -.9356323
southXt |   .0237933   .0078548     3.03   0.002     .0083982    .0391884
_cons |   -3.25016   .2622898   -12.39   0.000    -3.764238   -2.736081
-------------+----------------------------------------------------------------
/lnsig2u |   1.669888   .0430016                      1.585607     1.75417
-------------+----------------------------------------------------------------
sigma_u |   2.304685   .0495526                      2.209582    2.403882
rho |   .6175213   .0101565                      .5974278    .6372209
------------------------------------------------------------------------------
Likelihood-ratio test of rho=0: chibar2(01) =  5978.89 Prob >= chibar2 = 0.000

. estimates store re

. xtlogit union age grade not_smsa south southXt , i(id) fe nolog

note: multiple positive outcomes within groups encountered.
note: 2744 groups (14165 obs) dropped due to all positive or
all negative outcomes.

Conditional fixed-effects logistic regression   Number of obs      =     12035
Group variable (i): idcode                      Number of groups   =      1690

Obs per group: min =         2
avg =       7.1
max =        12

LR chi2(5)         =     78.16
Log likelihood  = -4511.1042                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
union |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0079706   .0050283     1.59   0.113    -.0018848    .0178259
grade |   .0811808   .0419137     1.94   0.053    -.0009686    .1633302
not_smsa |   .0210368    .113154     0.19   0.853    -.2007411    .2428146
south |  -1.007318   .1500491    -6.71   0.000    -1.301409   -.7132271
southXt |   .0263495   .0083244     3.17   0.002      .010034    .0426649
------------------------------------------------------------------------------

. estimates store fe

. hausman fe re, eq(1:1)

---- Coefficients ----
|      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
|       fe           re         Difference          S.E.
-------------+----------------------------------------------------------------
age |    .0079706     .0092401       -.0012695        .0023661
grade |    .0811808     .0840066       -.0028258        .0377743
not_smsa |    .0210368    -.2574574        .2784942        .0752826
south |   -1.007318    -1.152854         .145536        .1011512
southXt |    .0263495     .0237933        .0025562        .0027563
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from xtlogit
B = inconsistent under Ha, efficient under Ho; obtained from xtlogit

Test:  Ho:  difference in coefficients not systematic

chi2(5) = (b-B)'[(V_b-V_B)^(-1)](b-B)
=       17.30
Prob>chi2 =      0.0040

In this example, we reject the null hypothesis that the unobserved
individual level effects are uncorrelated with the other covariates.  This
implies that we should use the fixed-effects estimator instead of the
random-effects estimator.

--David
ddrukker@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```