Article From: Department of Economics Subject: LGMM.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 LGMM.SET (Ogaki) @ LGMM.PRC @ @------------------------------------------------------------------------------ Written by: Masao Ogaki Department of Economics, University of Rochester Last Revision: 08/05/91 ------------------------------------------------------------------------------@ /* conditional homoskedastic case This procedure has no global reference. L*m*tend must be less than 8190. L>=K shoud hold to be identified. Syntax: b=lgmm(y,xp,zp,tend,k,m,L,r,w0flag,maxiter); ruv=(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 file w0.fmt 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. */ proc LGMM(y,xp,zp,tend,ruv,zero,w0flag,maxiter); local sigmazy,sigmazx,differ,iter,b,u,v,sd,g,prob,t,ruj,rzuj,vt, zpt,zptj,w,j,i,vtj,yesno,k,L,w0,df,chi,m; k=cols(xp); L=cols(zp); m=round(rows(y)/tend); sigmazy=zp'y/tend; sigmazx=zp'xp/tend; if w0flag==0; w=eye(l); ? "W0=I is used for initial weighting"; else; load w=w0; ? "W0 in w0.fmtis used for inital weighting"; endif; df=L-k; differ=zero+10;iter=1; do until (differmaxiter); w0=w; b=sigmazx'w0; v=inv(b*sigmazx); b=v*b*sigmazy; u=y-xp*b; v=v/tend; sd=sqrt(diag(v)); g=zp'u/tend; if df>0; chi=tend*(g'w0*g); clear g; 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