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) =
(b-B)'[(V_b-V_B)^(-1)](b-B)
= 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
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)
mata:;
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';
st_matrix("HT_pinv");
end;
mat list HT_pinv;
symmetric HT[1,1]
y1
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 http://fr.messenger.yahoo.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/