Concept Architecture
Contingency Table for Trial and Diagnostic Accuracy Data
The 2x2 contingency table is the basic data unit of evidence synthesis for binary outcomes. A trial table crossing treatment arm with event or no event yields the risk ratio, odds ratio and risk difference, and a diagnostic table crossing test result with disease status yields sensitivity and specificity. In health technology assessment these four counts per study are what reviewers extract for meta-analysis and what modellers turn into branch probabilities, so a wrong denominator or a mishandled zero cell passes straight into the cost-effectiveness result.
Rows, columns and margins of a 2x2 table
Each observation is counted once, where its row and column categories meet. The row and column totals, called the margins, give the group sizes and the overall number with each outcome. Chapter 6 of the Cochrane Handbook lays out a two-group trial with a dichotomous outcome this way.
| Event | No event | Total | |
|---|---|---|---|
| Experimental | |||
| Comparator | |||
| Total |
The layout extends to an table with row and column categories, such as three arms by four response levels, and to stacked tables, one per stratum or study. Both variables must be categorical data, so a continuous measure has to be cut into categories before it can be tabulated.
Effect measures read from a trial table
Reading across the rows gives the risk in each arm, and . Every standard effect measure for a binary outcome comes from these four counts.
where is the risk ratio, the odds ratio and the risk difference of the experimental against the comparator group. RevMan, Cochrane's review software, documents the standard errors on the log scale for the ratios.
where and are the standard errors of the natural logarithms of the risk ratio and odds ratio. The reciprocal of the absolute risk difference is the number needed to treat.
The diagnostic accuracy table
A test accuracy study crosses the index test result with the true condition as judged by the reference standard. The four cells are true positives (TP), false positives (FP), false negatives (FN) and true negatives (TN). Šimundić describes the first step in calculating sensitivity and specificity as building this 2x2 table, with the reference standard in the columns and the test categories in the rows.
where is sensitivity, specificity, the positive predictive value and the negative predictive value. Sensitivity and specificity are computed down the columns, within the diseased and non-diseased groups, so prevalence does not enter their calculation, although Šimundić notes they can vary greatly with the spectrum of disease. Predictive values are computed across the rows and change with prevalence, so Šimundić advises against carrying them to another setting. The diagnostic odds ratio is the odds ratio of the same table. Reviews of diagnostic accuracy pool these tables across studies, often summarised by a summary ROC curve.
Testing independence with chi-squared and Fisher exact tests
The usual null hypothesis is that the row and column classifications are independent. Each cell's expected count is then fixed by the margins alone.
where is the expected count in row and column , and are the row and column totals, is the grand total, is the observed count and is the Pearson chi-squared statistic. It is compared with the chi-square distribution on degrees of freedom, which is one for a 2x2 table.
The chi-squared test relies on a large-sample approximation. Kim's statistical note gives the usual rule that the result is relevant only when no more than 20% of cells have expected frequencies below 5 and no cell has an expected frequency below 1, and recommends Fisher's exact test otherwise. Fisher's exact test conditions on the margins and uses the hypergeometric distribution of the cell counts, so it is valid at any sample size. A small p-value from either test says the classifications are associated, but it gives no size or direction of effect, which is why HTA uses the effect measures above with their confidence intervals.
Worked example with a trial table, a zero cell and a diagnostic table
All numbers in this example are illustrative. The three tables show its main uses in an assessment.
1. A trial table. A trial randomises 200 patients to a new drug and 200 to the comparator, and 30 and 50 relapse within a year.
| Relapsed | No relapse | Total | |
|---|---|---|---|
| New drug | 30 | 170 | 200 |
| Comparator | 50 | 150 | 200 |
| Total | 80 | 320 | 400 |
The risks are 30 / 200 = 0.15 and 50 / 200 = 0.25. The risk ratio is 0.15 / 0.25 = 0.60, with and a 95% confidence interval of 0.40 to 0.90. The odds ratio is (30 x 150) / (170 x 50), or 4,500 / 8,500, which is 0.53, with an interval of 0.32 to 0.88. The risk difference is -0.10, so 10 patients need the drug to avoid one relapse.
2. The test of independence. Every expected count follows from the margins, 200 x 80 / 400 = 40 relapses and 200 x 320 / 400 = 160 without relapse in each arm.
where 6.25 on one degree of freedom gives a p-value of 0.012. Fisher's exact test gives a two-sided p-value of 0.017.
3. A sparse safety table. A second trial reports a rare adverse event in 0 of 40 patients on the drug and 3 of 40 on the comparator. The risk difference is -0.075, but the risk ratio and odds ratio are both zero, with no standard error on the log scale, because the drug arm has no events. Adding 0.5 to every cell gives a risk ratio of (0.5 / 41) / (3.5 / 41) = 0.143 and an odds ratio of (0.5 x 37.5) / (40.5 x 3.5), or 18.75 / 141.75, which is 0.132, figures that rest heavily on the added 0.5. The expected event counts are 40 x 3 / 80 = 1.5 in both arms, so half the cells fall below 5 and Fisher's exact test applies, with a two-sided p-value of 0.24.
4. A diagnostic table. A test with sensitivity 0.90 and specificity 0.85 is used in 1,000 people with a prevalence of 10%, so 100 have the condition.
| Condition present | Condition absent | Total | |
|---|---|---|---|
| Test positive | 90 (TP) | 135 (FP) | 225 |
| Test negative | 10 (FN) | 765 (TN) | 775 |
| Total | 100 | 900 | 1,000 |
The positive predictive value is 90 / 225 = 0.40 and the negative predictive value is 765 / 775 = 0.987. The diagnostic odds ratio is (90 x 765) / (135 x 10) = 51. At a prevalence of 2% the same test gives 18 true positives and 147 false positives, and the positive predictive value falls to 18 / 165 = 0.109.
5. Interpretation. The trial table supplies a relative effect with its uncertainty, and the sparse table shows how much a zero cell can drive a ratio. In a decision tree the diagnostic table fixes the four pathway probabilities, 0.09, 0.135, 0.01 and 0.765. Rebuilding the table at the decision population's prevalence matters, since at 2% nearly nine in ten positive results are false.
Extracting tables for meta-analysis and decision models
Data extraction for a binary outcome means filling a 2x2 table for each study. Chapter 6 of the Cochrane Handbook prefers the number of participants actually observed over the randomised total, because it avoids assumptions about anyone whose outcome was not measured, and warns that counts back-calculated from rounded percentages can fit more than one numerator.
Combined trials keep separate tables. Chapter 15 of the Cochrane Handbook warns that adding all the counts into one table ignores randomisation within studies and can seriously mislead when randomisation is unbalanced. The pooled association can even reverse direction, the Simpson paradox, so stratified methods such as the Mantel-Haenszel method pool the study tables while keeping each comparison inside its own trial. For diagnostic tests, Hamza and colleagues found that modelling each study's counts with the exact binomial likelihood always performed better than approximating them with a normal distribution, which gave large bias in many simulated settings.
The NICE manual (PMG36, section 4.6.14) calls for a linked-evidence modelling approach when direct evidence of a diagnostic technology's effect on final outcomes is not available, specifying links between diagnosis, treatment and final outcomes. Pooled sensitivity and specificity supply the first link, with prevalence taken from the population being assessed. For treatments, section 4.6.16 describes applying relative effects from randomised trials to the baseline risk of the population of interest, which is how a pooled ratio from many 2x2 tables becomes a transition probability in a Markov model.
Zero cells and sparse tables
Chapter 6 of the Cochrane Handbook explains that neither the risk ratio nor the odds ratio can be calculated when the comparator group has no events, and that the odds ratio also fails if everyone in the intervention group has the event. In these situations, and whenever a zero cell stops a standard error being computed, it is customary to add 0.5 to each cell, as RevMan does automatically. The risk difference can be calculated for any study, even with no events in either group.
Chapter 10 warns that the fixed correction usually biases study estimates towards no difference, overestimates their variances, and introduces a directional bias when arm sizes are unequal. Standard practice is to exclude studies with no events in both arms from meta-analyses of odds ratios and risk ratios, because they give no indication of the direction or size of the relative effect. The chapter also reports that Sweeting and colleagues found a correction proportional to the reciprocal of the size of the contrasting arm preferable to the fixed 0.5 when arm sizes were unbalanced. A ratio that feeds a model from sparse tables can therefore reflect the arithmetic of the correction as much as the data.
Contingency tables compared with nearby ideas
The contingency table is a descriptive summary, the cross-classified counterpart of a frequency table for one variable. Logistic regression models the same binary outcome while adjusting for covariates, and reduces to the 2x2 odds ratio when the only predictor is treatment. A network meta-analysis combines tables from trials of different comparisons. Relative risk is another name for the risk ratio drawn from the same table.
Limitations and common misreadings
The table itself is simple. Most errors arise in how it is filled or read.
- Using the wrong denominator. Randomised totals and observed totals differ when outcomes are missing, and the choice changes every risk in the table.
- Collapsing studies or strata into one table. Pooled raw counts ignore randomisation and can reverse an association.
- Applying predictive values in a new setting. They depend on prevalence, which does not enter sensitivity and specificity.
- Relying on the chi-squared test with sparse cells. Low expected counts call for Fisher's exact test.
- Treating a significant test as an effect estimate. The test shows association only, and HTA needs the size of the effect with its uncertainty.
- Accepting a continuity correction without checking. A ratio built on a 0.5 correction can drive a model result.
Sources
- Higgins JPT, Li T, Deeks JJ (editors). Chapter 6: Choosing effect measures and computing estimates of effect. In: Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane; 2024. Sections 6.3, 6.4.1 and 6.4.2. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06
- Deeks JJ, Higgins JPT, Altman DG, et al (editors). Chapter 10: Analysing data and undertaking meta-analyses. In: Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane; 2024. Section 10.4.4. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-10
- Schünemann HJ, Vist GE, Higgins JPT, et al. Chapter 15: Interpreting results and drawing conclusions. In: Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane; 2024. Section 15.4.4. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-15
- Deeks JJ, Higgins JPT. Statistical algorithms in Review Manager. Cochrane Statistical Methods Group; May 2022. https://documentation.cochrane.org/revman-kb/files/210600101/210600103/1/1654774257333/Statistical_methods_in_revman.pdf
- Kim HY. Statistical notes for clinical researchers: chi-squared test and Fisher's exact test. Restorative Dentistry and Endodontics. 2017;42(2):152-155. https://doi.org/10.5395/rde.2017.42.2.152
- Šimundić AM. Measures of diagnostic accuracy: basic definitions. EJIFCC. 2009;19(4):203-211. https://pmc.ncbi.nlm.nih.gov/articles/PMC4975285/
- Hamza TH, van Houwelingen HC, Stijnen T. The binomial distribution of meta-analysis was preferred to model within-study variability. Journal of Clinical Epidemiology. 2008;61(1):41-51. https://doi.org/10.1016/j.jclinepi.2007.03.016
- National Institute for Health and Care Excellence. NICE technology appraisal and highly specialised technologies guidance: the manual (PMG36). Published 2022, last updated 13 October 2026. Sections 4.6.14 and 4.6.16. https://www.nice.org.uk/process/pmg36/chapter/economic-evaluation-2
Related Concepts (6)
Institutional Perspectives (2)
- FDA
Report the Original 2x2 Table for Diagnostic Test Studies
FDA guidance on diagnostic test studies recommends reporting the 2x2 table of results comparing the candidate test with the reference standard or comparative method, together with sensitivity and specificity pairs or agreement measures and their confidence intervals. Results should also be reported by site and by relevant clinical and demographic subgroups. FDA advises against revising the original 2x2 table through discrepant resolution, because the revised table rests on untested assumptions and its sensitivity and specificity are not valid estimates of performance.
US FDA, Statistical Guidance on Reporting Results from Studies Evaluating Diagnostic Tests, guidance for industry and FDA staff, issued 13 March 2007, docket 2003D-0044, sections 5, 6 and 7.3View source → - IQWiG
Effect Measures and Zero Cells in 2x2 Tables
IQWiG treats binary outcomes as analyses of 2x2 tables and applies the usual effect and risk measures of such tables to categorical outcomes, with the statistical uncertainty described for every estimate. In meta-analyses with zero cells it adds a correction of 0.5 to each cell of the fourfold table, an approach it considers appropriate only while zero cells are few. For very rare events the Peto odds ratio needs no correction, but suits only effects that are not too large in a balanced design.
IQWiG, General Methods, Version 8.0 of 19 December 2025 (English translation of Allgemeine Methoden; German original authoritative), DOI 10.60584/General-Methods_V8.0, sections 10.3.1 and 10.3.7View source →
Library
Publications
8
The confidence profile method: a Bayesian method for assessing health technologies — Eddy DM, Vol. 37, No. 2, pp. 210-228 ed., 1989 (Operations Research)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Confidence Profile Method, where it is cited as a reference for that concept.
Journal ArticleView source →The burden of disclosure: increased compliance with distrusted advice — Sah S, Loewenstein G, Cain DM, Vol. 104, No. 2, pp. 289-304 ed., 2013 (Journal of Personality and Social Psychology)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Conflict of Interest, where it is cited as a reference for that concept.
Journal ArticleView source →The use of surrogate outcomes in model-based cost-effectiveness analyses: a survey of UK Health Technology Assessment reports — Taylor RS, Elston J, Vol. 13, No. 8 ed., 2009 (Health Technology Assessment)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Causal Pathway, where it is cited as a reference for that concept.
Journal ArticleView source →Assessing the quality of reports of randomized clinical trials: is blinding necessary? — Jadad AR, Moore RA, Carroll D, et al, Vol. 17, No. 1, pp. 1-12 ed., 1996 (Controlled Clinical Trials)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Quality Score, where it is cited as a reference for that concept.
Journal ArticleView source →Measures of diagnostic accuracy: basic definitions — Šimundić AM, Vol. 19, No. 4, pp. 203-211 ed., 2009 (EJIFCC)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Contingency Table, where it is cited as a reference for that concept.
Journal ArticleView source →Chapter 15: Interpreting results and drawing conclusions — Schünemann HJ, Vist GE, Higgins JPT, Santesso N, Deeks JJ, Glasziou P, Akl EA, Guyatt GH, Version 6.5 ed., 2024 (Cochrane Handbook for Systematic Reviews of Interventions)
Book or book chapter listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Mean Difference, where it is cited as a reference for that concept.
BookView source →The binomial distribution of meta-analysis was preferred to model within-study variability — Hamza TH, van Houwelingen HC, Stijnen T, Vol. 61, No. 1, pp. 41-51 ed., 2008 (Journal of Clinical Epidemiology)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Contingency Table, where it is cited as a reference for that concept.
Journal ArticleView source →Statistical notes for clinical researchers: chi-squared test and Fisher's exact test — Kim HY, Vol. 42, No. 2, pp. 152-155 ed., 2017 (Restorative Dentistry and Endodontics)
Journal article listed in the Sources of the HealthEconomics.wiki Concept Architecture article on Contingency Table, where it is cited as a reference for that concept.
Journal ArticleView source →
Frequently Asked Questions (6)
What is a contingency table?
A contingency table counts observations cross-classified by two or more categorical variables, such as trial arm by outcome or test result by disease.
Source: Kim 2017
How are the risk ratio, odds ratio and risk difference calculated from a 2x2 contingency table?
With a and b as the events and non-events in the experimental arm, and c and d as those in the comparator arm, the risk in each arm is its event count divided by its row total. The risk ratio divides the experimental risk by the comparator risk, the odds ratio is ad divided by bc, and the risk difference subtracts the comparator risk from the experimental risk. Chapter 6 of the Cochrane Handbook notes that the numbers in each group who did and did not experience the outcome are the only data a dichotomous outcome requires. The reciprocal of the absolute risk difference gives the number needed to treat.
Source: Higgins et al. 2024
When should Fisher's exact test be used instead of a chi-squared test on a contingency table?
The Pearson chi-squared test compares each observed count with the count expected under independence, found by multiplying the row and column totals and dividing by the grand total, and it relies on a large-sample approximation. Kim gives the usual rule that the result is relevant only when no more than 20% of cells have expected frequencies below 5 and no cell has an expected frequency below 1. Fisher's exact test, which uses the hypergeometric distribution of the cell counts, is recommended when that rule fails and is valid at any sample size. Neither test gives the size of an effect, so HTA reports effect measures with confidence intervals.
Source: Kim 2017
How does a diagnostic contingency table give sensitivity, specificity and predictive values?
A diagnostic accuracy table crosses the index test result with the reference standard, giving true positives, false positives, false negatives and true negatives. Sensitivity is true positives divided by everyone with the condition and specificity is true negatives divided by everyone without it, so both are computed down the columns and prevalence does not enter their calculation. Predictive values are computed across the rows and change with prevalence, so Šimundić advises against transferring them to a setting with a different prevalence. In an illustrative case, a test with sensitivity 0.90 and specificity 0.85 has a positive predictive value of 0.40 at 10% prevalence, falling to about 0.11 at 2%.
Source: Šimundić 2009
Why should counts from several trials not be added into one contingency table for a meta-analysis?
Adding the counts from several trials into a single table ignores the randomisation within each study. Chapter 15 of the Cochrane Handbook warns that this can give seriously misleading results when any study has unbalanced randomisation, and the pooled association can even reverse direction, the Simpson paradox. Stratified methods such as the Mantel-Haenszel method pool the study tables while keeping each comparison inside its own trial. A pooled ratio obtained this way can then be applied to the baseline risk of the decision population to give a transition probability in a Markov model.
Source: Schünemann et al. 2024
How should zero cells in a contingency table be handled in a meta-analysis?
A zero cell can stop the risk ratio or odds ratio and its standard error from being calculated, and the customary fix is to add 0.5 to every cell. Chapter 10 of the Cochrane Handbook warns that this fixed correction usually biases study estimates towards no difference, overestimates their variances and introduces a directional bias when arm sizes are unequal. It reports that Sweeting and colleagues found a correction proportional to the reciprocal of the size of the contrasting arm preferable when arms were unbalanced. Studies with no events in either arm are normally excluded from meta-analyses of ratios, since they show neither the direction nor the size of the effect.
Source: Deeks et al. 2024
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 14 Oct 2026
Content version: 1.0.1
Canonical Identity
- Persistent URI
- https://healtheconomics.wiki/concept/contingency-table
- Term code
- HE-ES-SA-253
Stable URI · Machine-readable · Resolvable · CC BY 4.0
