Ask Mallard
Core concept

Choosing a test for a table of counts

5 min read

Choose a table test by whether observations are paired, whether counts support an approximation, and whether an ordered trend is the question.

Fit

When it matters, and when it does not

It matters when

  • You have counts of people in categories and want to compare proportions.
  • You need to distinguish independent groups from repeated binary outcomes.

It matters less when

Before you start

What to check in your study

Decide these first
  1. What one count representsEach person enters one cell in an independent table. Repeated outcomes need their pairing preserved.
  2. Expected counts under the nullAssess expected cell counts, not just the smallest observed cell.
  3. Whether categories have a meaningful orderSpecify scores for a trend test before seeing the results.
It rests on these
  1. The test matches how people were sampled.How to check: Use McNemar for paired binary outcomes. Clustered samples need methods that allow dependence.
  2. A trend test targets a change across ordered scores.How to check: An overall chi-square test can detect patterns that a trend test misses, including a rise followed by a fall.

Plain language

How it works

Interpret the size as well as the test
Two arrays of one hundred people. With a higher baseline risk, twenty of a hundred have the outcome without treatment and ten with it: an absolute reduction of ten in a hundred, a relative reduction of fifty percent, and ten people treated to prevent one. With a lower baseline risk, two of a hundred without treatment and one with it: the same fifty percent relative reduction, but an absolute reduction of one in a hundred and a hundred people treated to prevent one.Higher baseline riskWithout treatment: 20 in 100With treatment: 10 in 100Absolute reduction: 10 in 100Relative reduction: 50%Number needed to treat: 10Lower baseline riskWithout treatment: 2 in 100With treatment: 1 in 100Absolute reduction: 1 in 100Relative reduction: 50%Number needed to treat: 100Dark: has the outcome even with treatment. Shaded: prevented by treatment. Empty: no outcome either way.The relative reduction is identical; what the treatment is worth to one person is not.
Worked arithmetic. The inputs are round illustrative numbers, not results from any study; the outputs are calculated from them.
How it works

Pearson chi-square tests association in an independent table using a large-sample approximation. Sparse expected counts can make that approximation unreliable. Fisher gives conditional exact inference for an independent table, commonly a two-by-two table.

The choice at a glance
Independent table: Adequate expected counts leads to Pearson chi-square; Independent sparse table: Conditional exact question leads to Fisher exact; consider alternatives; Paired binary table: Directions of discordant pairs leads to McNemar; Ordered independent groups: Prespecified scores and binary outcome leads to Cochran-Armitage trend.Independent tableAdequate expected countsPearson chi-squareUse the study question and assumptions together.Independent sparse tableConditional exact questionFisher exact; consider alternativesUse the study question and assumptions together.Paired binary tableDirections of discordant pairsMcNemarUse the study question and assumptions together.Ordered independent groupsPrespecified scores and binary outcomeCochran-Armitage trendUse the study question and assumptions together.
Conceptual diagram. It shows the structure of the idea, not data from any study.
Reading the choice

Fisher can be conservative; exact means a calculation under a specified null model, not freedom from design assumptions. Other exact and mid-p options exist. State the version used.

What decides it

McNemar compares paired binary margins through the discordant pairs. A Cochran-Armitage trend test targets a linear trend in proportions across assigned category scores. It needs independent observations and a binary outcome; it is not an all-purpose test for ordered tables.

Worked example

A worked example

Invented for illustration
Setting
The same patients receive two binary tests.
Question
Does the positive fraction differ between tests?
Approach
There are 12 pairs positive only on test A and 4 positive only on test B.
Result
Of 16 discordant pairs, 12 favor A: 75 in 100. The other 4 favor B.
What it means
McNemar compares the directions within discordant pairs. A Fisher test on an unpaired table would discard the paired design.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

Pairing comes before cell size. Fisher and ordinary chi-square do not replace McNemar for paired binary data.

  • Using Fisher whenever a paired table has small cells.Instead: Keep McNemar and choose an appropriate small-sample version. Name whether it is exact, asymptotic or mid-p.
  • Selecting a trend test because category labels can be numbered.Instead: Use a prespecified, meaningful order. Use an overall test when departures in any direction matter.

Inside Mallard

How Mallard uses this

Mallard lists Choosing a test for a table of counts under Core research concepts.

No Mallard code example points to this page.
Calculators: Chi-square (2×2, Yates) (§2.1), Fisher's exact (2×2) (§2.2).
Atlas node concept.choosing_counts_test, the id a plan cue records.

Work it out

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Recommended tests for association in 2 x 2 tables (opens in a new tab) · Stat Med · doi 10.1002/sim.3531
  2. The McNemar test for binary matched-pairs data: mid-p and asymptotic are better than exact conditional (opens in a new tab) · BMC Med Res Methodol · doi 10.1186/1471-2288-13-91
  3. Differentiating the Cochran-Armitage Trend Test and Pearson's χ2 Test: Location and Dispersion (opens in a new tab) · Ann Hum Genet · doi 10.1111/ahg.12202
Prepared with AI assistance. Source titles, authors, publication years and available DOIs were verified against PubMed on 2026-11-06. No independent professional approval is claimed. Lydersen and colleagues compare independent two-by-two tests, including Fisher and alternatives. Fagerland and colleagues compare McNemar versions. Zhou and colleagues distinguish trend from overall chi-square testing.
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.