Categorical › Contingency / proportions

Fisher's exact test

Fisher's exact test checks independence in a 2 × 2 (or larger) contingency table using the exact hypergeometric p-value, so no large-sample approximation is needed.

What is Fisher's exact test?

Fisher's exact test enumerates all 2 × 2 tables with the same row and column margins as the observed table, computes each one's hypergeometric probability, and sums those at least as extreme as the observed. The resulting p is exact regardless of sample size, so the chi-square's E ≥ 5 rule doesn't apply.

Always prefer Fisher over chi-square for 2 × 2 tables when any expected cell is < 5. For larger tables Fisher generalises but the computation grows quickly; for r × c tables with sparse cells, the Fisher-Freeman-Halton variant (also computed by R's `fisher.test`) is exact but may take a moment.

Mid-p variants (the conservative 'add half the observed' adjustment) are sometimes preferred over the regular exact p, which can be conservative because the discrete distribution has gaps. For most clinical reporting the standard exact p is fine.

When should I use Fisher's exact test?

  • 2 × 2 tables with any small expected cell (< 5).
  • Tiny samples where the asymptotic χ² approximation isn't trusted.
  • When you need an exact p — e.g. for regulatory submissions.

What data does it need?

Two categorical columns.

What does it report?

Exact p-value, odds ratio + 95% CI (from the conditional MLE), Cramér's V and φ.

What does it assume?

  • Independent observations.
  • Fixed marginals — strictly Fisher's test conditions on both row and column totals; in practice it's used more broadly with little harm.

How do I interpret the result?

For very large samples Fisher's p converges to chi-square's p, but for small samples Fisher is the only one whose calibration you can trust.

The OR from Fisher's exact (conditional MLE) can differ slightly from the unconditional ad/bc OR; both are valid, but pick one and stick with it for reporting.

See also

References

  • Fisher (1922). On the interpretation of χ² from contingency tables, and the calculation of P. JRSS 85(1).