Two-Way
Tables
Learn to organize categorical data into rows and columns, then compute joint frequencies and marginal frequencies to uncover patterns.
What Is a Two-Way Table?
A two-way table (also called a contingency table) displays data for two categorical variables at the same time. One variable labels the rows and the other labels the columns.
For example, you could survey students about their grade level (Freshman, Sophomore) and their preferred sport (Soccer, Basketball) and record every combination in one table.
Understanding Categorical Data
Categorical data describes qualities or groups: not numbers you can average, but labels you can sort into categories.
Anatomy of a Two-Way Table
| Soccer | Basketball | Total | |
|---|---|---|---|
| Freshman | 30 | 20 | 50 |
| Sophomore | 25 | 25 | 50 |
| Total | 55 | 45 | 100 |
Joint Frequency
A joint frequency is the count in an interior cell of the table. It tells you how many data points share both categories at once.
To find the joint relative frequency, divide any joint frequency by the grand total:
Marginal Frequency
A marginal frequency is the sum of a row or column. These totals sit along the margins (edges) of the table.
Joint vs. Marginal Frequencies
| Joint Frequency | Marginal Frequency | |
|---|---|---|
| Location in table | Interior cells | Row/column totals (edges) |
| What it describes | Both categories at once | One category only |
| Example | Freshman AND Soccer = 30 | All Soccer = 55 |
| Relative version | \(\frac{\text{cell}}{\text{grand total}}\) | \(\frac{\text{row or col total}}{\text{grand total}}\) |
The Grand Total Check
The grand total is the number in the bottom-right corner. It equals the total number of data points and provides a built-in error check.
How to Build a Two-Way Table
Example 1: Pet Survey
A class of 80 students was surveyed on pet preference (Dog or Cat) and gender (Male or Female). Fill in the table and find the joint and marginal frequencies.
| Dog | Cat | Total | |
|---|---|---|---|
| Male | 24 | 16 | 40 |
| Female | 18 | 22 | 40 |
| Total | 42 | 38 | 80 |
Example 2: Relative Frequencies
Using the same pet survey data, convert every cell to a relative frequency by dividing by the grand total of 80.
| Dog | Cat | Total | |
|---|---|---|---|
| Male | 0.30 | 0.20 | 0.50 |
| Female | 0.225 | 0.275 | 0.50 |
| Total | 0.525 | 0.475 | 1.00 |
Example 3: Finding Missing Values
A survey of 200 adults recorded their exercise habit (Regular or None) and diet (Healthy or Unhealthy). Some cells are missing. Find ?.
| Healthy | Unhealthy | Total | |
|---|---|---|---|
| Regular | 70 | ? | 110 |
| None | ? | 50 | 90 |
| Total | ? | ? | 200 |
Visualizing the Structure
Conditional Relative Frequency
Sometimes you want to know a frequency within a subgroup. A conditional relative frequency divides a joint frequency by its row or column total instead of the grand total.
Common Mistakes
Summary of Frequency Types
| Frequency Type | Formula | What It Answers |
|---|---|---|
| Joint | Interior cell value | How many in both categories? |
| Marginal | Row or column total | How many in one category overall? |
| Joint Relative | \(\frac{\text{cell}}{\text{grand total}}\) | What proportion of all data? |
| Marginal Relative | \(\frac{\text{row/col total}}{\text{grand total}}\) | What share of one variable? |
| Conditional Relative | \(\frac{\text{cell}}{\text{row or col total}}\) | What proportion within a subgroup? |
Question 1 of 5
A two-way table has 4 interior cells, row totals, column totals, and a grand total. What are the interior cell values called?
Question 2 of 5
| Tea | Coffee | Total | |
|---|---|---|---|
| Adult | 35 | 45 | 80 |
| Teen | 40 | 30 | 70 |
| Total | 75 | 75 | 150 |
What is the joint relative frequency of Teen AND Tea?
Question 3 of 5
| Pass | Fail | Total | |
|---|---|---|---|
| Studied | 48 | 12 | 60 |
| Did Not Study | 20 | 20 | 40 |
| Total | 68 | 32 | 100 |
What is the marginal relative frequency for "Fail"?
Question 4 of 5
| Bike | Bus | Total | |
|---|---|---|---|
| Urban | 60 | 90 | 150 |
| Suburban | 30 | 120 | 150 |
| Total | 90 | 210 | 300 |
Of all Urban residents, what fraction bikes? (This is a conditional relative frequency by row.)
Question 5 of 5
A two-way table has row totals of 85 and 115, and column totals of 90 and 110. What is the grand total?