Would a cost-push shock make sense when I’m not distinguishing between output gap (ytilde) and welfare relevant output gap (denoted by x) as in Gali’s notation? I understand cost-push shock would be zero in this case according to the textbook. But I am still able to run this with a positive mark-up shock in Dynare, I cannot understand why would that be happening.

I have a two-sector NK model, and I have derived a second order approximation to household’s utility function analytically. When I try to use it for optimal policy, I get the following error: “You cannot include exogenous variables in the planner objective. Please define an auxiliary endogenous variable like eps_aux=epsilon and use it instead of the varexo.”
I am unable to understand why this would be happening (Please find my Dynare file attached, in case need be).optpolicy.mod (11.7 KB)

I would really appreciate some guidance on this. Thank you very much!

Thank you very much for your kind response, that was really helpful.
I have two queries:

(1) I understand what you have suggested. I have modified the mod file slightly as I found some errors in the NKPC in the version I had uploaded here and have incorporate the change you’ve suggested. In this revised file (optpolicy_v2.mod (11.6 KB) ) the residuals of some of the equations are non-zero in this case - is that a problem? Also when I run this, it gives the following error:

Error using ramsey_policy (line 34) You have specified fewer instruments than there are omitted equations

Error in optpolicy_v2 (line 629) ramsey_policy(var_list_);

I noticed that you have removed ‘linear’ from the model declaration even though all linearized equations are listed subsequently. Is that only to accommodate the LQ loss/welfare function?

(2) In another file (optpolicy_alt.mod (11.2 KB) ) I have removed model-local variables and specified the same analytically derived loss function. I have written the code based on your codes for Gali (2015) Chapter 5. But I get the same error as above.

I would really appreciate your guidance on how to resolve this. Thank you very much!

Thank you very much for getting back. When I run the two files (optpolicy_v2.mod and optpolicy_alt.mod), I only get the following error:

Error using ramsey_policy (line 34) You have specified fewer instruments than there are omitted equations

Error in optpolicy_v2 (line 629) ramsey_policy(var_list_);

Although the latter file gives a ‘warning’ that some variables are not assigned a value in the steady-state block. I have reattached the two files: optpolicy_v2.mod (11.6 KB) optpolicy_alt.mod (11.2 KB)

I would really appreciate your guidance on this, thank you!

I’m sorry, I was on a earlier version of Dynare and that error didn’t show up for me. It did on the latest version, apologies for the confusion.

I have fixed those two errors now, please find the corrected mod files attached. However, the original error regarding fewer instruments still persists. I would be very glad for your guidance on this. Thank you very much. optpolicy_v3.mod (11.7 KB) optpolicy_alt_v2.mod (11.3 KB)

Thank you very much for your reply and for your help. I have been able to make it work now. I get the following result though which doesn’t seem quite likely:

Approximated value of planner objective function
- with initial Lagrange multipliers set to 0: 0.00000000
- with initial Lagrange multipliers set to steady state: 0.00000000

Is it norrmally okay for the planner objective function to be zero? Also, some residuals as well as the theoretical moments come out to be NaN-is that a problem? I would really appreciate your help with this, thank you very much! optpol_v4.mod (13.0 KB)

Some theoretical moments are NaN because there is a unit root. It seems to be the case for price levels, which is usual. That’s why you use inflation rates.
Regarding the objective function: it’s exactly 0, because you need to go to order=2 in your case, which is not yet supported.
See optpol_v4.mod (13.0 KB)

I see, thank you very much for your guidance on this.

Yes, this gives the response that order>1 is not yet supported.

I’m not sure if I understand this completely. I’m sorry I’m not adept at this, but if you could please guide me a little: How can I circumvent this and why did this problem not arise in your codes for Gali (2015) Chapter 5? I am using an analytically derived micro-founded loss function compatible with this two sector model as you are using for the one-sector model in your codes.
I would really appreciate your guidance, thank you!

It’s a bit complicated. Usually, you have the full planner objective defined outside of the model block. So when Dynare does a first order approximation to the model and a second order approximation to the objective it works (under some theoretical conditions). But now the required higher order terms are in the model block itself. Taking the required derivatives from the model block has not been implemented yet.

The solution as in my mod-file should be to get rid of the model-local variables and implement the full planner objective outside of the model block.