Fisher's Exact Test

Verified

Categorical

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.

Loading teaching datasets…

Or use your own dataset

Loading your datasets…

Always-exact test of independence for 2×2 or small r×c contingency tables.

Conditions on both marginal totals and enumerates the hypergeometric probability of every table at least as extreme as the observed under the null of independence. Reports the exact two-sided p, plus the exact odds ratio with 95% CI (mid-p or conditional ML). The small-sample-safe replacement for χ² when Cochran's expected-count rule is violated; computationally heavy for large tables (Monte-Carlo Fisher is the workaround for r × c > 2 × 5).

Worked example

Is a rare side-effect linked to the drug when the cell counts are tiny?

40 patients cross-classified by drug (yes/no) and side-effect (yes/no). As expected counts fell below 5, Fisher's exact test replaces chi-square.

Result

The side-effect was more common on the drug (8/20 vs 1/20), Fisher's exact p = .02.

How you'd report it (APA)

Fisher's exact test showed the side-effect was significantly more frequent on the drug (8/20 vs 1/20), p = .02.

Try it yourself: Load this ready-made sample and follow the run above.

When to use it

  • Small-sample 2×2 (exposure × outcome)
    A case-control study with 20 cases and 25 controls assesses a rare exposure (exposed n = 8).
  • Rare-event study with sparse cells
    Drug safety surveillance: 300 treated patients (3 adverse events) vs 300 control (1 adverse event).

When NOT to — use instead

Hypotheses

H₀: the two categorical variables are independent (equivalently, OR = 1 in the 2×2 case).
Hₐ: the two variables are associated (OR ≠ 1 for 2×2).

Parameter tested: odds ratio (2×2) or joint distribution (r × c)

Assumptions (and what to do if they fail)

Table is 2×2 (exact hypergeometric form) or a small r × c (Monte-Carlo / network-algorithm exact).low

Check: Report r, c, and N.

If violated: Very large r × c tables are computationally expensive for the exact form.

Fisher's exact conditions on BOTH marginal totals. This is a modelling assumption — debated under designs where only one set of marginals is fixed.low

Check: Under multinomial sampling, both marginals are random — but Fisher's conditioning is still valid and conservative.

If violated: Conservative conditioning does not invalidate the p-value; it may reduce power.

Ready to run a Fisher's Exact Test on your own data?

Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.

Run this test →