Two-way table

By Jude Wallis · Published

A two-way table displays counts for two categorical variables at once, with one variable's categories as rows and the other's as columns.

A two-way table, also called a contingency table, cross-classifies every individual by two categorical variables at once. Each cell holds the count of individuals in that row category and that column category. The row and column totals are the margins and the grand total is nn. Every individual lands in exactly one cell, so the cells add back to nn.

Take 450 applicants to two programs, cross-classified by sex and by admission decision within each program.

ProgramMen admittedWomen admitted
A80 of 10045 of 50
B10 of 10040 of 200
Both90 of 20085 of 250

Collapsed over program, men were admitted at 90/200=0.4590 / 200 = 0.45 and women at 85/250=0.3485 / 250 = 0.34, and the misreading writes itself: "45 percent of men were admitted against 34 percent of women, so the process favored men." Put the third variable back and women were admitted at the higher rate in both programs, 0.90 against 0.80 in A and 0.20 against 0.10 in B. The overall gap comes from where the applicants went, since 200 of the 250 women applied to program B, which admits few of anyone. A comparison that reverses when a lurking variable is restored is Simpson's paradox, and a collapsed two-way table is where it hides.

So a table already summed over a variable you were never shown cannot be un-summed. Neither can a table of percentages: row percentages alone give no counts, no grand total, and therefore no expected counts, so they cannot feed a chi-square test. Percentages are for reading, and counts are what the table has to store.

Two-way tables are topic 2.1, and they are the input to the chi-square test for homogeneity or independence in topics 3.14 and 3.15.

Where this comes up

25 pages on the site use this term.

More graphs and displays terms, or browse the full statistics glossary.