I am experiencing an issue computing Ramsey policy. When I run the mod file without activating the ramsey_policy command, there are zero residuals for all equations. But when I activate the command, some of the residual become ‘NaN’. Although the code still runs through giving the value of the planner’s objective, it doesn’t seem like this should be the case.

The static model for Ramsey is very different than the one for stoch_simul. In the latter, you have as many variables as equations and provide initial values for all variables. In Ramsey, you have (at least) one instrument whose steady state you do not know. Moreover, there are Lagrange mutipliers for which you don’t know the steady state. Thus, the

The purpose of the Ramsey-command is to compute exactly these missing variables. While you cannot compute the steady state before having these objects, you can do that afterwards. As you can see, the residuals when running the Ramsey command are 0, i.e. Dynare was able to compute the steady state for the endogenous variables, the instrument, and the multipliers. Thus, there is no reason to worry about the results. Everything works as expected, as far as I can see.