Article From: Department of Economics Subject: LGMMDG.SET Posted by: Information Provider Phone Number: (202) 885-3770 E-Mail Address: econ@american.edu Post Date: 28 Sep 1994 Expiration Date: 28 Oct 2004 LGMMDG.SET (Ogaki) @ LGMMDG.SET @ @------------------------------------------------------------------------------ Written by: Masao Ogaki Department of Economics, University of Chicago Last Revision: 07/03/87 ------------------------------------------------------------------------------@ /* This program sets procedure LGMMDG. The proc LGMMDG is the same as the proc LGMM in file LGMM.PRC except (1) that this defines globals chi : Chi-square test statistics for overidentifying restriction. (even when 'just identified' case, the minimized value is returned) df : degree of freedom for chi. W0 : The weighting matrix used for the last iteration ucov: Autocovariances of the disturbance u(t) ucov=|E[u(t)u(t)'] | |E[u(t)u(t-1)'] | | | | |E[u(t)u(t-rm)']| (2) that inputs y,xp,zp are globals. L*m*tend must be less than 8190. L>=K shoud hold to be identified. Syntax: run lgmmdg.set; b=lgmm(tend,k,m,L,r,w0flag,maxiter); r=(r1,r2,..,rm) 1 by m vector (0<=ri<=rm shoud be satisfied for i=1,..,m-1) L,m,k,tend,w0flag,maxiter scalars zp=|z(1)' | zp=m*tend by L matrix. |z(2)' | z(t) Lxm matrix, t=1,..,tend. | | | |z(tend)'| xp=|x(1)' | xp=m*tend by k matrix. |x(2)' | x(t) kxm matrix, t=1,..,tend. | | | |x(tend)'| y=|y(1) | y=m*tend by 1 matrix. | | | y(t) mx1 matrix, t=1,..,tend. |y(tend)| w0flag: If w0flag=0, w0=eye(L) is used for initial w0. If w0flag /= 0, w0 in the memory is used for inital w0. maxiter: Sets maximum number for iteration. The result b is kx1 vector of estimates. Model: y(t)=x(t)'b+u(t) E[u(t)|I(t)]=0 z(t) is in I(t). ui(t) is in I(t+ri+1). This Program Iterates the following: initial w given, 1. sigmazy=1/tend*(sum t=1,tend{z(t)y(t)}) sigmazx=1/tend*(sum t=1,tend{z(t)x(t)}) b=inv(sigmazx'*w*sigmazx)*sigmazx'w*sigmazy u(t)=y(t)-x(t)'b 2. Ru(j)=1/tend*(sum t=j+1,tend{u(t)u(t-j)'}) j=0,1,..,rm Appropriate elements of Ru(j) will be replaced by zeros. Rzu(j)=1/tend*(sum t=j+1,tend{z(t)Ru(j)z(t-j)'} j=0,1,..,rm w1=Rzu(0)+{Rzu(1)+Rzu(1)'}+,..,+{Rzu(r)+Rzu(r)'} w=inv(w1) go back to 1. */ clear w0,y,xp,zp; proc LGMMDG(tend,k,m,L,r,w0flag,maxiter); local sigmazy,sigmazx,differ,iter,b,u,v,sd,g,prob,t,ruj,rzuj,vt, zpt,zptj,w,j,i,vtj,yesno,zero; clearg df,chi,ucov; sigmazy=zp'y/tend; sigmazx=zp'xp/tend; if w0flag==0; w=eye(l); ? "W0=I is used for initial weighting"; else; w=w0; ? "W0 in the memory is used for inital weighting"; endif; df=L-k; zero=0.1; differ=1e+10;iter=1; do until differ0.5; prob=cdfchic(chi,df); endif; ? "ITERATION=" iter; ? " b=" b'; ? " s.d.=" sd'; if df>0; ? " chi square=" chi "(" prob ")"; elseif df==0;? " Just Identified"; else;? " L