Monte Carlo Integration for structural near-VAR
The attached program does Monte Carlo integration for an overidentified structural covariance model with a near-VAR. This is based upon the six-variable model from Sims and Zha, Econometrica 1999 (http://www.estima.com/forum/viewtopic.php?f=8&t=335&p=830) with the adjustment that the equation for investment excludes all the other variables. The use of a near-VAR (rather than a flat prior full VAR) complicates the Monte Carlo integration because the marginal likelihood of the covariance matrix depends upon the observed covariance matrix of the residuals at the current draws for the lag coefficients rather than the observed covariance matrix at the OLS estimates only. This uses random walk Metropolis for the structural VAR coefficients, then draws the lag coefficients using the procedures from the SURGibbsSetup file.
This same basic method can be used for an informative prior on the lag coefficients combined with a structural model for the covariance matrix. The subcalculation
compute hpost=hdata
compute vpost=inv(hpost)
compute bpost=vpost*hbdata
compute bdraw=bpost+%ranmvnormal(%decomp(vpost))
is for a flat prior on the lag coefficients. You can add in a prior by making the appropriate adjustments to the calculation of HPOST (adding the precision of the prior) and BPOST (VPOST*(HBDATA+precision of the prior x its mean)).
There is quite a bit more calculation involved in this than there is for a flat prior full VAR; basically it requires a full system estimate for the SUR model at each sweep. This model has 130 coefficients in the near-VAR and takes about five minutes to do 12000 sweeps. The computational burden goes up roughly with the cube of the number of coefficients, so a 1000 coefficient model will take about 400 times as long.
This same basic method can be used for an informative prior on the lag coefficients combined with a structural model for the covariance matrix. The subcalculation
compute hpost=hdata
compute vpost=inv(hpost)
compute bpost=vpost*hbdata
compute bdraw=bpost+%ranmvnormal(%decomp(vpost))
is for a flat prior on the lag coefficients. You can add in a prior by making the appropriate adjustments to the calculation of HPOST (adding the precision of the prior) and BPOST (VPOST*(HBDATA+precision of the prior x its mean)).
There is quite a bit more calculation involved in this than there is for a flat prior full VAR; basically it requires a full system estimate for the SUR model at each sweep. This model has 130 coefficients in the near-VAR and takes about five minutes to do 12000 sweeps. The computational burden goes up roughly with the cube of the number of coefficients, so a 1000 coefficient model will take about 400 times as long.