* * Example 8.7.1 from pp 291-292 * open data lake.dat cal 1875 data(format=free,org=columns) 1875:1 1972:1 lake * boxjenk(ar=2,demean,maxl) lake * * This generates the dummy variable for the observations we want skipped. * set miss = t==17.or.t==24.or.t==31.or.t==38.or.t==45.or.t==52.or.$ t==59.or.t==66.or.t==73.or.t==80 * diff(center) lake / clake * * This does four iterations on the EM algorithm. The %IF(x,y,z) function returns * y if the expression x evaluates to a non-zero, and z if it evaluates to zero. * set eseries = %if(miss,0.0,clake) do iters=1,4 boxjenk(ar=2,maxl,noprint) eseries * disp iters eseries(17) eseries(24) eseries(31) %beta(1) %beta(2) -2*%logl compute v0=1+%beta(1)**2+%beta(2)**2,v2=%beta(2)/v0,v1=(%beta(1)-%beta(1)*%beta(2))/v0 set eseries = %if(miss,v2*(clake{2}+clake{-2})+v1*(clake{1}+clake{-1}),clake) end do iters * * The BOXJENK can also directly estimate the model skipping over some set of * observations. This is done either if the dependent variable has actual missing * data in it, or if the SMPL option (a contraction of SaMPLe) is used to tag the * observations which are to be included in the estimated sample. The results are * slightly different because the EM algorithm used above is the modified * version, which won't have quite the same stationary point as the full EM. * boxjenk(ar=2,demean,maxl,smpl=.not.miss) lake