# Hierarchical Binomial Model - Not converging

**URL:** <https://discourse.pymc.io/t/hierarchical-binomial-model-not-converging/2624>\
**Category:** Questions\
**Created:** [January 31, 2019, 8:21pm UTC](https://discourse.pymc.io/t/hierarchical-binomial-model-not-converging/2624 "2019-01-31T20:21:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![federico\_claudi](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@federico\_claudi](https://discourse.pymc.io/u/federico_claudi)\
**Post date:** [January 31, 2019, 8:21pm UTC](https://discourse.pymc.io/t/hierarchical-binomial-model-not-converging/2624/1 "2019-01-31T20:21:11Z")

</div>

Hi,

I am very new to Bayesian statistics, probabilistic programming and PyMC3, so forgive my simple question.

I am trying to build a very simple model like this:  
[https://docs.pymc.io/notebooks/GLM-hierarchical-binominal-model.html](https://docs.pymc.io/notebooks/GLM-hierarchical-binominal-model.html)

The idea would be to estimate the posterior distribution of two groups of individuals tested in two conditions, but the sampler only converges for one of the two data sets. To me the data look fairly similar, so I am not sure what could be causing it.

I’ve seen online that a possible solution would be to implement a non-centred model like this:  
[https://twiecki.io/blog/2017/02/08/bayesian-hierchical-non-centered/](https://twiecki.io/blog/2017/02/08/bayesian-hierchical-non-centered/)  
but I do not know how to implement it here.

You can see a more detailed description of my problem here:

> <https://stackoverflow.com/questions/54468264/pymc3-hierarchical-binomial-model-divergences-after-tuning>

if anyone has any tips on how to reparametrize my model that would be so great 🙂  
Thank you,  
Federico

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [January 31, 2019, 10:29pm UTC](https://discourse.pymc.io/t/hierarchical-binomial-model-not-converging/2624/2 "2019-01-31T22:29:18Z")

</div>

Embrace the divergences - it helps you debug your model: [https://docs.pymc.io/notebooks/Diagnosing\_biased\_Inference\_with\_Divergences.html](https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html)

In particular, use the diagnostic plot to check where in the parameter space is problematic, and adjust the prior to put more weight to that region.

---

<div class="post-metadata">

**Author:** ![federico\_claudi](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@federico\_claudi](https://discourse.pymc.io/u/federico_claudi)\
**Post date:** [February 1, 2019, 10:09am UTC](https://discourse.pymc.io/t/hierarchical-binomial-model-not-converging/2624/3 "2019-02-01T10:09:26Z")

</div>

Thank you, I will try that!
