Optimal policy problems

Dear Prof. Jpfeifer,
Professor, I have a problem with ramsey policy of second order approximation. I would very much appreciate any help I could get on this subject.
My situation is, my original basic model(not applying ramsey policy) is running well(every equation number =0).
And the steady state values for the lagrangian multipliers parameters are also correct.
My problem is, my original model is correct and ramsey parameters are correct, but after summing up these two parts, there are error messages like below.

Residuals of the static equations:

Equation number 1 : 0
Equation number 46 : 0
Equation number 47 : 0
Equation number 48 : -0.091696
Equation number 49 : 0
Equation number 50 : 0
Equation number 51 : 0
Equation number 52 : 0
Equation number 53 : 0
Equation number 54 : 0.5212
Equation number 55 : 0
Equation number 56 : 0
Equation number 57 : -0.089634
Equation number 58 : 0
Equation number 59 : 0
Equation number 60 : 0
Equation number 61 : -0.095088
Equation number 62 : 0
Equation number 63 : 0
Equation number 64 : -0.092314
Equation number 65 : 0
Equation number 66 : 0
Equation number 75 : 0


Error using print_info (line 74)
**Impossible to find the steady state. Either the model doesn't have a steady state, there are an infinity of steady states,  or the guess values**
are too far from the solution
Error in steady (line 92)
    print_info(info,options_.noprint, options_);
Error in yjfix (line 790)
Error in dynare (line 180)
evalin('base',fname) ; 
  1. I am not sure I had a wrong steady states values?

  2. Or, I have heard sometimes Dynare can’t get the steady state for the ramsey policy technically, so I am wondering wheather my case is the one or not. If mine is this case, there is no way, I will give up.(so sad, I spent lots of time to reach this step)

  3. Or if not, is there any solution to make all equation zero? because only 5 equations’ residuals are non zero, so i feel like I can fix it. If you knows the method or any suggestions, would you please let me know?

I look forward to hearing from you. Thank you so much Professor!


Are you using a conditional steady state file? From what you describe, your steady state works with the instrument value you set in steady state, but it does not work with the instrument value that is optimally chosen in the Ramsey case.

At which point are you evaluating conditional welfare. I would recommend doing it as in

That is, as in

use the simult_-function to compute welfare at a particular point.

1 Like

Dear Prof. Jpfeifer,

I have a similar model and questions with petiteelf.
I posted a forum topic

to ask for help. And there are still some problems left to be helped.

Since petiteelf didn’t put his .mod and .m file here, I don’t know his model structure at all. But from his questions listed above, I couldn’t find out the exact difference between his questions and mine.


What confuses me is that you suggest me not to run get_consumption_equivalent_conditional_welfare.m in my forum topic, but here you suggest petiteelf to do that.

Why do you give a totally different suggestion? I am so confused. :sob:

Please help me solve these problems. Many thanks.

@MichelleHuang You want to do a grid search instead of running an optimizer. And I was recommending here to use the simult_-function, not to run the full get_consumption_equivalent_conditional_welfare.m as the question is not for the consumption equivalent.


  1. As outlined in Loop over parameters to find maximized welfare, the formula relying on oo_.dr.ghs2 is only valid in the deterministic steady state, while the simult_-function can be used for any point you like. As you are interested in conditional welfare in the deterministic steady state, both should give the same answer.
  2. You need to investigate why the moments in oo_.var are NaN. Those are the unconditional moments and they should exist. The question whether you are considering conditional welfare does not alter the fact that we are interested in the unconditional second moments.

If you are interested in the conditional variance, you can make use of this variance formula. But note that


does not make sense. You are squaring a position. You instead want to define the squared variable in the mod-file and then use this.

A more general question: what (economic) information would the conditional variance convey as opposed to the unconditional variance? E.g., if one would be smaller/greater than the other, what could we learn from that?

One is the variance given your current situation, while the other is the average variance over all possible states of the world. That being said, I have never seen people argue with the conditional variance in the context of welfare.