* * Example 18.4 from page 529 * There's no worked example there, so we do this with generated data. Note that * this is not a well-behaved GMM estimation problem: the moment conditions are * too dependent to allow safe unconstrained estimation of the weight matrix. * all 500 compute mu1=4.0,sig1=1.0,mu2=0.0,sig2=.50 compute p=.3 set y = %if(%ranbranch(||p,1-p||)==1,mu1+%ran(sig1),mu2+%ran(sig2)) * stats y compute ybar=%mean,ysq=%variance nonlin m1 s1 m2 s2 lambda compute m1=%mean,s1=%variance,m2=%mean+1,s2=s1,lambda=.80 dec vect[frml] mgfs(5) dec vect tx(5) compute tx=||-.50,-.25,.01,.25,.50|| do i=1,5 frml mgfs(i) = exp(tx(&i)*(y-ybar)-tx(&i)**2*ysq/2)-$ lambda*exp(tx(&i)*(m1-ybar)+tx(&i)**2*(s1-ysq)/2)-(1-lambda)*exp(tx(&i)*(m2-ybar)+tx(&i)**2*(s2-ysq)/2) end do i instruments constant nlsystem(instruments,iters=500) / mgfs