Ask Mallard
Analysis method

Fisher’s exact test

4 min read

Fisher’s exact test checks association in a 2×2 table by comparing tables with the same margins.

Fit

When to use it, and when not to

Use it when

  • Two independent groups have a binary outcome, especially when expected cell counts are small.
  • You want conditional inference, with the two-sided definition stated explicitly.

Not when

Before you start

What you need

Decide these first
  1. Four nonnegative integer cell countsUse one row per group and one column per outcome category.
  2. The planned direction and two-sided conventionMallard sums probabilities of tables no more probable than the observed table.
  3. The effect measure and interval you will reportA test result alone does not give the size or precision of the association.
It rests on these
  1. Different people contribute independent observations.How to check: Do not enter paired measurements as separate independent groups.
  2. Inference conditions on the observed row and column totals.How to check: Decide whether this conditional question fits the sampling design and analysis plan.

Plain language

How it works

Keep both row totals and both column totals fixed. Enumerate the possible 2×2 tables. Under no association, each table has a hypergeometric probability. Sum the probabilities of tables no more likely than the observed one for Mallard’s two-sided result.

What the sources show

Lydersen and colleagues compared conditional and alternative tests. Their work explains why exact conditional inference can be conservative and less powerful. It does not justify treating Fisher’s test as a universal upgrade.

The method at a glance
Fisher’s exact test: Independent 2 by 2 counts. Then Tables with the observed margins. Then Probability-ordered exact p-value.Fisher’s exact testIndependent 2 by 2 countsTables with the observedmarginsProbability-ordered exactp-value
Conceptual diagram. It shows the structure of the idea, not data from any study.

Worked example

A worked example

Invented for illustration
Setting
Two independent groups each have 20 patients.
Question
Is the binary outcome associated with group?
Approach
Group 1 counts: 2 positive, 18 negative. Group 2 counts: 8 positive, 12 negative.
Result
The two-sided exact p = 0.065. The sample cross-product odds ratio is 0.17; the observed risks are 10 in 100 and 40 in 100.
What it means
The result does not establish equal risks. The displayed odds ratio is the sample cross-product ratio, not a conditional maximum-likelihood estimate.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

Fisher’s exactness is conditional on the table margins. Its discreteness can make it conservative. Paired observations need a paired method.

  • Doubling a one-sided p-value without naming the convention.Instead: Different two-sided definitions can give different values. State the method used.
  • Assuming exact means most powerful or unbiased.Instead: Conditioning and discrete counts can make Fisher’s test conservative. Choose the test for the design.

Inside Mallard

How Mallard uses this

Mallard links this article to its Fisher calculator. It reports a probability-ordered two-sided p-value and sample cross-product odds ratio. The method registry links this method to its published analysis article and code.

Code example in Mallard: Fisher's exact test with the conditional odds ratio (fisher-exact-conditional-odds-ratio).
Sample size: Mallard sizes the main comparison with two proportions. It does not size adjustment or any secondary analysis.
Calculators: Fisher's exact (2×2) (§2.2).
Atlas node analysis.fisher_exact, the id a plan cue records.
Code for this method
Loading…

Work it out

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Power comparison of two-sided exact tests for association in 2 x 2 contingency tables using standard, mid p and randomized test versions (opens in a new tab) · Stat Med · doi 10.1002/sim.1671
  2. Recommended tests for association in 2 x 2 tables (opens in a new tab) · Stat Med · doi 10.1002/sim.3531
Prepared with AI assistance. Source records verified by PMID, title, authors, year and DOI on 2026-11-06. No independent professional approval is claimed. The two primary method-comparison studies support the conditional definition and power cautions. They discuss alternatives without making those alternatives outputs of Mallard’s calculator.
Last source review: 2026-11-06
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.