# Optimal Policy using OSR

**URL:** <https://forum.dynare.org/t/optimal-policy-using-osr/4960>\
**Category:** Dynare help (legacy posts)\
**Created:** [29 August 2015 22:43 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960 "2015-08-29T22:43:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![camara\_cmb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@camara\_cmb](https://forum.dynare.org/u/camara_cmb)\
**Post date:** [29 August 2015 22:43 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/1 "2015-08-29T22:43:51Z")

</div>

Hi

I have been trying to calculate the osr for mi DSGE model for the first time. The parameter I would like to evaluate which is it´s optimal value is called “T”, and in the parameter section of my code I have given it a value “T=0.1;”.

When I run my code I get the following statement

OPTIMAL SIMPLE RULE

OSR: Initial value of the objective function: 0

* * *

* * *

## f at the beginning of new iteration, 0.0000000000 Norm of dx 0

Improvement on iteration 1 = 0.000000000  
improvement \< crit termination  
zero gradient

OPTIMAL VALUE OF THE PARAMETERS:

```
T 0.1

```

Objective function : 0

When I change the value of T at the parameter section of my code, the Optimal Value is always the one I set as parameter. Any clue why this happens?  
Thanks in advance

---

<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:** [30 August 2015 07:10 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/2 "2015-08-30T07:10:50Z")

</div>

For some reason your objective function is flat in the parameter T. Maybe it’s not identified or you did a mistake when coding it. Check where T enters the model.

---

<div class="post-metadata">

**Author:** ![camara\_cmb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@camara\_cmb](https://forum.dynare.org/u/camara_cmb)\
**Post date:** [2 September 2015 03:33 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/3 "2015-09-02T03:33:44Z")

</div>

Thanks for your reply!  
Is there an example code for optimal policy other than the one in the user guide or manual?  
I have tried the command for different parameters other than T, those that influence the procyclicality of government expenditure for example, and I always get the same result.  
Thanks in advance for any comment

---

<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:** [2 September 2015 06:09 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/4 "2015-09-02T06:09:21Z")

</div>

Please provide me with the file.  
Some OSR examples are at [github.com/DynareTeam/dynare/tree/master/tests/optimal\_policy](https://github.com/DynareTeam/dynare/tree/master/tests/optimal_policy)

---

<div class="post-metadata">

**Author:** ![camara\_cmb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@camara\_cmb](https://forum.dynare.org/u/camara_cmb)\
**Post date:** [5 September 2015 17:45 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/5 "2015-09-05T17:45:41Z")

</div>

Thanks!  
I could calculate the optimal value of the parameters in my model thanks to your examples!  
I have one extra question, if you have the time, can I fix an upper or lower bound over the value the parameters?

---

<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:** [5 September 2015 18:05 UTC](https://forum.dynare.org/t/optimal-policy-using-osr/4960/6 "2015-09-05T18:05:18Z")

</div>

See [[Restricting parameters in Dynare](https://forum.dynare.org/t/restricting-parameters-in-dynare/4701/1))
