Skip to content

Negative Binomial Distribution#

Probability Mass Function#

\[f(k, r, p) = \P( X = k ) = \binom{k+r-1}{k} p^k (1-p)^{r}\]

with the number of failures \(r\), the number of successes \(k\), and the success probability \(p\).

0 5 10 15 20 25 30 0.000 0.025 0.050 0.075 0.100 0.125 0.150 r = 5, p = 0.5 r = 10, p = 0.3
Negative Binomial Distribution NB(k, r, p) over k for r = 10 and p = 0.3





import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as st

n = 30; p1 = 1/6.0; p2 = 0.5;

lx = np.arange(0,n+1)
plt.plot(lx, st.binom.pmf(lx, n, p1), label='n= 30, p= 1/6 ' )
plt.plot(lx, st.binom.pmf(lx, n, p2), label='n= 30, p= 1/2 ' )
plt.show()

References#