TapCub is live — analytics, insights and live chat, free on one platform
Glossary

Fisher exact test: small conversion tables done right

Fisher's exact test gives a p-value for a small 2×2 table without a large-sample approximation. Compute one by hand, compare it with three chi-square tests, and see how fragile small results are.

Lucas Hayes Reviewed by Chen Yu Also called Fisher exact test Last updated Dec 3, 2026 Glossary

Quick answer

Fisher's exact test is a significance test for a 2×2 table of counts. It uses the hypergeometric distribution, with row and column totals held fixed, to compute an exact p-value, and is used mainly when samples or expected counts are too small for the chi-square approximation.

Formula: P(table) = C(a + b, a) × C(c + d, c) ÷ C(n, a + c); p = sum over tables no more likely than the observed one

What is Fisher's exact test?

Fisher's exact test is a significance test for a 2×2 table of counts, used to ask whether two yes/no variables are associated, for example version (old or new) and outcome (converted or not). Instead of relying on a large-sample approximation, it computes the probability of the observed table, and of other tables, directly from the hypergeometric distribution.

The calculation treats the row totals and column totals as fixed. Given that so many people saw each version, and so many converted overall, it asks how often chance alone would split the conversions as unevenly as they were split. The null hypothesis is that the true odds ratio equals 1, which is how the SciPy documentation states it.

NIST describes it as an excellent choice when the two independent samples are small. It is valid with large samples too; it is just that approximate tests give nearly the same answer there with less computation.

Worked example: a small conversion table

A new onboarding flow, B, is shown to 16 trial accounts and the old flow, A, to 15 (sample data):

FlowUpgradedDid not upgradeTotalUpgrade rate
B (new)6101637.5%
A (old)114156.7%
Total7243122.6%

If flow made no difference, the 7 upgrades would be spread over the two groups like 7 names drawn from 31, of whom 16 saw B. The probability that exactly x of the upgrades land in B is

P(x) = C(16, x) × C(15, 7 − x) ÷ C(31, 7), with C(31, 7) = 2,629,575.

Upgrades in B (x)ProbabilityAs unlikely as the observed table or more?
00.0024Yes
10.0304Yes
20.1370No
30.2907No
40.3149No
50.1744No
6 (observed)0.0457Yes
70.0043Yes

Two-sided p-value: add the probabilities of all tables no more likely than the observed one: 0.0024 + 0.0304 + 0.0457 + 0.0043 ≈ 0.083.

One-sided p-value (only "B is better"): P(6) + P(7) ≈ 0.0500, in fact 0.05003, a hair above 0.05.

A rate that is more than five times higher still does not clear a two-sided 0.05 threshold, because 7 upgrades in total carry little information. Choosing the one-sided figure after seeing that B came out ahead would not rescue it, and would not be a fair test anyway: the direction has to be fixed, with a reason, before any account enters the flow. The sample odds ratio is (6 × 14) ÷ (10 × 1) = 8.4, with a great deal of uncertainty around it.

Fisher's exact test vs chi-square test

The chi-square test compares observed with expected counts and refers the result to a smooth curve. Here the expected counts are small: upgrades expected in B are 16 × 7 ÷ 31 = 3.61 and in A 15 × 7 ÷ 31 = 3.39. Both are below 5, the traditional point at which the approximation is questioned. The same table gives:

TestStatisticTwo-sided pVerdict at 0.05
Pearson chi-square4.210.040Passes
N−1 chi-square4.070.044Passes
Chi-square with Yates' correction2.630.105Does not pass
Fisher's exact testnone needed0.083Does not pass

One table, four tests, and two different verdicts. That is a warning about the data more than about the formulas.

Which to use? The textbook rule is chi-square when every expected count is at least 5, otherwise Fisher. Ian Campbell's 2007 simulation study of small 2×2 tables repeats Cochran's own remark that the number 5 was chosen arbitrarily, and found the best policy to be the N−1 chi-square test whenever the smallest expected count is at least 1, with the Fisher-Irwin test below that. Fisher's test tends to be conservative: its true false-alarm rate is usually below the nominal 5%. Both positions are defensible. Decide which test you will use before seeing the results, and write it down.

How fragile a small result is

Move one outcome and look again. If one more B account had upgraded (7 of 16 against 1 of 15), Fisher's two-sided p-value would fall from 0.083 to about 0.037.

A conclusion that flips with one customer is not ready to act on. Practical responses:

  1. Report the counts, not only the percentages: "6 of 16 against 1 of 15".
  2. Show an interval for each rate or for the difference.
  3. Keep collecting until a sample size chosen in advance is reached; see sample size and statistical power.
  4. Do not peek daily and stop at the first p below 0.05.

When to use it and when not

SituationChoice
2×2 table, some expected count below 5Fisher's exact test (or N−1 chi-square, chosen in advance)
2×2 table, large countsChi-square or two-proportion z test
Same people measured twice, yes/noMcNemar's test
More than two groups or outcomesChi-square, or an exact extension in statistical software
Revenue or time instead of yes/noA test for numeric data, not a 2×2 table

Conditions still apply. Each account must appear in one cell only, and accounts must be independent. Ten users from the same company who upgrade together are closer to one observation than to ten. And without random assignment, a small p-value describes an association, not an effect of the flow. The full decision table is in which statistical test.

If you run Fisher's test on many segments, adjust the threshold; see the Bonferroni correction example.

Running it, with counts from TapCub

In software it is one line: scipy.stats.fisher_exact([[6, 10], [1, 14]]) in Python, or fisher.test in R. Note that different packages report the odds ratio estimated in different ways; SciPy's documentation says its estimate differs from R's.

TapCub does not run A/B tests or compute this test. It can provide the four counts:

  1. Tag the flow. Send the assigned flow as an event property on the trial and upgrade events, from your own assignment logic.
  2. Count people. In All-platform analytics › Behavior › Event analysis, take unique people for the trial event and the upgrade event and break them down by the flow property. "Did not upgrade" is trials minus upgrades.
  3. Check identity. The default identity is visitor; for account flows switch to the identity that matches your randomization unit, so one customer is not counted twice.
  4. Treat chat comparisons with care. Live chat › Reports › Conversion attribution warns when fewer than 30 visitors chatted. A Fisher test on such counts can describe the gap, but visitors chose whether to chat, so it cannot show that chat caused it.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Lucas Hayes

Data Engineer

Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

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

The usual rule is to use it when any expected count in a 2×2 table is below 5. Some research favors the N−1 chi-square test when the smallest expected count is at least 1. Either is defensible if you choose it before looking at the results.

How is the two-sided p-value calculated?

With the margins fixed, compute the probability of every possible table. Add the probabilities of all tables that are as likely as or less likely than the observed one. In the sample here that sum is about 0.083, while the one-sided value is about 0.050.

Can Fisher's exact test be used for large samples?

Yes, it remains valid. With large counts it gives practically the same conclusion as the chi-square or two-proportion z test, which are cheaper to compute. It tends to be somewhat conservative, meaning its false-alarm rate sits below the nominal level.

Does a significant result mean the new version caused the change?

Only if people were randomly assigned to the versions and the plan was fixed in advance. Otherwise the test shows an association in the table. Differences in who saw each version could produce it just as well.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics