SOLVETUTORMATH SOLVER

Instrument MI-07-075 · Statistics

Fisher's Exact Test Calculator

Small sample, categorical outcomes, a 2×2 table of counts — Fisher's exact test computes the precise probability of that exact table arising by chance, without leaning on any large-sample approximation.

Instrument MI-07-075
Sheet 1 OF 1
Rev A
Verified
Type 07 — Hypothesis Testing SER. 2026-07075

Exact probability of this specific table (hypergeometric)

0.2285714286

P = C(a+b,a) x C(c+d,c) / C(a+b+c+d,a+c)

The working Every figure verified twice
  1. pTable = comb(3 + 1, 3)·comb(1 + 3, 1) ⁄ comb(3 + 1 + 1 + 3, 3 + 1) = 0.2285714286
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Fisher's exact test answers a narrow but precise question: given the row totals and column totals of a 2×2 table of counts are fixed, what is the exact probability of observing this particular arrangement of the four cells? Unlike a chi-square test, which approximates its p-value using a continuous distribution and works best with reasonably large cell counts, Fisher's exact test computes the true probability directly from the hypergeometric distribution — the same distribution that describes drawing colored balls from a box without replacement — making it reliable even with the small samples where chi-square approximations break down.

The formula treats the table's margins (row and column totals) as fixed and asks how likely this specific split of the interior four cells is among all splits consistent with those margins: P = C(a+b, a) × C(c+d, c) / C(a+b+c+d, a+c), where each C(n, k) is a combinations count. A very low probability for the observed table (relative to more balanced alternatives) suggests the two categorical variables in the table — treatment and outcome, say — are associated rather than independent.

This instrument reports the exact probability of the specific table you enter, not a full two-sided p-value. A complete significance test sums this probability across every table at least as extreme as the observed one, given the same margins — a summation step that's out of scope here, matching this site's practice elsewhere of reporting the underlying test statistic (as with its chi-square, z-test, and t-test calculators) rather than a pre-summed p-value. The single-table probability this calculator returns is still the exact building block that a full Fisher's exact p-value is constructed from.

P=(a+ba)(c+dc)(a+b+c+da+c)P = \frac{\binom{a+b}{a}\binom{c+d}{c}}{\binom{a+b+c+d}{a+c}}
a, b, c, d — the four cell counts of the 2×2 table (a, b in row 1; c, d in row 2) · C(n, k) — the number of ways to choose k items from n, n! / (k!(n−k)!) · P — the exact hypergeometric probability of this specific table given its row and column totals held fixed.
  • Enter the four table counts into Cell a, Cell b, Cell c, and Cell d, matching your 2×2 layout (row 1: a, b; row 2: c, d).
  • Read Exact probability of this specific table beneath — the hypergeometric probability of exactly this cell arrangement.
  • A small probability relative to other tables sharing the same margins hints at an association between the row and column categories.
  • This is the probability of the one table you entered, not a summed two-sided p-value across all more-extreme tables.
  • Fisher's exact test is most useful precisely when your counts are small — the situation where chi-square's large-sample approximation is least trustworthy.

Worked example — an 8-person trial, treatment vs outcome

A small trial enrolls 8 people, 4 given a new treatment and 4 given a placebo, and records whether each person improved. Of the 4 treated, 3 improved and 1 did not; of the 4 on placebo, 1 improved and 3 did not. Enter a=3, b=1, c=1, d=3. Row totals are 4 and 4; column totals (a+c and b+d) are also 4 and 4; the grand total N is 8.

Exact probability of this specific table reads P = C(4,3)×C(4,1)/C(8,4) = 4×4/70 = 16/70 = 8/35 ≈ 0.2286. That's the exact chance of seeing precisely a 3-1/1-3 split of improvement between the two groups, purely by chance, given that 4 of the 8 people improved overall and 4 were on each treatment. A full two-sided significance test would additionally sum this probability with every more extreme 3-4-4-4-margin table's probability — a separate step this calculator's single-table figure feeds into but does not perform.

Questions

How does Fisher's exact test differ from a chi-square test?

A chi-square test compares observed counts to expected counts and refers the result to a chi-square distribution, which is an approximation that works well with reasonably large cell counts but becomes unreliable when any cell is small (commonly cited as an issue below 5 expected observations per cell). Fisher's exact test instead computes the true hypergeometric probability directly, with no approximation involved, which is why it's the preferred choice for small 2×2 tables even though it's more computationally involved.

Why are the row and column totals treated as fixed?

Fisher's exact test conditions on the observed margins — it asks 'given that these row and column totals are exactly what they are, how likely is this particular split of the interior cells, compared to every other split that keeps the same margins?' This is a modeling choice, not a claim that the margins couldn't have come out differently; it's what makes the exact hypergeometric probability calculation tractable, and it's the standard, widely accepted framing for this test.

Does this calculator give me a p-value?

It gives you the exact probability of the one table you entered — a necessary ingredient of a p-value, but not the complete p-value itself. A full two-sided Fisher's exact p-value sums this single-table probability together with the probabilities of every other table sharing the same margins that is at least as extreme (as unlikely or more) than the one observed. That summation is outside this calculator's scope; it reports the exact single-table figure the full calculation is built from.

When should I use Fisher's exact test instead of a z-test for proportions?

Fisher's exact test is the right tool specifically for small, categorical 2×2 count data — a handful of successes and failures split across two groups — where the sample sizes are too small for the normal-approximation methods a proportion z-test relies on to be trustworthy. With larger samples, both methods tend to agree closely, and a z-test or chi-square test is usually simpler to compute by hand.

What does a very small probability for my table actually tell me?

It means the specific split of outcomes you observed is unusual compared to the range of splits that would occur if the row and column variables were completely unrelated, given the same margins. On its own, one table's low probability is suggestive rather than conclusive — a full significance decision needs the summed two-sided p-value compared against a chosen significance threshold, not the single-table probability alone.

References