Lag == 0 error when solving for Ramsey optimal policy

Hi

I’m trying to solve for the Ramsey optimal equilibrium in a fairly large model. I have excluded the estimated policy rule from the model block. And I have the following code at the end of my mod file:

planner_objective infl^2 + 1/64*y_va^2;
ramsey_model(planner_discount=beta);
stoch_simul(order=1) infl;

But I get this error:

Normalizing the dynamic model…
Finding the optimal block decomposition of the dynamic model…
103 block(s) found:
100 recursive block(s) and 3 simultaneous block(s).
the largest simultaneous block has 149 equation(s)
and 149 feedback variable(s).
Computing original Ramsey model derivatives (order 2).
Assertion failed: lag == 0, file ../preprocessor/src/DynamicModel.hh, line 507

The original model solves fine with the estimated policy rule in it. And I tried the Ramsey code above with a simpler model, and it also works fine. Although, for the simpler model, the printed output says “Computing planner objective derivatives (order 3).” instead of “Computing original Ramsey model derivatives (order 2).”

Thanks!

Can you please provide me with the code? Potentially via PM.

This is a bug that should be fixed in tomorrow’s unstable version.

This problem arises with Ramsey models declared as linear, when there is a lead/lag >1 on endogenous variables or >0 on exogenous. In your model, the problem comes from mehours(-1) which is an exogenous.

A workaround until the next Dynare release is to manually create an auxiliary variable to remove the lag or remove the linear statement.

Thanks Johannes! It works when (linear) is removed. Much appreciated.