Dear All,

I’m a novice at Bayesian estimation in Dynare, and I thought as a simple first step I would try to replicate the model from Chapter 1 of the Herbst and Schorfheide book, “Bayesian Estimation of DSGE Models”. I wrote up the mod file of the linearized model, and the impulse response functions seem to match very well the IRFs in the book. This is just a simple 3 equation model, with an Euler equation, Phillips curve, and monetary policy rule.

The problem starts when it comes to the estimation. As a simple first step, before trying to estimate the model on actual data, I generate simulations from the solved model and do a Bayesian estimation of the simulated data.

Unfortunately, the estimation does not seem to run – or when I make changes to get it to run, the results look weird. In my initial estimation attempt, I get the following error message:

“Error using chol Matrix must be positive definite.”

Searching the forum, people suggested using the option “mode_compute=6,prior_trunc=0”. When I used this option the simulation did run, but the posteriors looked way off.

My questions are thus as follows:

(1) Can anyone see if there is an error in the way I have set up the model or estimation? Because the IRFs seem to match the book it would seem that the model is set up correctly. Perhaps the error is with the way the observation equations are set up? Or with the priors?

(2) Can anyone point me to some code for a simple estimation of the NK model? In this way I could work from this to try and find my error.

I have attached the mod file that performs the estimation here. Please let me know if you have any questions, and thank you.

Jake

nk_loglin.mod (4.2 KB)