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\mu + \left (1 + \frac{\mu}{\alpha} + \frac{1-\psi}{\mu} \right)\)

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
psi: float

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

mu: float

Poission distribution parameter (mu > 0).

alpha: float

Gamma distribution parameter (alpha > 0).

p: float

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

n: float

Alternative number of target success trials (n > 0)

Methods

ZeroInflatedNegativeBinomial.__init__(*args, ...)

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