I am trying to replicate Karadi and Nakov (2021 JME) . I am particularly interested in replicating how they solve the optimal policy with perfect-foresight, for example, Figure 3 in the paper.

I am attaching the two code for computing the steady-state and then for solving the Ramsey problem compute_ss.mod and compute_dynamic.mod with other auxiliary files. These are modified codes just for this exercise based on the sample codes available here. Dynare says it can’t find the solution. When you get a chance, would you mind taking a quick look to see if I am doing it correctly?

Hi @jpfeifer, thanks for your reply! The original code was also for policy rule for QE with nonnegativity constraints using immcp. This part works fine. In order to solve Ramsey problem, as I understand, one has to comment out those together with policy variables. That was all I did.

I am trying to solve it with nonnegativity constraints (more precisely, inequality constraints) imposed by ramsey_constraints block in constraints.mod, instead of having equations for policy variables (e.g., monetary rule) with a tag of mcp in the model block.

One thing is that when I set parameter \tau_{b2}=0 (no cost in QE case indicated as red dotted line in Figure 3), dynare finds the solution, although it displays a warning Warning: Matrix is singular to working precision. Why do I get these warnings by the way?

Dynare can’t solve the problem with a little bit of positive value for \tau_{b2}=1e-5 (black line in Figure 3) as in the files that I posted. Do you think having longer periods in perfect_foresight_setup would solve this problem?