# Optimal policy problems

**URL:** <https://forum.dynare.org/t/optimal-policy-problems/12347>\
**Category:** Optimal Policy\
**Created:** [31 August 2018 14:40 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347 "2018-08-31T14:40:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![petiteelf](https://forum.dynare.org/letter_avatar_proxy/v4/letter/p/bc8723/32.png) [@petiteelf](https://forum.dynare.org/u/petiteelf)\
**Post date:** [31 August 2018 14:40 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/1 "2018-08-31T14:40:27Z")

</div>

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.

```auto
 
----------------
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)
steady;
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!

Best,  
Esther

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [4 September 2018 05:47 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/3 "2018-09-04T05:47:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [8 September 2018 18:12 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/6 "2018-09-08T18:12:29Z")

</div>

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

> **[JohannesPfeifer/DSGE\_mod](https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Born_Pfeifer_2018/Welfare)**
>
> A collection of Dynare models. Contribute to JohannesPfeifer/DSGE\_mod development by creating an account on GitHub.

That is, as in

> <https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Born_Pfeifer_2018/Welfare/get_consumption_equivalent_conditional_welfare.m>

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

---

<div class="post-metadata">

**Author:** ![MichelleHuang](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@MichelleHuang](https://forum.dynare.org/u/MichelleHuang)\
**Post date:** [10 September 2018 13:46 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/8 "2018-09-10T13:46:06Z")

</div>

Dear Prof. Jpfeifer,

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

> [@Loop over parameters to find maximized welfare](https://forum.dynare.org/t/loop-over-parameters-to-find-maximized-welfare/12358/3):
>
> Thank you for your quick reply!!! It’s real helpful!! But I still have some questions: done I am not sure whether my shock size is correct… I just follow the .mod file from Matteo Iacoviello, 2015. " [Financial Business Cycles](https://ideas.repec.org/a/red/issued/14-27.html) ," [Review of Economic Dynamics](https://ideas.repec.org/s/red/issued.html), Elsevier for the Society for Economic Dynamics, vol. 18(1), pages 140-164, January. And my model structure is basically modified from it. But I don’t know what’s the effect of different scale of shock size. Should I choose my shock …

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. 😭

Please help me solve these problems. Many thanks.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [13 September 2018 10:18 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/10 "2018-09-13T10:18:48Z")

</div>

@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.

@petiteelf

1. As outlined in [Loop over parameters to find maximized welfare](https://forum.dynare.org/t/loop-over-parameters-to-find-maximized-welfare/12358/9), 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.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 September 2018 06:48 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/12 "2018-09-15T06:48:52Z")

</div>

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

```auto
posCsq=(strmatch('C',M_.endo_names,'exact'))^2;

```

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.

---

<div class="post-metadata">

**Author:** ![jojokre](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jojokre](https://forum.dynare.org/u/jojokre)\
**Post date:** [15 September 2018 12:37 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/13 "2018-09-15T12:37:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [16 September 2018 07:58 UTC](https://forum.dynare.org/t/optimal-policy-problems/12347/14 "2018-09-16T07:58:43Z")

</div>

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.
