Mathwords logoReference LibraryMathwords

Two-Way Table

A two-way table is a table that organizes data about two categorical variables, with one variable shown in the rows and the other in the columns. Each cell in the table shows the count (or frequency) of observations that fall into that particular combination of categories.

A two-way table, also called a contingency table, is a rectangular array that displays the joint frequencies of two categorical variables. The rows represent the categories of one variable and the columns represent the categories of the other. The values along the right edge and bottom edge are called marginal totals (or marginal frequencies), and they show the total count for each single category. The grand total appears in the bottom-right corner.

Worked Example

Problem: A school surveyed 200 students about whether they prefer dogs or cats, and recorded their grade level (middle school or high school). 60 middle school students prefer dogs and 30 prefer cats. 70 high school students prefer dogs and 40 prefer cats. Construct a two-way table and determine what fraction of high school students prefer cats.
Step 1: Set up the table with one variable (pet preference) across the columns and the other variable (grade level) down the rows. Leave space for marginal totals.
Step 2: Fill in the joint frequencies from the data: middle school / dogs = 60, middle school / cats = 30, high school / dogs = 70, high school / cats = 40.
Step 3: Calculate the row totals (marginal frequencies) by adding across each row.
Middle school total=60+30=90High school total=70+40=110\text{Middle school total} = 60 + 30 = 90 \qquad \text{High school total} = 70 + 40 = 110
Step 4: Calculate the column totals by adding down each column, and verify the grand total.
Dogs total=60+70=130Cats total=30+40=70Grand total=200\text{Dogs total} = 60 + 70 = 130 \qquad \text{Cats total} = 30 + 40 = 70 \qquad \text{Grand total} = 200
Step 5: To find the fraction of high school students who prefer cats, divide the joint frequency by the row total for high school.
40110=4110.364\frac{40}{110} = \frac{4}{11} \approx 0.364
Answer: About 36.4% of high school students prefer cats. This value (40110\frac{40}{110}) is a conditional relative frequency — the proportion of cat lovers given that the student is in high school.

Visualization

Why It Matters

Two-way tables are one of the most common ways to summarize survey and research data. In AP Statistics, you use them to calculate conditional probabilities, test for independence between variables using chi-square tests, and identify patterns like Simpson's paradox. Outside the classroom, journalists, medical researchers, and marketers all rely on two-way tables to compare groups and spot trends in categorical data.

Common Mistakes

Mistake: Confusing joint frequencies with marginal frequencies when calculating probabilities.
Correction: Joint frequencies are the values inside the table (e.g., 40 high school cat lovers). Marginal frequencies are the row or column totals (e.g., 110 total high school students). When finding a conditional probability, divide a joint frequency by the appropriate marginal total — not by the grand total.
Mistake: Using the grand total as the denominator for every probability calculation.
Correction: The grand total is the correct denominator only when you want the overall proportion of the entire sample. For conditional questions like 'of those who are in high school, what fraction prefer cats?', use the relevant row or column total instead.

Related Terms