PickMyTest

Fisher's Exact Test

Exact test for 2Γ—2 contingency tables with small samples

Fisher's Exact Test#

Fisher's exact test is a statistical test for examining independence in a 2Γ—2 contingency table. Unlike the chi-square test, it calculates the exact p-value and is therefore particularly suitable for small samples where the chi-square approximation is unreliable.

When to Use#

Use Fisher's exact test when you want to:

  • Examine the association between two dichotomous variables
  • You have a 2Γ—2 contingency table
  • The expected frequencies in one or more cells are less than 5
  • The sample is small (typically N<30N < 30)
  • You need an exact p-value without approximation

Assumptions#

  • 2Γ—2 contingency table (two dichotomous variables)
  • Independent observations
  • Fixed marginal totals or random sampling
  • Random assignment of observations

Formula#

The probability of a particular arrangement in the 2Γ—2 table is calculated using the hypergeometric distribution:

p=(a+ba)(c+dc)(Na+c)=(a+b)!β‹…(c+d)!β‹…(a+c)!β‹…(b+d)!N!β‹…a!β‹…b!β‹…c!β‹…d!p = \frac{\binom{a+b}{a} \binom{c+d}{c}}{\binom{N}{a+c}} = \frac{(a+b)! \cdot (c+d)! \cdot (a+c)! \cdot (b+d)!}{N! \cdot a! \cdot b! \cdot c! \cdot d!}

for a table of the form:

Column 1Column 2
Row 1ab
Row 2cd

The p-value is the sum of all probabilities that are equal to or more extreme than the observed distribution.

Example#

Practical Example: Drug Side Effect

A small clinical trial examines whether a drug causes a particular side effect. 20 patients are studied:

Side EffectNo Side EffectTotal
Drug4610
Placebo1910
Total51520

Since the expected frequency for "Placebo/Side Effect" is only 10β‹…520=2.5\frac{10 \cdot 5}{20} = 2.5, the chi-square test is unreliable. Fisher's exact test provides the exact p-value.

Effect Size#

The odds ratio (OR) as effect size:

OR=aβ‹…dbβ‹…cOR = \frac{a \cdot d}{b \cdot c}
InterpretationOdds Ratio
No effect1.0
Small effect1.5
Medium effect2.5
Large effect4.3

Alternatively, Cramer's V or the phi coefficient can be used:

Ο•=adβˆ’bc(a+b)(c+d)(a+c)(b+d)\phi = \frac{ad - bc}{\sqrt{(a+b)(c+d)(a+c)(b+d)}}

Further Reading

  • Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
  • Agresti, A. (2007). An Introduction to Categorical Data Analysis (2nd ed.). Wiley.