This page is frozen and has been moved to https://git.dynare.org/Dynare/dynare/wikis/mode-compute-6

In some situations the posterior mode (that will be used to initialize the Metropolis Hastings (MH) and to define the jumping distribution) is hard to obtain with standard (newton like) optimization routines. The user, by specifying **mode_compute = 6**, can trigger a Monte-Carlo based optimization routine.

- It's not an optimization routine!... Or a very inefficient one.
- For the MH algorithm we don't need to start from the posterior mode. We only need to start from a point (in parameters space) with a high posterior density value and to use a good covariance matrix for the jumping distribution.
- The idea is to use a MH algorithm with a diagonal covariance matrix (prior variances or a covariance matrix proportional to unity) and to continuously update the posterior covariance matrix and the posterior mode estimates through the MH draws.
After each MH-draw

latex error! exitcode was 2 (signal 0), transscript follows: [Tue Sep 07 15:36:55.249983 2021] [wsgi:error] [pid 2600:tid 139902318507776] [client 192.168.1.1:44088] failed to exec() latex, referer: https://archives.dynare.org/DynareWiki/

in the posterior distribution we update the posterior mean, the posterior mode and the posterior covariance as follows:latex error! exitcode was 2 (signal 0), transscript follows: [Tue Sep 07 15:36:55.298124 2021] [wsgi:error] [pid 2601:tid 139902318507776] [client 192.168.1.1:44088] failed to exec() latex, referer: https://archives.dynare.org/DynareWiki/

latex error! exitcode was 2 (signal 0), transscript follows: [Tue Sep 07 15:36:55.344421 2021] [wsgi:error] [pid 2602:tid 139902318507776] [client 192.168.1.1:44088] failed to exec() latex, referer: https://archives.dynare.org/DynareWiki/

latex error! exitcode was 2 (signal 0), transscript follows: [Tue Sep 07 15:36:55.395887 2021] [wsgi:error] [pid 2603:tid 139902318507776] [client 192.168.1.1:44088] failed to exec() latex, referer: https://archives.dynare.org/DynareWiki/

Use

**options_.Opt6Numb =**[default=20000] (before the estimation command) to set the number of simulations in the new routine.Use

**options_.Opt6Iter =**[default=3] to call repeatedly the new optimization routine. Improves the estimates of the posterior covariance matrix and of the posterior mode.- This new optimization routine also provides a scale parameter (for the jumping distribution) such that acceptance ratio of the MH simulations will be around one third.

- In Dynare unstable the options have been renamed and made more flexible
Use

**options_.gmhmaxlik.iterations =**[default=3] to call repeatedly the new optimization routine. Improves the estimates of the posterior covariance matrix and of the posterior mode.Use

**options_.gmhmaxlik.number =**[default=20000] to set the number of simulations used in estimation of the covariance matrix.Use

**options_.gmhmaxlik.nscale =**[default=200000] to set the number of simulations used in the tuning of the scale parameter.Use

**options_.gmhmaxlik.nclimb =**[default=200000] to set the number of simulations used in the hill climbing simulations.