Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Reproduce Hausman Specification Test

Subject   st: Reproduce Hausman Specification Test
Date   Sat, 12 Nov 2005 10:06:24 +0100 (CET)

Dear statalist!

I would like to reproduce the Hausman specification
with matrix but my result is very different with
hausman command result in stata. Here are my stata and
mata code:

us nls80;
ivreg lwage $x (educ=$z);
matrix b_instru=get(_b);
matrix V_instru=get(VCE);
est store instrum;
regress lwage $x educ;
matrix b_ols=get(_b);
matrix V_ols=get(VCE);
*Hausman Specification Test: stata command*;
hausman instrumen, sigmamore constant;
Test:  Ho:  difference in coefficients not systematic

                  chi2(8) =
                          =       12.77
                Prob>chi2 =      0.1201

*Hausman Specification Test: with matrix*
matrix Q     = V_OLS - V_instru;
matrix Q_inv = syminv(Q);
matrix q     = b_instru - b_ols;
matrix HT    = q*Q_inv*q';
matrix list HT;
symmetric HT[1,1]
y1  427.16464
*with stata command I get 12.77 and with matrix I get
427.16464. I don't know why this differnce, maybe I
make a mystake in compute or in comprehension of
hausman (78).*;

I try now with mata to use the Moore-Penrose inverse
that suggest in hausman.ado file (MatGinv)


b_instru = st_matrix("b_instru");
V_instru = st_matrix("V_instru");
b_ols    = st_matrix("b_ols");
V_ols    = st_matrix("V_ols");

Q       = V_ols - V_instru;
q       = b_instru - b_ols; 
pinv_Q  = pinv(Q);
HT_pinv = q*pinv_Q*q';

mat list HT_pinv;
symmetric HT[1,1]
y1  161.74489
With mata I get 161.744489, can someone help to
understand these differents values of Hausman
statistic test.
Thanks You very much in advance for your help!


Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
TÚlÚchargez cette version sur
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index