pymc.NegativeBinomial#

class pymc.NegativeBinomial(name, *args, **kwargs)[source]#

Negative binomial log-likelihood.

The negative binomial distribution describes a Poisson random variable whose rate parameter is gamma distributed. Its pmf, parametrized by the parameters alpha and mu of the gamma distribution, is

$f(x \mid \mu, \alpha) = \binom{x + \alpha - 1}{x} (\alpha/(\mu+\alpha))^\alpha (\mu/(\mu+\alpha))^x$
 Support $$x \in \mathbb{N}_0$$ Mean $$\mu$$

The 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}p &= \frac{\alpha}{\mu + \alpha} \\ n &= \alpha\end{split}$

If it is parametrized in terms of n and p, the negative binomial describes the probability to have x failures before the n-th success, given the probability p of success in each trial. Its pmf is

$f(x \mid n, p) = \binom{x + n - 1}{x} (p)^n (1 - p)^x$
Parameters
alpha

Gamma distribution shape parameter (alpha > 0).

mu

Gamma distribution mean (mu > 0).

p

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

n

Alternative number of target success trials (n > 0)

Methods

 NegativeBinomial.__init__(*args, **kwargs) NegativeBinomial.dist([mu, alpha, p, n]) Creates a tensor variable corresponding to the cls distribution. NegativeBinomial.get_n_p([mu, alpha, p, n]) NegativeBinomial.moment(size, n, p)

Attributes

 rv_op