# Gamma Count Model in PyMC3?

**URL:** <https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803>\
**Category:** Questions\
**Created:** [April 4, 2020, 2:45pm UTC](https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803 "2020-04-04T14:45:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cs224](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cs224/32/2826_2.png) [@cs224](https://discourse.pymc.io/u/cs224)\
**Post date:** [April 4, 2020, 2:45pm UTC](https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803/1 "2020-04-04T14:45:46Z")

</div>

Hello,

I am looking at [Generalizations of Poisson Processes](http://www.mscs.mu.edu/~jsta/issues/11(3)/JSTA11(3)p2.pdf) and here specifically at the “Gamma Count Model”. Before I try to implement that myself I wanted to ask here if somebody did already that or something similar, from where I could copy code?

Thanks a lot and best regards,  
Christian

---

<div class="post-metadata">

**Author:** ![nkaimcaudle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/nkaimcaudle/32/2142_2.png) [@nkaimcaudle](https://discourse.pymc.io/u/nkaimcaudle)\
**Post date:** [April 6, 2020, 10:55am UTC](https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803/2 "2020-04-06T10:55:43Z")

</div>

I believe this is built in already to PyMC3

[https://docs.pymc.io/api/distributions/discrete.html#pymc3.distributions.discrete.NegativeBinomial](https://docs.pymc.io/api/distributions/discrete.html#pymc3.distributions.discrete.NegativeBinomial)

---

<div class="post-metadata">

**Author:** ![gBokiau](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/gbokiau/32/931_2.png) [@gBokiau](https://discourse.pymc.io/u/gBokiau)\
**Post date:** [April 10, 2020, 10:59pm UTC](https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803/3 "2020-04-10T22:59:19Z")

</div>

Gamma Count distributions are a personal favourite. Unfortunately, the gradient of the incomplete gamma function is not implemented in Theano, thus I switched to Tensor Flow for such models.

---

<div class="post-metadata">

**Author:** ![cs224](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cs224/32/2826_2.png) [@cs224](https://discourse.pymc.io/u/cs224)\
**Post date:** [June 19, 2020, 11:31am UTC](https://discourse.pymc.io/t/gamma-count-model-in-pymc3/4803/4 "2020-06-19T11:31:24Z")

</div>

Just as an info to others. I ended up using the R Countr package via [https://pypi.org/project/rpy2:](https://pypi.org/project/rpy2:)  
[https://cran.r-project.org/web/packages/Countr/index.html](https://cran.r-project.org/web/packages/Countr/index.html)  
For my purposes this was sufficient, quick and easy.
