Problems trying to compute Ramsey Policy

Hello everyone,

I am trying to compute Ramsey policy but I have to problems with this. First, the planner objective has habits on consumption so I need to run…

planner_objective((log(cons - hcons*cons(-1)) - lpsi*((lab^(1+vartheta))/(1+vartheta))));

and I get the error:

ERROR: Leads and lags on variables are forbidden in ‘planner_objective’
Is there a way of introducing lags in the planner objective? If not, how can I get an equivalent function?

Second, does anyone know whether it is possible to compute ramsey policy in Dynare for a model that uses external funtions? When I change the objetive equation to avoid the lags problem and use this command

planner_objective((log(cons - hcons*cons) - lpsi*((lab^(1+vartheta))/(1+vartheta))));

I get this new error:

ERROR: third order derivatives of external functions are not implemented

Thank you for your help!

Regarding the second error, I would need to see the file. Regarding the first issue: you can circumvent the problem by defining a lagged variable in the model:

and then writing the objective as

planner_objective((log(cons - hcons*cons_lag) - lpsi*((lab^(1+vartheta))/(1+vartheta))));

Hello jpfeifer,

I attach here the mod-file.

MMwelfare2.mod (33.9 KB)

paramfileopenMPRUBOTH.mat (8.8 KB)

Thank you very much

This is a limitation of Dynare, see
You are calling external functions and for this optimal policy problem, the third derivatives would be required.

Ok. So the only way would be then to compute the third derivatives by hand and then indicate to dynare in some way which they are, right? or is there an alternative?

As far as I can see, there is no reason to use external functions. You can use Dynare’s builtin function for the Gaussian PDF and CDF, e.g.:

Fwbar = log(normcdf(omega,-(1/2)*(sig^2),sig));
Fwbarw = log(normpdf(omega,-(1/2)*(sig^2),sig));