pymc.ZeroInflatedNegativeBinomial#

class pymc.ZeroInflatedNegativeBinomial(name, psi, mu=None, alpha=None, p=None, n=None, **kwargs)[source]#

Zero-Inflated Negative binomial log-likelihood. The Zero-inflated version of the Negative Binomial (NB). The NB distribution describes a Poisson random variable whose rate parameter is gamma distributed. The pmf of this distribution is

\[\begin{split}f(x \mid \psi, \mu, \alpha) = \left\{ \begin{array}{l} (1-\psi) + \psi \left ( \frac{\alpha}{\alpha+\mu} \right) ^\alpha, \text{if } x = 0 \\ \psi \frac{\Gamma(x+\alpha)}{x! \Gamma(\alpha)} \left ( \frac{\alpha}{\mu+\alpha} \right)^\alpha \left( \frac{\mu}{\mu+\alpha} \right)^x, \text{if } x=1,2,3,\ldots \end{array} \right.\end{split}\]

(Source code, png, hires.png, pdf)

../../../_images/pymc-ZeroInflatedNegativeBinomial-1.png

Support

\(x \in \mathbb{N}_0\)

Mean

\(\psi\mu\)

Var

\[\psi \left(\frac{{\mu^2}}{{\alpha}}\right) +\ \psi \mu + \psi \mu^2 - \psi^2 \mu^2\]

The zero inflated negative binomial distribution can be parametrized either in terms of mu or p, and either in terms of alpha or n. The link between the parametrizations is given by

\[\begin{split}\mu &= \frac{n(1-p)}{p} \\ \alpha &= n\end{split}\]
Parameters:
psitensor_like of float

Expected proportion of NegativeBinomial draws (0 < psi < 1)

mutensor_like of float

Poisson distribution parameter (mu > 0).

alphatensor_like of float

Gamma distribution parameter (alpha > 0).

ptensor_like of float

Alternative probability of success in each trial (0 < p < 1).

ntensor_like of float

Alternative number of target success trials (n > 0)

Methods

ZeroInflatedNegativeBinomial.dist(psi[, mu, ...])