[Limdep Nlogit List] Maddala's Model-Simultaneous Equations

Laurence Lester Laurence.Lester at flinders.edu.au
Wed Feb 22 23:16:06 EST 2006


I am trying to set up the code to run  Maddala's Model (Simultaneous Equations
with y1 observed and y2 binary). I have taken it from E17.6.2 (and used data
from Limdep (with an added binary constructed) to test the code.

It partly runs, but gives me two mesages. If anyone has the time to run the
attached limdep file they will see the errors. The first appears to be about an
IF statement but there isn't one in the code. The second relates to the final
matrix but I just can't see what the problem is.

If anyone can help I'd appreciate it. The data and code are included below if
that helps.

Regards
Laurence
NILS, Flinders University, Adelaide, SA



read ; nobs = 25 ; nvar = 9 ; names =
 COST,      SK,      SL,     SE,    SM,     PK,    PL,      PE,    PM $    
 182.373 0.05107 0.24727 0.04253 0.65913 1.00000 1.00000 1.00000 1.00000
 183.161 0.05817 0.27716 0.05127 0.61340 1.00270 1.15457 1.30258 1.05525
 186.533 0.04602 0.25911 0.05075 0.64411 0.74371 1.15584 1.19663 1.06625
 221.710 0.04991 0.24794 0.04606 0.65609 0.92497 1.23535 1.12442 1.12430
 255.945 0.05039 0.25487 0.04482 0.64992 1.04877 1.33784 1.25179 1.21694

 264.699 0.04916 0.26655 0.04460 0.63969 0.99744 1.37949 1.27919 1.19961
 291.160 0.04728 0.26832 0.04369 0.64071 1.00653 1.43458 1.27505 1.19044
 274.457 0.05635 0.27167 0.04787 0.62411 1.08757 1.45362 1.30356 1.20612
 308.908 0.05258 0.26465 0.04517 0.63760 1.10315 1.51120 1.34277 1.23835
 328.286 0.04604 0.26880 0.04576 0.63940 0.99606 1.58186 1.37154 1.29336
 338.633 0.05033 0.27184 0.04820 0.62962 1.06321 1.64641 1.38010 1.30703
 323.318 0.06015 0.27283 0.04836 0.61886 1.15619 1.67389 1.39338 1.32699

 358.435 0.06185 0.27303 0.04563 0.61948 1.30758 1.73430 1.36756 1.30774
 366.251 0.05788 0.27738 0.04585 0.61889 1.25413 1.78280 1.38025 1.33946
 366.162 0.05903 0.27839 0.04640 0.61617 1.26328 1.81977 1.37630 1.34319
 390.668 0.05578 0.28280 0.04530 0.61613 1.26525 1.88531 1.37689 1.34745
 412.188 0.05601 0.27968 0.04470 0.61962 1.32294 1.93379 1.34737 1.33143
 433.768 0.05452 0.28343 0.04392 0.61814 1.32798 2.00998 1.38969 1.35197
 474.969 0.05467 0.27996 0.04114 0.62423 1.40659 2.05539 1.38635 1.37542

 521.291 0.05460 0.28363 0.04014 0.62163 1.45100 2.13441 1.40102 1.41878
 540.941 0.05443 0.28646 0.04074 0.61837 1.38617 2.20616 1.39197 1.42428
 585.447 0.05758 0.28883 0.03971 0.61388 1.49901 2.33869 1.43388 1.43481
 630.450 0.05410 0.29031 0.03963 0.61597 1.44957 2.46412 1.46481 1.53356
 623.466 0.05255 0.29755 0.04348 0.60642 1.32464 2.60532 1.45907 1.54758
 658.235 0.04675 0.28905 0.04479 0.61940 1.20177 2.76025 1.64689 1.54978 $

CREATE ; IF (pl> 1.5) GAMBLE =1; (Else) GAMBLE =0  $ ? Make a Zero/one var  





sample; all $
/* Simultanious Equation Models E17-28 Model3 -using limdep data adapted*/
NAMELIST; x1=PE, SK, SL $	 		? Explantory for Binary
NAMELIST; x2=PK,PL, SM $			? Explantory for continuous		
CREATE; y1=COST $ 				? Continious dependent
CREATE; y2=GAMBLE$				? Binary choice

PROCECURE = Model3(y1,y2,x1,x2) $
NAMELIST	; xm3 = OR(x1,x2) $
REGRESS	; Lhs=y1; Rhs = xm3; Keep=p1x $
CALC		; t1sq=ssqrd 	$
PROBIT	; Lhs=y2; Rhs=xm3 $
CREATE	; p2x = xm3'b 	$
NAMELIST	; z1 = p2x,x1 	$
NAMELIST	; z2 = p1x,x2 	$
MATRIX	; v0i =<Varb> 	$
REGRESS	; Lhs=y1; Rhs=z1 	$
Matrix	; alpha1=b 		$	
CALC		; gamma1=b(1)
		; sigmasq1=ssqrd
		; sigma1=s 		$
PROBIT	; Lhs=y2; Rhs=z2 	$
Matrix	; alpha2=b 		$
CALC	; gamma2=b(1) 
	; rho12=(2*gamma1*Sqr(sigmasq1))*((1-gamma1*gamma2)^2*t1sq - gamma1^2 -
sigmasq1)
	; c=sigmasq1-2*gamma1*rho12*sigma1
	; d=gamma2^2 * sigmasq1-2*gamma2*rho12*sigma1	$
Matrix; z1z1i=<z1'z1>
	; va1=c*z1z1i + (gamma1^2) * z1z1i * z1'xm3 * <v0i> * xm3'z1 * z1z1i
	; v0i=<v0i>
	. z2xvi=z2'xm3 * v0i* xm3'z2
	; z2xvi=<z2xvi>
	; va2=z2xvi+d*z2xvi*z2'xm3*v0i*<xm3'xm3>*v0i*xm3'z2*z2xvi
	; Stat(alpha1, va1)
	; Stat(alpha2, va2) $
ENDPROCEDURE

EXECUTE; proc=Model3(y1,y2,x1,x2) $


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Simul Model.lim
Type: application/octet-stream
Size: 3288 bytes
Desc: not available
Url : http://limdep.itls.usyd.edu.au/pipermail/limdep/attachments/20060222/906769e9/attachment.obj 


More information about the Limdep mailing list