s, lw=2)
>>> ax.set_xlabel('# of dogs in our group with given 12 failures')
>>> ax.set_ylabel('nhypergeom PMF')
>>> plt.show()

Instead of using a frozen distribution we can also use `nhypergeom`
methods directly.  To for example obtain the probability mass
function, use:

>>> prb = nhypergeom.pmf(x, M, n, r)

And to generate random numbers:

>>> R = nhypergeom.rvs(M, n, r, size=10)

To verify the relationship between `hypergeom` and `nhypergeom`, use:

>>> from scipy.stats import hypergeom, nhypergeom
>>> M, n, r = 45, 13, 8
>>> k = 6
>>> nhypergeom.pmf(k, M, n, r)
0.06180776620271643
>>> hypergeom.pmf(k, M, n, k+r-1) * (M - n - (r-1)) / (M - (k+r-1))
0.06180776620271644

See Also
--------
hypergeom, binom, nbinom

References
----------
.. [1] Negative Hypergeometric Distribution on Wikipedia
       https://en.wikipedia.org/wiki/Negative_hypergeometric_distribution

.. [2] Negative Hypergeometric Distribution from
       http://www.math.wm.edu/~leemis/chart/UDR/PDFs/Negativehypergeometric.pdf

c