I have been trying to estimate the basic New Keynesian model of Gali (2008) and run into a number of problems. Since I am new to Dynare, I do not know how to fix them properly.
The code I used is similar to Prof. Pfeifer’s on Github. For the measurement equations, I used the transformation suggested in Pfeifer’s ‘A Guide to Specifying Observation Equations for the Estimation of DSGE Models’ (2018, pp. 39). Namely, I used the detrended log real GDP, demeaned log inflation and demeaned log interest rate.
However, the error ‘input matrix must be positive definite’ shows up while using mode_compute 4 and 9. Furthermore, the mode_check command suggests that a certain variable (phi_pi) is way too low and should be at least three times as large. Finally, after using mode_compute 6, the posterior distributions of the variables become spikes.
Hence, my question: is this a problem due to unrealistic prior distributions or the data transformation? I greatly appreciate any help!
Mod file and data are attached.
gali_2008.mod (1.5 KB)
daten_fertig.txt (3.6 KB)
Thank you Prof. Pfeifer for your quick and kind answer. I have some follow-up questions or comments.
- As mentioned, I am relatively new to Dynare. I looked at your mod-file again, but I do not see how to take parameter dependence into account. Would you be so kind to give me an idea or hint?
- the three month Libor is retrieved quarterly. I assumed that it is annualized and hence I used the following transformation:
Again, I really appreciate your suggestions and answers.
My mod-file uses model-local variable (#-operator) for the composite parameters. You hardcode them.
Thank you again Prof. Pfeifer for you helpful answer!!
I transformed the data with the logarithm and used the #-operator. Now, mode_compute 4 works finally with the option mcmc_jumping_covariance=prior_variance. However, the posterior distribution seems to be quite odd. While employing this particular command the posterior distribution looks only partially complete and dynare tells me that there are not enough draws computes to compute HPD Intervals and deciles.
Furthermore, after using mode compute 6, there are two spikes at certain values and singular at others. Is there a particular reason for that and how is it possible to fix this?
I really appreciate your help, which helped me a lot.
The pdf’s are attached. Thank you
posterior_1.pdf (123.0 KB)
posterior_2.pdf (128.1 KB)
You need to more properly investigate this. Your MCMC has not converged. First of all, check whether the
mode_check-plots look sensible. Use the most recent stable version, and run a chain with sufficient draws (