Fisher's Exact Test Calculator

Perform Fisher's exact test on 2×2 contingency tables. Calculate exact p-value, odds ratio, relative risk, and view every possible table in the hypergeometric distribution.

About the Fisher's Exact Test Calculator

Fisher's exact test is the gold standard for testing association in 2×2 contingency tables, especially when sample sizes are small. Unlike the chi-square test, which relies on a large-sample approximation, Fisher's test computes the exact probability of observing the data (or more extreme data) under the null hypothesis of no association.

This calculator lets you enter a 2×2 table directly or choose from preset examples. It computes the exact two-sided, left-tail, and right-tail p-values using the hypergeometric distribution, along with the odds ratio, relative risk, expected frequencies, and a complete enumeration of all possible tables with the same marginal totals.

Fisher's exact test is widely used in biomedical research (clinical trials with small samples), genetics (rare allele associations), ecology (species distribution), quality control (defect counts), and any field where categorical data is analyzed with limited observations. Check the example with realistic values before reporting. Use the steps shown to verify rounding and units. Cross-check this output using a known reference case.

Why Use This Fisher's Exact Test Calculator?

The chi-square test can give misleading p-values when expected cell counts fall below 5. Fisher's exact test avoids this problem entirely by computing exact probabilities from the hypergeometric distribution. This calculator handles all the combinatorial math for you and displays every possible table configuration, letting you see exactly how the p-value is constructed.

How to Use This Calculator

  1. Enter the four cell counts of your 2×2 contingency table (a, b, c, d).
  2. Or click a preset example to load common scenarios.
  3. Choose your alternative hypothesis: two-sided, less, or greater.
  4. Set your significance level alpha (default 0.05).
  5. Review the exact p-value and reject/fail-to-reject decision.
  6. Check the odds ratio and relative risk for effect size.
  7. Examine the probability distribution table to see all possible tables and their probabilities.

Formula

Fisher's Exact Test (Hypergeometric distribution): P(a) = C(a+b, a) × C(c+d, c) / C(n, a+c) = (a+b)! × (c+d)! × (a+c)! × (b+d)! / (n! × a! × b! × c! × d!) Two-sided p-value: Sum of P(table) for all tables as extreme or more extreme than observed Odds Ratio: OR = (a × d) / (b × c) Relative Risk: RR = (a/(a+b)) / (c/(c+d))

Example Calculation

Result: p = 0.0432, OR = 8.0

With a = 10, b = 2, c = 5, d = 8 (n = 25), the two-sided Fisher's exact p-value is 0.0432. The odds ratio of 8.0 indicates that Group 1 has 8 times the odds of a positive outcome compared to Group 2. At α = 0.05, we reject the null hypothesis of no association.

Tips & Best Practices

The Hypergeometric Framework

Fisher's exact test is based on the hypergeometric distribution. Given fixed row and column totals, only one cell value (conventionally a) is free to vary. The test enumerates every possible value of a and its probability, then sums probabilities for tables as extreme or more extreme than observed. This exactness is the test's greatest strength.

Odds Ratio and Relative Risk

While both measure association, they differ in interpretation. The odds ratio (OR = ad/bc) compares odds, while relative risk (RR) compares probabilities. OR is always valid for case-control studies, while RR is appropriate for cohort studies and clinical trials. When the outcome is rare, OR approximates RR — this is the rare disease assumption.

Historical Context and Modern Usage

R. A. Fisher developed this test in the 1920s, famously applied to the "lady tasting tea" experiment. Today it's a standard tool in clinical trials, genetic association studies, and any small-sample categorical analysis. Most statistical software and online tools provide Fisher's exact test alongside chi-square for contingency tables.

Frequently Asked Questions

When should I use Fisher's exact test instead of chi-square?

Use Fisher's exact test when any expected cell frequency is below 5, when the total sample size is small (under 20-30), or when you want exact rather than approximate p-values. For large samples, both tests give similar results.

What does the odds ratio tell me?

The odds ratio compares the odds of an outcome in one group versus another. OR = 1 means no difference. OR > 1 means the outcome is more likely in the first group. OR < 1 means it's less likely. It's the most commonly reported effect size for 2×2 tables.

Why is it called "exact"?

Because it computes the exact probability of observing the data under the null hypothesis, rather than relying on a large-sample approximation (like the chi-square distribution). It enumerates all possible tables with the same marginal totals.

Can I use Fisher's test for larger tables?

Fisher's exact test generalizes to r×c tables, but computation becomes extremely intensive as table size grows. For tables larger than 2×2, chi-square or Monte Carlo simulation is typically used instead.

What is the hypergeometric distribution?

It models the probability of drawing a specific number of successes from a finite population without replacement. In Fisher's test, it gives the probability of each possible 2×2 table given fixed marginal totals.

How do I interpret a non-significant result?

A non-significant Fisher's test (p > α) means you cannot reject the null hypothesis of independence. The data is consistent with no association between the variables, but this doesn't prove independence — you may lack statistical power.

Related Pages