What Fisher’s exact test does
Fisher’s exact test compares two proportions in a 2 × 2 table, such as the success rate of a treatment against a control, without relying on the large-sample approximation behind the chi-square test. It computes the exact probability of every table with the same row and column totals as yours, using the hypergeometric distribution, and adds up those that are at least as extreme. It is the test of choice when some expected counts are below 5.
How the p-value is computed
With the table
| Outcome | No outcome | |
|---|---|---|
| Group 1 | a | b |
| Group 2 | c | d |
and all margins fixed, the probability of a given value of a is
P(a) = C(a + b, a) × C(c + d, c) ÷ C(n, a + c)
- Two-sided p-value: sum of the probabilities of all tables that are no more likely than the observed one.
- One-sided p-value: sum over the tables at least as extreme in the chosen direction.
The calculator enumerates every possible table exactly, which is fast even for totals in the thousands.
Example
8 of 10 patients improve with a new treatment, against 3 of 10 with the standard one:
- proportions: 80% and 30%;
- odds ratio: (8 × 7) ÷ (2 × 3) ≈ 9.3; risk ratio ≈ 2.67;
- exact two-sided p ≈ 0.070: not significant at α = 0.05;
- the uncorrected chi-square test would give p ≈ 0.025 and suggest significance. With expected counts of 5.5 and 4.5, that approximation is unreliable here.
The example shows why Fisher’s test matters: with small samples, the chi-square approximation can overstate the evidence.
When to use it
- Small samples, or any expected cell count below 5.
- Rare outcomes, such as adverse events in a trial.
- Whenever an exact answer is preferred; modern software makes it practical for large tables too.
Points to keep in mind
- Fisher’s test is conservative: because the margins are fixed, its actual false-positive rate is often below α. Some statisticians prefer Barnard’s or Boschloo’s tests, which are more powerful.
- The two-sided p-value is not simply twice the one-sided one; this calculator uses the standard method of summing tables with probability no greater than the observed one.
- The sample odds ratio shown is the simple (a × d) ÷ (b × c). It is infinite when b or c is zero; software then reports a conditional maximum likelihood estimate instead.
- For tables larger than 2 × 2, the Fisher–Freeman–Halton extension applies the same idea.