# Fisher’s Noncentral Hypergeometric Distribution

A random variable has Fisher’s Noncentral Hypergeometric distribution with parameters

\(M \in {\mathbb N}\), \(n \in [0, M]\), \(N \in [0, M]\), \(\omega > 0\),

if its probability mass function is given by

\[p(x; M, n, N, \omega) = \frac{\binom{n}{x}\binom{M - n}{N-x}\omega^x}{P_0},\]

for \(x \in [x_l, x_u]\), where \(x_l = \max(0, N - (M - n))\), \(x_u = \min(N, n)\),

\[P_k = \sum_{y=x_l}^{x_u} \binom{n}{y} \binom{M - n}{N-y} \omega^y y^k,\]

and the binomial coefficients are

\[\binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.\]

Other functions of this distribution are

\begin{eqnarray*} \mu & = & \frac{P_0}{P_1},\\ \mu_{2} & = & \frac{P_2}{P_0} - \left(\frac{P_1}{P_0}\right)^2,\\ \end{eqnarray*}

## References

- Agner Fog, “Biased Urn Theory”, https://cran.r-project.org/web/packages/BiasedUrn/vignettes/UrnTheory.pdf

- “Fisher’s noncentral hypergeometric distribution”, Wikipedia, https://en.wikipedia.org/wiki/Fisher’s_noncentral_hypergeometric_distribution

Implementation: `scipy.stats.nchypergeom_fisher`