# Rerun OSR to check for optimality or local extremum

**URL:** <https://forum.dynare.org/t/rerun-osr-to-check-for-optimality-or-local-extremum/12988>\
**Category:** Optimal Policy\
**Created:** [20 December 2018 22:33 UTC](https://forum.dynare.org/t/rerun-osr-to-check-for-optimality-or-local-extremum/12988 "2018-12-20T22:33:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [26 December 2018 11:49 UTC](https://forum.dynare.org/t/rerun-osr-to-check-for-optimality-or-local-extremum/12988/2 "2018-12-26T11:49:05Z")

</div>

1. You are not running a proper loop. Please have a look at

> [@Policy frontier](https://forum.dynare.org/t/policy-frontier/5910/6):
>
> Starting with the unstable version of 12/18/2016 (Dynare 4.5), the following code should work for your mod-file % make loop silent options\_.nofunctions=1; options\_.nocorr=1; options\_.noprint=1; options\_.irf=0; options\_.silent\_optimizer=1; options\_.osr.opt\_algo=9; % find position of variables in variable\_weights y\_pos=strmatch('y\_hat',M\_.endo\_names,'exact'); pi\_pos=strmatch('pi\_hat',M\_.endo\_names,'exact'); % find position of variables in var\_list\_ y\_pos\_var\_list\_=strmatch('y\_hat',var\_list\_,'e…

and use `set_param_value` to update your parameter `a`.  
2. It is not uncommon that the optimal parameters are extremely large. See

> [@Optimal simple rule](https://forum.dynare.org/t/optimal-simple-rule/6158/2):
>
> What do you mean with Dynare is unable to find a solution When I run the code with the unstable version, I get which is a solution It is not unheard of that optimal parameters may be infinity (essentially full stabilization). In those cases, people often restrict the parameter range. In the unstable version, you can use osr\_param\_bounds; phiP, -1, 1; end; What do you mean with You want a welfare function that is maximized using that parameter?

1. Within your loop you can add another loop that draws random starting values.

---

_[View the full topic](https://forum.dynare.org/t/rerun-osr-to-check-for-optimality-or-local-extremum/12988)._
