Understanding Fisher's Exact Test
Fisher's exact test assesses whether two binary variables are truly independent or if their relationship is statistically significant. Rather than approximating a distribution (like chi-squared does), Fisher's test calculates the exact probability of observing your data under the null hypothesis of independence.
The test is particularly valuable when:
- Sample sizes are small (fewer than 30 observations)
- One or more cells in your 2×2 table contain fewer than five cases
- Marginal totals are heavily skewed
- You need exact rather than approximate results
Researchers across medicine, epidemiology, and behavioural science rely on it for rare outcomes and finite populations where traditional parametric methods break down.
Fisher's Exact Test Formula
The test calculates the hypergeometric probability of observing a particular 2×2 table given fixed row and column totals. For a contingency table with cells a, b, c, and d, the one-tailed probability follows:
P = [(a+b)! × (c+d)! × (a+c)! × (b+d)!] / [a! × b! × c! × d! × n!]
Odds Ratio = (a × d) / (b × c)
a— Count in first group, first categoryb— Count in first group, second categoryc— Count in second group, first categoryd— Count in second group, second categoryn— Total sample size (a+b+c+d)
One-Tailed vs Two-Tailed Tests
The choice between test directions depends on your research hypothesis:
- One-tailed: Use when you predict a specific direction of association before collecting data. For example, you hypothesise that a treatment reduces adverse events. The p-value includes only probabilities as or more extreme in your predicted direction.
- Two-tailed: Use when testing for any association without a directional prediction. The p-value sums probabilities from both tails of the distribution, making it more conservative and harder to reach significance.
Two-tailed tests are standard in most research unless your hypothesis explicitly states a direction.
Why Fisher Over Chi-Squared?
Although chi-squared is faster to calculate and works well with large samples, it relies on asymptotic approximation. Fisher's test shines when conditions are unfavourable for chi-squared:
- Small samples: Chi-squared can give misleading results with n < 30. Fisher remains reliable regardless of size.
- Cell counts under 5: Chi-squared assumes sufficient expected frequencies in each cell. Fisher makes no such assumption.
- Rare events: When one outcome is uncommon, Fisher's exact calculation beats approximation.
Modern computing makes Fisher feasible even for larger datasets, though chi-squared remains acceptable when assumptions are met.
Practical Considerations and Common Pitfalls
Avoid these mistakes when applying Fisher's exact test to your data.
- Don't ignore assumptions about marginals — Fisher's test conditions on fixed row and column totals. If your study design doesn't fix these totals in advance, the test may not be appropriate. Case-control studies typically fix row totals (numbers in each group), while retrospective studies may fix column totals. Ensure your design matches the test structure.
- Beware of power with small samples — Exact tests are conservative with tiny sample sizes, reducing statistical power. A true effect may fail to reach significance simply due to sample limitations. Report effect sizes (odds ratios, confidence intervals) alongside p-values to capture the practical magnitude.
- Choose your tail direction before analysis — Deciding between one- and two-tailed after seeing your data inflates false positives. Specify your hypothesis in your analysis plan. Two-tailed is the safer default unless you have strong pre-registered reasoning for a one-tailed test.
- Check cell counts and totals — Ensure your 2×2 table totals correctly and contains no negative values. A single data entry error (e.g., entering 5 instead of 50) will distort your result. Always cross-check inputs against your raw data.