01 / 21

Two-Way
Tables

Learn to organize categorical data into rows and columns, then compute joint frequencies and marginal frequencies to uncover patterns.

Math 1

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.

Categorical
Favorite color, pet type, grade level, yes/no responses
Numerical
Height, test score, temperature: these go in histograms, not two-way tables

Anatomy of a Two-Way Table

Soccer Basketball Total
Freshman 30 20 50
Sophomore 25 25 50
Total 55 45 100
Joint
Interior cells: count for a specific row AND column
Row Marginal
Row totals on the right edge
Column Marginal
Column totals on the bottom edge

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.

Row Marginals
Freshman total = 50; Sophomore total = 50
Column Marginals
Soccer total = 55; Basketball total = 45

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.

1
Sum each row: \(30 + 20 = 50\) and \(25 + 25 = 50\).
2
Sum each column: \(30 + 25 = 55\) and \(20 + 25 = 45\).
3
Verify: Row totals add to \(50 + 50 = 100\). Column totals add to \(55 + 45 = 100\). Both match: ✓

How to Build a Two-Way Table

1
Identify the two categorical variables and list each category.
2
Set up the grid: one variable along the rows, the other along the columns. Add a "Total" row and column.
3
Tally the data into the correct interior cells (joint frequencies).
4
Sum each row and column to find marginal frequencies.
5
Verify that marginal sums equal the grand total.

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
1
Regular & Unhealthy = \(110 - 70 = \) 40
2
None & Healthy = \(90 - 50 = \) 40
3
Column totals: Healthy = \(70 + 40 = \) 110, Unhealthy = \(40 + 50 = \) 90. Check: \(110 + 90 = 200\) ✓

Visualizing the Structure

Category A Category B Total Group 1 Group 2 Total Joint Joint Joint Joint Row Row Column Column Grand Joint Frequencies Row Marginals Column Marginals

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

✕ Wrong Denominator
Using the grand total when the question asks for a conditional frequency (which uses a row or column total).
✕ Swapping Joint & Marginal
Reporting a marginal total when asked for the count of a specific row-column combination.
✕ Forgetting the Grand Total Check
Not verifying that all row totals and all column totals sum to the same grand total, which can hide arithmetic errors.

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

TeaCoffeeTotal
Adult354580
Teen403070
Total7575150

What is the joint relative frequency of Teen AND Tea?

Question 3 of 5

PassFailTotal
Studied481260
Did Not Study202040
Total6832100

What is the marginal relative frequency for "Fail"?

Question 4 of 5

BikeBusTotal
Urban6090150
Suburban30120150
Total90210300

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?