# Optimal policy problem

Hi,

I have a question in solving an optimal policy problem.

There are two steps. On the second stage, given the policy variable, say x, households and firms make their own optimization problem. Then backward, central bank takes households and firms’ choice as a function of the policy variable, f(x), and set the optimal policy rule x* to maximize an objective.

My way to do it is I first set x( or its deviation from a certain level) as a shock and solve the second stage in dynare. I got the decision rules of households and firms in terms of state variables and shocks, including x. Then I wrote another mod file and use “ramsey policy” to find the optimal x where now x is an endogenous variable, along with those decision rules.

Unfortunately, the result of x* doesn’t make any sense. I don’t know what’s wrong. Can anyone explain the potential mistakes of my method? What is the correct way to solve it? Cheers!

I don’t really get what you are doing. The Ramsey-command is already supposed to do both steps that you do. If you do this yourself, you must write a loop over your initial mod-file finding the values of x. If you solve the first step on your own and then use Ramsey, you are doing the first step twice.

Oh, I see. Now I added ramsey_policy at the end of my initial mod file. But it says “Blanchard Kahn conditions are not satisfied: no stable equilibrium”. I noticed this is a common problem on the forum but I didn’t find solutions. My model works when I leave x as an exogenous variable but fails when it becomes endogenous. What are the things I should check to fix it?

You should have a look at monfispol.eu/reports/report_1.1.2.pdf. There is an example showing how to specify x (called r there) as the instrument of the planner.

Thank you for the reference. I now built in the steady_state_model to facilitate the seeking for the steady state. First I want to confirm if the steady state is for any value of the instrument, more than the optimal level.

Secondly, I still didn’t get the optimization. As I change the parameters, I either ran into “Blanchard Kahn conditions are not satisfied: no stable equilibrium”, or “The steady state is complex”. I guess I get the complex because dynare automatically searches in the range of negative values of the instrument, which is not economically possible in my model. So how to impose boundary on the instrument when applying “Ramsey Policy”?