Questions about BVAR/DSGE procedure

I am getting a very odd result for the BVAR /DSGE procedure in dynare and hope that someone here can help me out.

In particular I am interested in simulating data from a hybrid model and checking for the ‘lambda’ weight that maximizes the marginal density on this simulated data.

When I do this with the Rabanal and Rubio-Ramirez (2003) example included with dynare I find that the exercise produces the correct answer.

When I carry out the same exercise in a very simple model, in this case the Long and Plosser model which has an exact log-linear solution (due to full depreciation of capital), I get the wrong answer. For example, simulating data from a dsge model and estimating lambda on the generated data yields lambda=0 (all the weight is on the VAR).

I am wondering why it would be the case that the code is working correctly in the more complex model but doesn’t in the small model. Could dynare have a mistake or does the procedure have problems with robustness?

Also, I am finding the marginal density calculation that uses the modified harmonic mean does not work with the BVAR/DSGE procedure (specifying mh_replic>0). In this case it is only possible to approximate the marginal density using Laplacian approximation. Does the ‘Laplacian Approximation’ correspond to laplacian quadrature?

Thanks in advance,
datapull.m (158 Bytes)
lpsim.mod (951 Bytes)
lpest.mod (1.45 KB)

I think I have found the reason for the odd results I report above. The policy rule contains a constant vector. When I set the constant vector to zero I get the correct result. When this vector is nonzero I get the strange result. For some reason the model is simulating correctly with the constant though the estimation isn’t correct with the constant. Can someone let me know why this would be the case?

Thanks in advance,

When you are writing

gammak=((1-alph)/(1+psi))*log((1-alph)/(1-bet*alph)) + log(bet*alph);

in the parameter initialization section of the *.mod file, gammak and gammaa are initialized only once with the original value of psi, but their value doesn’t change when the value of psi changes thru estimation.

When one has functions of deep parameters as here, one should write the derived parameters definition inside the model block with a pound sign (#) to distinguish it from an equation:

#gammak=((1-alph)/(1+psi))*log((1-alph)/(1-bet*alph)) + log(bet*alph);
    a     = gammaa + alph*k(-1) + (1-alph)*z + alph/(1+psi)*x;
    k     = gammak + alph*k(-1) + (1-alph)*z - (1-alph)/(1+psi)*x;



Hi Michel,

I followed your advice but it doesn’t change my result. Could there be any other explanation?


Dear Josh,

when you run lpest on your simulated data, you get the following score:

You do find that the highest (positive) score is indeed for lambda close to 0

For lambda = 10000, Dynare fails to find a proper mode and return a meaningless (very low) value for the marginal density.