@ GMM2S.SET @ @------------------------------------------------------------------------------ Prepared by Lars P. Hansen, Masao Ogaki, and John C. Heaton Financial support from the National Science Foundation Grant number: SES-8512371 Last Revision: 05/29/91 ------------------------------------------------------------------------------@ /* This program has been used and seem to be free of errors. However, we (Lars P. Hansen, John C. Heaton, and Masao Ogaki) do not assume responsibility for any remaining errors. In no event shall we be liable to for any damages whatsoever arising out ot the use of or inability to use this program. @@ This program sets procedure GMM2S. See GMM2S.EXP for documentation. GMM2S.EXP is also an example file. This is for 2-Step GMM estimation. */ #include "partinv.prc"; #include "ywp.prc"; @ Globals @ clear bgm,const,const2,W0,gufn,w0flag,calwflag,nv,ordard; lend=15; proc hu(b); @ This is a dummy definition, and not used by GMM programs.@ retp(b); endp; proc sohu2(b12); @ This is a dummy definition, and not used by GMM programs.@ retp(b12); endp; proc (1)=ufn(b); retp(const*sumc(hu(b))); endp; proc startval; retp(bgm); endp; proc gmm2s(&gradq,bgm1,del1,hu1,tend,nzv,w0flag,zero,maxitegm); local gradq:proc; local kgm,gam2,gam21,gam22,gdi,omestr,kgm1, L,nz,maxrw,df,chi,differ,itergm,vbgm,sd,prob,wzp,omega22,tau,ometau, snzi,snzi0,igm,w,vp,prob0,differp, bmai,i,ib,ie,rzw,rv,rvwz,ep,tma,xpx,ypx,bma,arcoef,omega2; clear omega22; kgm=rows(bgm); kgm1=rows(bgm1); L=sumc(nzv); ? "Initial values of the coefficients=" bgm'; ? "1st Step GMM" bgm1'; format /m1 16,8; df=L-kgm; prob0=100; clear chi; differ=1e+12; differp=differ; if w0flag==1; clear w0; ? "initial values of parameters are used to caluculate initial W0"; itergm=0; goto lab100; elseif w0flag==0; w0=eye(L); ? "Initial W0=I"; ? "Scaling Constant used for first iteration=" const; itergm=1; bgm=minquad; gam2=gradq(&sohu2,bgm1|bgm,sohu2(bgm1|bgm),0); gam21=gam2[.,1:kgm1]/tend; save bgmi=bgm; goto lab100; endif; ? "W0 in the memory is used as initial W0"; itergm=1; const=const2; if w0flag==3; vof=ofn(bgm); ? "W0 and bgm in the memory is used for the first GMM result"; goto lab3200; endif; ? "W0 in the memory is used for the first GMM result"; do until differmaxitegm-0.5; @ or differp