Fisher's Exact Test
Understand the gold-standard statistical test for analyzing small-sample categorical data in \(2 \times 2\) contingency tables: when to use it, how it works, and why it matters.
What is Categorical Data?
In biostatistics, we often measure outcomes that fall into distinct categories rather than continuous numbers. For example: Did the patient recover? (Yes / No). Was the gene expressed? (Present / Absent).
The \(2 \times 2\) Contingency Table
A \(2 \times 2\) table cross-tabulates two binary variables. Each cell holds a count of observations. The row and column totals are called marginal totals.
Why is it Called "Exact"?
Most statistical tests (like the \(\chi^2\) test) use approximations that assume large sample sizes. Fisher's Exact Test computes the exact probability of observing the data, making it valid for any sample size, especially small ones.
The Hypergeometric Formula
Fisher's Exact Test calculates the probability of observing a particular table configuration using the hypergeometric distribution. Given fixed marginal totals, the probability of cell \(a\) taking a specific value is:
Breaking Down the Formula
Fisher's Test vs. \(\chi^2\)
| Feature | Fisher's Exact | \(\chi^2\) Test |
|---|---|---|
| Calculation | Exact combinatorial | Asymptotic approximation |
| Sample size | Any size (even tiny) | Needs expected counts > 5 |
| Table size | Best for \(2 \times 2\) | Any \(r \times c\) |
| Computation | Factorial-based | \(\chi^2\) statistic |
| Null hypothesis | No association between row and column variables | |
How to Apply Fisher's Exact Test
Example: Drug Trial
A small pilot study tests whether a new drug reduces infection. 12 patients are randomized: 5 receive the drug, 7 receive a placebo.
Computing the Exact Probability
While the factorial formula is correct, it's much easier to calculate using the binomial coefficient form:
Finding More Extreme Tables
Keeping the marginals fixed (row totals 5, 7 and column totals 6, 6), we enumerate all possible tables by varying \(a\). The table is "more extreme" if it shows an even stronger drug effect (higher \(a\)).
Example 2: A Significant Result
A researcher studies whether a gene mutation is associated with a disease. With only 14 subjects:
One-Tailed vs. Two-Tailed Tests
Visualizing the \(p\)-value
For fixed marginals, there are only a few possible tables. The \(p\)-value sums the probabilities of tables as extreme or more extreme than observed. Below is a probability distribution for all possible values of cell \(a\) in Example 2 (marginals: 7, 7, 7, 7, \(n=14\)):
Common Mistakes
Question 1 of 5
When is Fisher's Exact Test preferred over the \(\chi^2\) test?
Question 2 of 5
In the hypergeometric formula for Fisher's test, what does the denominator \(\binom{n}{a+c}\) represent?
Question 3 of 5
Given a \(2 \times 2\) table with cells \(a = 3\), \(b = 1\), \(c = 1\), \(d = 5\), what is the total sample size \(n\)?
Question 4 of 5
What are the marginal totals in a contingency table?
Question 5 of 5
A Fisher's Exact Test returns \(p = 0.032\). At significance level \(\alpha = 0.05\), what is the correct conclusion?