How this calculation works
Evaluate Fisher’s noncentral hypergeometric distribution for two item types with unequal selection odds and a fixed selected total.
P(X=k)=C(n,k)C(M−n,N−k)ω^k / Σ_j C(n,j)C(M−n,N−j)ω^j.A worked example
For M=10, n=4, N=3 and odds=2, support counts 0–3 have unnormalized weights 20, 120, 144 and 32. Their sum is 316, so P(X=2)=144/316=36/79≈0.455696203.
Good to know
Integer population M≤100000, feasible support at most 5000, valid type count and selected total, odds 1e−6–1e6. Log-normalized Fisher conditional model. No sequential Wallenius substitution or general-purpose noncentral hypergeometric ambiguity.
Reference: SciPy: Fisher noncentral hypergeometric distribution (opens in a new tab) ↗
Fix the selected total under unequal odds
The Fisher noncentral hypergeometric model describes the composition of a selected set when selection odds differ between two item types and the selected total is conditioned upon. The count X records how many selected items are Type I. Its support is limited by both the available Type I items and the available Type II items.
This is not the same distribution as sequentially drawing one item at a time with continuously reweighted remaining counts. That sequential mechanism leads to Wallenius’ noncentral hypergeometric model. Both use an odds parameter and sampling without replacement, so naming Fisher’s convention is essential when comparing an answer with another program or an application’s mechanism.
Compare this with the Multivariate hypergeometric probability calculator for several colors. Model conditional biased selection with fixed margins and an odds weight, rather than uniform sampling without replacement.
Keep the population symbols straight
Enter total population M, Type I population n and total selected N as nonnegative integers subject to the displayed bounds. The remaining M−n items are Type II. The requested Type I count must be an integer. Positive odds favor Type I when above one and favor Type II when below one under this conditional model.
The possible Type I count begins at max(0, N−(M−n)) and ends at min(n,N). A selected total larger than the population is invalid rather than a request for replacement sampling. The browser calculation additionally caps the number of support values, because the full normalized PMF and moments are evaluated across that support.
Compute relative weights before probabilities
For each feasible count k, choose k Type I items and N−k Type II items, then multiply by the odds raised to k. These are unnormalized weights. Dividing one weight by the sum over all feasible counts produces its probability. The normalization changes with the odds, so simply multiplying an ordinary hypergeometric probability by odds to a power is incomplete.
Large combinations can overflow if evaluated as integers and converted directly. The implementation uses logarithmic combination weights, subtracts a common log scale and then normalizes. That scaling cancels mathematically. It keeps the numerical calculation stable while preserving the relative weights used by the stated distribution, within floating-point evaluation limits.
Use the ordinary case as a benchmark
When odds equals one, the additional odds factor is one for every count. The normalized model reduces to the ordinary hypergeometric distribution. Its mean is then N times n divided by M when M is positive. This boundary between ordinary and noncentral models provides a direct check that the parameter convention has not been reversed.
Swapping Type I and Type II changes X to N−X and replaces the odds by its reciprocal. A result should transform consistently under that swap. These checks are stronger than looking only at whether a probability lies between zero and one, because an incorrectly interpreted odds parameter can still produce an apparently plausible normalized distribution.
Normalize the default’s four weights
The default population contains four Type I and six Type II items, with three selected. At odds two, the weights for counts zero, one, two and three are twenty, one hundred twenty, one hundred forty-four and thirty-two. They add to three hundred sixteen, so the probability of exactly two Type I items is 36/79.
The default probability is approximately 0.455696203. The count-two weight is the largest, but the expected count is not automatically two: it is the weighted sum over all four support values. Likewise, the cumulative probability through two includes counts zero and one as well. Reading the requested event alongside the PMF prevents a mode from being mistaken for a mean.
Interpret extreme odds and deterministic supports
Large positive odds push probability toward larger Type I counts, while small positive odds favor smaller ones. The supported odds range avoids an unbounded parameter input while still allowing substantial imbalance. If the feasible support contains one count, the result is deterministic regardless of positive odds; normalization should return probability one there.
An extreme odds value does not allow selecting more Type I items than exist or violating the fixed selected total. The combinatorial support constraints remain in force. Very small probability entries may be affected by floating underflow, so the output’s normalization and moments are more useful diagnostics than demanding visible decimal digits for every remote tail mass.
Match the model to the selection process
The inputs are mathematical population sizes and a supplied odds ratio. The calculator does not estimate that odds ratio from an observed table or attach a confidence interval to it. A conditional probability model can be useful for such inference, but fitting and uncertainty are separate operations that require an explicit inferential procedure.
Use this page when Fisher’s conditional mechanism is intended, including a direct comparison with the documented Fisher distribution. Use the ordinary hypergeometric model when selection is unbiased. If the real process sequentially samples with changing weights, choose a Wallenius calculation rather than assuming that the word noncentral uniquely determines the probability model.
A few questions, answered
What happens when odds is one?
The distribution reduces to the ordinary hypergeometric distribution.
Is this Wallenius’ distribution?
No. Fisher’s conditional distribution and Wallenius’ sequential biased drawing generally differ.
Why must weights be normalized?
Combinations times odds powers are relative weights; their sum is not generally one.
What does Type I count mean?
It is the number of selected items from the population’s n Type I items, out of N selected in total.