Deterministic Simulation Gertler-Karadi 2013

Hi everyone,
I have been trying to replicate Gertler-Karadi 2013, and after some work I got to the code attached. In order to make sure the model is correct I need to get IRFs similar to the ones in the article, but they use deterministic shocks that last for more than 1 period. To get there, I understand I need to use the simul function on dynare (correct?). However, I was not able to run it using this code - dynare says it was not able to find a perfect foresight solution for this model. Can you please help me understand what might be the problem in this case?

Thanks in advance,GK13_New7.mod (8.9 KB)


You should always first try a small shock around the steady state and check whether that works. I would also recommend using the


sequence of Dynare 4.5 instead of simul. That allows better control over the steps involved. Also, check whether oo_endo_simul contains the shock sequence you wanted.

Professor, thanks for your answer. The model works fine with small shocks around the steady state, and even with not so small ones. It also works using the “perfect foresight” functions above. However, when I use a multiple period shock with a bigger number of periods, it still doesn’t work properly (perfect foresight solutions are not found). Have you ever seen a similar case? The warning msg I receive is “Warning: Matrix is singular to working precision.” and Err = Inf in each one of the iteractions

Hi @DiogoDuarte.

Could you give an update on how you solved the problem? I have the very same model and although the stochastic simulation works fine, the deterministic is not.


Hi Professor @DiogoDuarte

Thanks for your code, I have been trying to replicate the same model. However, the steady state calculation is always a problem. I download your code but found that you didn’t specify steady state, even if I delete your initial value block, it still works.

Normally a system as large as this model (60 variables) is hard to find steady state. May I ask how did you overcome this problem.

Thank you very much!