? ============================ cov1spdm ========================= proc cov1spdm neq ivs imask an1 ; ? This procedure is as same as cov1step.tsp procedure ? made by Prof. Hall and Dr. Cummins. Explanations are same, too. ? | 2 -1 0 0 0 | ? | -1 2 -1 0 0 | ? H = | 0 -1 2 -1 0 | when T = 5 ? | 0 0 -1 2 -1 | ? | 0 0 0 -1 2 | ? ? Procedure to compute the estimated one-step covariance matrix for ? GMM estimation; see Arellano and Bond (REStud 91 for details). ? Benchmarked with Steve Bond using DPD and these give estimates that ? match his. ? This version is by Clint Cummins 7/97, and revised 12/97. ? The 7/97 assumed that GMM would apply the mask to this COVOC, ? but there was a bug in GMM that prevented this from operating ? correctly. That bug was fixed on 12/17/97, but we will apply ? the mask to an1 here, so that earlier versions of TSP with this ? bug will operate correctly. ? The form before using the mask is: an1 = ( h # (z'z) ) / @nob . ? requires TSP 4.3 or later (nooptcov option in GMM, when an1 is used) ? neq - number of equations (time periods T-2). ? ivs - a list of instrumental variables. ? imask - a ninst by neq matrix of zeros and ones that specifies ? which instruments are used for which equation. ? an1 - the covariance matrix estimate (returned). local h i i1 diagm ; ? Make the theoretical covariance matrix of the equation residuals ? (MA(1)). ? In TSP 4.4 (rev. 8/97), this can be done with the BAND option to ? MFORM: ?mmake i 2 -1; ? vector of band values, starting with main diagonal ?mform(band,nrow=neq) h = i; mat h = 2*ident(neq) ; if neq .gt. 1 ; then ; do ; do i = 2 neq ; set i1 = i-1 ; set h(i,i1) = -1 ; enddo ; enddo ; moment(noprint) ivs ; ? @mom = (z'z)/@nob mat an1 = sym(h) # @mom ; ? ? Apply the mask to an1, to work around a bug in GMM ? that was fixed on 12/17/97 ? mat diagm = diag(vec(imask)); mat an1 = diagm'an1*diagm; endproc cov1spdm ; ? ==================================================================