# Variance 0 at the mode is propagating to metropolis hasting

**URL:** <https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341>\
**Category:** ML/Bayesian estimation\
**Created:** [9 July 2017 01:59 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341 "2017-07-09T01:59:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aldo](https://forum.dynare.org/user_avatar/forum.dynare.org/aldo/32/5490_2.png) [@Aldo](https://forum.dynare.org/u/Aldo)\
**Post date:** [9 July 2017 01:59 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/1 "2017-07-09T01:59:58Z")

</div>

Some of my posteriors are very tight around some points, My results can be downloaded from:

[drive.google.com/open?id=0B7CeaUeeWSo3VjZ1dFRmbHlVd00](https://drive.google.com/open?id=0B7CeaUeeWSo3VjZ1dFRmbHlVd00)

(pag. 70-77).  
I think it happens because variance almost 0 at the mode is propagating to metropolis hasting.  
Is this result normal or is this a problem and I should be worry. How could I fix this?

I am thinking to modify priors so that they have mean and variance similar to the computed at mode.

Thanks a lot

---

<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:** [10 July 2017 14:07 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/2 "2017-07-10T14:07:40Z")

</div>

Your MCMC did clearly not converge yet. You may need a lot more draws. How did the mode\_check plots look like? And what was the acceptance rate during the MCMC?

---

<div class="post-metadata">

**Author:** ![Aldo](https://forum.dynare.org/user_avatar/forum.dynare.org/aldo/32/5490_2.png) [@Aldo](https://forum.dynare.org/u/Aldo)\
**Post date:** [25 September 2017 23:32 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/3 "2017-09-25T23:32:14Z")

</div>

Dear jpfeifer, I think the mode\_check plots looks good and the acceptance rate during the MCMC was stable and near to 35%. I attach my plots.

[prometheo\_TeX\_binder.pdf](https://forum.dynare.org/uploads/default/original/2X/f/f1be614afeb2751b945a3f173fb22d31c029fbef.pdf) (1.1 MB)

I suspect I will get Variance 0 after MCMC even if I set more draws, because the Ramdom Walk Metropolis Hasting draws random numbers from nomal distribution with variance based in the mode which is zero for several parameters.

I attach my mod-file and data.

[modefile.zip](https://forum.dynare.org/uploads/default/original/2X/d/d296db395d7ac8f98e22c2c0b0e77503256ab946.zip) (148.4 KB)

---

<div class="post-metadata">

**Author:** ![Robert](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.dynare.org/u/Robert)\
**Post date:** [26 September 2017 07:40 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/4 "2017-09-26T07:40:55Z")

</div>

Hi Aldo,

Judging from the mode check plots a few parameters are still away from their mode. I’m talking about: rho\_i, phi\_i, kappa\_b, etaf, a22, a13, a21 and a32. I guess you used mode\_compute=6, since you are able to estimate the model right after mode finding. If you would have used another mode finding routine you would have ended up with a warning message saying that the hessian matrix at the “mode” is not positive definite. However, under mode\_compute=6 you might need a lot more draws later for the MCMC. The explanation for this can be [found here](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/8) . Since you are working with a larger model I would say in the millions.

Best,

Robert

---

<div class="post-metadata">

**Author:** ![Aldo](https://forum.dynare.org/user_avatar/forum.dynare.org/aldo/32/5490_2.png) [@Aldo](https://forum.dynare.org/u/Aldo)\
**Post date:** [26 September 2017 10:53 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/5 "2017-09-26T10:53:39Z")

</div>

Thank you dear Robert,  
I am using mode\_compute = 5 and the hessian is negative definite, I attached my mod-file.

```
estimation(
datafile='consolidado',
presample=0,
mode_compute = 5, optim = ('Hessian',2), 
mode_check,
diffuse_filter, 
mh_replic=20000,
mh_drop=0.333, 
mh_nblocks=1, /
posterior_sampling_method = 'random_walk_metropolis_hastings',
//bayesian_irf, irf=20,
//nograph,
forecast = 12,
tex
)
```

---

<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:** [27 September 2017 08:57 UTC](https://forum.dynare.org/t/variance-0-at-the-mode-is-propagating-to-metropolis-hasting/6341/6 "2017-09-27T08:57:57Z")

</div>

This still suggests a problem in mode-finding. Given the size of your model, debugging this amounts to finding a needle in a haystack. Maybe you should start from a smaller model that works.
