I am trying to set up a 7 variable near-VAR, where 3 (foreign) variables are assumed to stay unaffected by the other 4 (domestic) variables. Using the MonteSUR program, I am able to estimate the resulting impulse responses with a Cholesky factorization; however, I would prefer to apply a more adequate structural factorization, as some of my responses seem to lack in economic sense.
I have therefore tried to combine the MonteSUR and MonteSVAR programs into a single program with Monte Carlo integration. The draw for the factor matrix swish has not been a problem; in fact, the program works perfectly well as a regular SVAR without any exogeneities. However, the draw for beta has given me a puzzle. In MonteSVAR, it is based on the covariance matrix of the estimates sxx, but this is and cannot be given by the SUR instruction used in MonteSUR (the RATS variable %xx given by SUR has far too many rows, given that each regressor from each equation is treated as unrelated). I have therefore tried to make the beta draw in the same way as in MonteSUR, that is by estimating the SUR within the Monte Carlo loop, using the structural factor matrix swish as my input matrix.
In a small 3 variable test model, this little trick seemed to work. However, once I started working with the full system, I got the "## REG12. SIGMA Is Singular/Not PSD At Row 5. Too Many Equations for Data Set Size?" error. My data set is indeed not as big as I wished it was, but it has so far been sufficient for the estimation of either a 'normal' near-VAR or a 'normal' SVAR. I assume that the problem lies with my program code rather than with my data set size.
The following is my Monte Carlo loop. Any comments or suggestions how to solve my problem are very much welcome!
Code: Select all
compute sumwt=0.0,sumwt2=0.0
do draws = 1,ndraws
*
if %clock(draws,2)==1 {
*
compute au =%rant(nu)
compute %parmspoke(amatrix,axbase+saxx*au)
compute a =afrml(1)
compute dhat =a*sigmahat*tr(a)
compute ddiag =%xdiag(dhat)
cvmodel(parmset=amatrix,dfc=ncoef,pdf=delta,dmatrix=marginalized,method=evaluate) sigmahat afrml
compute pdensity=%funcval
compute idensity=-((nu+nfree)/2.0)*log(nu+%dot(au,au))
*
compute weight =exp(pdensity-scladjust-idensity-((nu+nfree)/2.0)*log(nu))
*
ewise d(i) =(%nobs/2.0)*ddiag(i)/%rangamma(.5*(%nobs-ncoef)+delta+1)
*
compute swish =inv(a)*%diag(%sqrt(d))
*
sur(noprint,nosigma,model=nearsvar,cv=swish)
compute ransur =%ran(1.0)
compute betau =%decomp(%xx)*ransur
compute surdraw =%beta+betau
}
*
else {
*
compute surdraw =%beta-betau
}
compute %matpoke(fullcoeff,slots,surdraw)
compute %modelsetcoeffs(nearsvar,fullcoeff)
impulse(noprint,model=nearsvar,factor=swish,results=impulses,steps=nstep) nvar
*
compute sumwt =sumwt+weight
compute sumwt2 =sumwt2+weight**2
dim responses(draws)(nvar*nvar,nstep)
compute weights(draws)=weight
ewise responses(draws)(i,j)=impulses((i-1)/nvar+1,%clock(i,nvar))(j)
infobox(current=draws)
end do draws
infobox(action=remove)
*