Test a 2 × 2 table exactly, without the large-sample approximation of chi-square: two-sided and one-sided p-values, plus the odds ratio.
P(table) = C(a + b, a) × C(c + d, c) ÷ C(n, a + c)
| Outcome yes | Outcome no | |
|---|---|---|
| Group 1 | ||
| Group 2 |
Enter counts, not percentages. Rows are the two groups, columns the two outcomes.
Fisher's exact test checks whether two groups differ in the share with some outcome, using the exact probability of every possible table rather than an approximation. That makes it the right test for small samples.
It treats the row and column totals as fixed and asks: if group made no difference, how likely would a table this lopsided, or more so, be? Those probabilities come straight from the hypergeometric distribution.
It's widely used in medicine and biology, where small trials and rare outcomes leave expected counts too low for a chi-square test.
As introduced by Fisher (1935); the two-sided p sums every table no more likely than the observed one, as in R's fisher.test. See Sources.
Six out of eight sounds impressive, but guessing does that or better almost half the time. Only a perfect 8 out of 8 (p = 1/70 = 0.014 one-sided) would have been convincing.
With 4 milk-first cups among 8, if she were only guessing.
| Milk-first cups found | Ways | Chance |
|---|---|---|
| 0 of 4 | 1 / 70 | 0.0143 |
| 1 of 4 | 16 / 70 | 0.2286 |
| 2 of 4 | 36 / 70 | 0.5143 |
| 3 of 4 | 16 / 70 | 0.2286 |
| 4 of 4 | 1 / 70 | 0.0143 |
For 2 × 2 tables with small counts, especially when any expected count is below 5. It’s valid for large tables too, just slower.
It calculates the p-value directly from the hypergeometric probabilities, with no large-sample approximation.
How much higher group 1’s odds of “yes” are than group 2’s. 1 means no difference; 9 in the tea example means much higher odds.
When b or c is zero, the formula divides by zero. That happens with perfect separation and is shown as ∞.
Slightly. Because counts are whole numbers, the real false-positive rate is often a little below α.
Muriel Bristol, a colleague of Fisher at Rothamsted. He described the experiment in his 1935 book The Design of Experiments.
No for the two-sided p-value. It does matter for which one-sided p and which odds ratio you report.
fisher.test(matrix(c(3, 1, 1, 3), nrow = 2)) gives the same two-sided p-value, 0.4857.
Related Tools