Skip to content

Commit eb5177a

Browse files
Revamp our negative binomial explanation (#5365)
Closes #5300 Co-authored-by: Michael Osthege <[email protected]>
1 parent 4eecf14 commit eb5177a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pymc/distributions/discrete.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ class NegativeBinomial(Discrete):
650650
651651
The negative binomial distribution describes a Poisson random variable
652652
whose rate parameter is gamma distributed.
653-
The pmf of this distribution is
653+
Its pmf, parametrized by the parameters alpha and mu of the gamma distribution, is
654654
655655
.. math::
656656
@@ -692,15 +692,24 @@ def NegBinom(a, m, x):
692692
693693
.. math::
694694
695-
\mu &= \frac{n(1-p)}{p} \\
696-
\alpha &= n
695+
p &= \frac{\alpha}{\mu + \alpha} \\
696+
n &= \alpha
697+
698+
If it is parametrized in terms of n and p, the negative binomial describes the probability to have x failures
699+
before the n-th success, given the probability p of success in each trial. Its pmf is
700+
701+
.. math::
702+
703+
f(x \mid n, p) =
704+
\binom{x + n - 1}{x}
705+
(p)^n (1 - p)^x
697706
698707
Parameters
699708
----------
700-
mu: float
701-
Poission distribution parameter (mu > 0).
702709
alpha: float
703-
Gamma distribution parameter (alpha > 0).
710+
Gamma distribution shape parameter (alpha > 0).
711+
mu: float
712+
Gamma distribution mean (mu > 0).
704713
p: float
705714
Alternative probability of success in each trial (0 < p < 1).
706715
n: float

0 commit comments

Comments
 (0)