[Limdep Nlogit List] hausmantest

William Greene wgreene at stern.nyu.edu
Wed May 7 09:12:09 EST 2008


Ms. Biehl.
You are computing the difference of the covariance matrices with the 
wrong sign. It looks like you have another error in there also, "rest2."
The J1 matrix is wasteful.  See below.
/B. Greene

?Hausman test 
sample; all$ 
reject; cset=-999$ 
nlogit ;lhs= choice, cset, alti ;choices= a, b, c, other ;show ; model: 
U(A)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest2+p*p+p1*p1+p2*p2+inc*inc/ 
U(B)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest2+p*p+p1*p1+p2*p2+inc*inc/ 
?*********************************************** Rest2?
U(C)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest +p*p+p1*p1+p2*p2+inc*inc/ 
U(other)= 0$ 
matrix; bu=b(1:8) ; vu = varb(1:9,1:8) $

reject; alti=1$ 
reject; cs1=1$ 
create; csetnew=3$ 
create; if(alti=2)altinew=1$ 
create; if(alti=3)altinew=2$ 
create; if(alti=4)altinew=3$ 

?Exclude a 
nlogit ;lhs= choice, csetnew, altinew ;choices=  b, c, other ;show ; model: 
?U(A)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest2+p*p+p1*p1+p2*p2+inc*inc/ 
 U(B)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest2+p*p+p1*p1+p2*p2+inc*inc/ 
?*********************************************** Rest2?
 U(C)=Fre1*Fre1+Fre2*fre2+mo*mo+rest1*rest1+rest2*rest +p*p+p1*p1+p2*p2+ inc*inc/ 
U(other)= 0$ 
matrix; br=b(1:8) ; vr = varb(1:8,1:8) $
?********************Vr-Vu
matrix; bd=bu-br; vd=Vu-Vr$ 
matrix; vindv=[vd]$ 
matrix; list;q=bd'*vindv*bd$ 
CALC;list;p=1-chi(q,8)$

----- Original Message -----
From: "Caroline Johanna Biehl" <Caroline-Johanna.Biehl at gmx.de>
To: limdep at limdep.itls.usyd.edu.au
Sent: Tuesday, May 6, 2008 4:00:44 PM (GMT-0500) America/Bogota
Subject: [Limdep Nlogit List] hausmantest

Dear all, 
The following hausman-test for my unbranded logit model leads to a negative difference matrix. Is there a way to change that?
Thank you very much, 
caroline

?Hausman test
sample; all$
reject; cset=-999$
nlogit
;lhs= choice, cset, alti
;choices= a, b, c, other
;show
; model: 
U(A) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest2 + p*p  + p1*p1 + p2*p2  + inc*inc/
U(B) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest2 + p*p + p1*p1 + p2*p2  + inc*inc/
U(C) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest + p*p + p1*p1 + p2*p2  + inc*inc/
U(other)= 0$

matrix; j1=[1,0,0,0,0,0,0,0,0/
		0,1,0,0,0,0,0,0,0/
		0,0,1,0,0,0,0,0,0/
		0,0,0,1,0,0,0,0,0/
		0,0,0,0,1,0,0,0,0/
		0,0,0,0,0,1,0,0,0/
		0,0,0,0,0,0,1,0,0/
		0,0,0,0,0,0,0,1,0]$
matrix; bu=j1*B; Vu=J1*VARB*j1'$

reject; alti=1$
reject; cs1=1$
create; csetnew=3$
create; if(alti=2)altinew=1$
create; if(alti=3)altinew=2$
create; if(alti=4)altinew=3$

?Exclude a
nlogit
;lhs= choice, csetnew, altinew
;choices=  b, c, other
;show
; model: 
? U(A) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest2 + p*p  + p1*p1 + p2*p2  + inc*inc/
U(B) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest2 + p*p + p1*p1 + p2*p2  + inc*inc/
U(C) = Fre1*Fre1 + Fre2*fre2 + mo*mo + rest1*rest1+ rest2*rest + p*p + p1*p1 + p2*p2  + inc*inc/
U(other)= 0$

matrix; j2=[1,0,0,0,0,0,0,0,0/
		0,1,0,0,0,0,0,0,0/
		0,0,1,0,0,0,0,0,0/
		0,0,0,1,0,0,0,0,0/
		0,0,0,0,1,0,0,0,0/
		0,0,0,0,0,1,0,0,0/
		0,0,0,0,0,0,1,0,0/
		0,0,0,0,0,0,0,1,0]$
matrix; br=j2*B; Vr=J2*VARB*j2'$

matrix; bd=bu-br; vd=Vu-Vr$
matrix; vindv=[vd]$
matrix; list;q=bd'*vindv*bd$
CALC;list;p=1-chi(q,8)$

Output:
Matrix Q        has  1 rows and  1 columns.
               1
        +--------------
       1|   -8.69069
--> CALC;list;p=1-chi(q,8)$
  Error   471: Cannot compute CHI; parameter 1 is < = 0
  Error   116: CALC - Unable to compute result. Check earlier message.
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au


-- 
Professor William Greene
Department of Economics
Stern School of Business
New York University
44 West 4th St., Rm. 7-78
New York, NY   10012
http://www.stern.nyu.edu/~wgreene




More information about the Limdep mailing list