Skip to content

Commit

Permalink
Revamp our negative binomial explanation (#5365)
Browse files Browse the repository at this point in the history
Closes #5300

Co-authored-by: Michael Osthege <[email protected]>
  • Loading branch information
herve-91 and michaelosthege authored Jan 23, 2022
1 parent 4eecf14 commit eb5177a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions pymc/distributions/discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ class NegativeBinomial(Discrete):
The negative binomial distribution describes a Poisson random variable
whose rate parameter is gamma distributed.
The pmf of this distribution is
Its pmf, parametrized by the parameters alpha and mu of the gamma distribution, is
.. math::
Expand Down Expand Up @@ -692,15 +692,24 @@ def NegBinom(a, m, x):
.. math::
\mu &= \frac{n(1-p)}{p} \\
\alpha &= n
p &= \frac{\alpha}{\mu + \alpha} \\
n &= \alpha
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
.. math::
f(x \mid n, p) =
\binom{x + n - 1}{x}
(p)^n (1 - p)^x
Parameters
----------
mu: float
Poission distribution parameter (mu > 0).
alpha: float
Gamma distribution parameter (alpha > 0).
Gamma distribution shape parameter (alpha > 0).
mu: float
Gamma distribution mean (mu > 0).
p: float
Alternative probability of success in each trial (0 < p < 1).
n: float
Expand Down

0 comments on commit eb5177a

Please sign in to comment.