Lesson 2 of 8 · 14 min
Two-way frequency tables
Organise two categorical variables in a two-way frequency table, find its row and column sums, fill in missing values, and calculate percentages of the right total.
What you will be able to do
- Construct a two-way frequency table from raw data.
- Calculate row sums, column sums and the grand total, and use them to find missing values.
- Calculate a count as a percentage of its row total, its column total or the grand total.
A Brisbane school surveyed 200 senior students, recording each student's year level and where they do most of their study: at home, in a public library, or at school.
A list of 200 pairs like Year 11, home hides any pattern. A two-way frequency table counts how many students fall into each combination of categories, with one variable across the top and the other down the side.
The row sums (right) and column sums (bottom) are shaded. The grand total, 200, sits in the corner: it is the sum of the row sums and also the sum of the column sums.
Definition
Row sums, column sums and the grand total
- A row sum adds the counts across a row: Year 11 students.
- A column sum adds the counts down a column: students study at home.
- The grand total is the number of individuals: , and also .
If the row sums and the column sums don't give the same grand total, a count is wrong somewhere.
Worked example
Build a two-way frequency table from raw data
Twenty senior students were asked their year level and where they do most of their study: home (H), library (L) or school (S). Their responses were
11H, 12L, 11H, 11S, 12H, 11L, 12L, 11H, 12S, 11H, 12L, 11L, 11H, 12H, 11S, 12L, 11H, 12S, 11L, 12H.
Construct a two-way frequency table with row and column sums.
Step 1: Set up the table
Put one variable down the side (year level) and the other across the top (study location). Add a Total column and a Total row.
Either variable can go down the side. Putting the explanatory variable (year level) in the rows makes the next lesson's percentages easier to read.
Step 2: Tally each response into its cell
Work through the list once, making a tally mark in the cell for each response. Counting the tallies:
- Year 11: home 6, library 3, school 2
- Year 12: home 3, library 4, school 2.
Step 3: Find the row sums
Year 11: . Year 12: .
Step 4: Find the column sums and check the grand total
Home: . Library: . School: .
The row sums give and the column sums give . Both match the 20 students surveyed.
If the two grand totals disagree, or don't match the number surveyed, a response was missed or counted twice.
Try it yourself first, then check the working one step at a time.
Answer
| Year level | Home | Library | School | Total |
|---|---|---|---|---|
| Year 11 | 6 | 3 | 2 | 11 |
| Year 12 | 3 | 4 | 2 | 9 |
| Total | 9 | 7 | 4 | 20 |
Method
Put one variable's categories down the side and the other's across the top, with Total row and column.
Tally each individual into exactly one cell.
Add across for row sums and down for column sums.
Check both routes give the same grand total, equal to the number surveyed.
Watch out for
Skipping a response or counting one twice. Cross each response off as you tally it.
Because every row and every column has to add up, you can find a missing count from the others. A missing cell is its row sum minus the other cells in that row — or its column sum minus the other cells in that column.
Part of a two-way frequency table from a survey of Year 11 students is shown. Find the value of .
| Year level | Bus | Car | Walk or cycle | Total |
|---|---|---|---|---|
| Year 11 | 42 | 18 | 95 |
Worked example
Complete a two-way table and find a percentage
A survey of 160 visitors to a Sunshine Coast beach recorded where each visitor lives and their main activity at the beach.
| Home state | Swimming | Surfing | Walking | Total |
|---|---|---|---|---|
| Queensland | 38 | 27 | 95 | |
| Interstate | 12 | |||
| Total | 70 | 42 | 160 |
(a) Find the values of , , , and .
(b) What percentage of interstate visitors were mainly surfing? Give your answer correct to one decimal place.
Step 1: Find from the Queensland row
Step 2: Find from the Swimming column
Step 3: Find from the Total column
The row sums add to the grand total, so .
Step 4: Find from the Interstate row
Step 5: Find and check
. Check the bottom row: , and the Surfing column: . Everything adds up.
Checking a row or column you didn't use catches an arithmetic slip before it spreads.
Step 6: Calculate the percentage of interstate visitors who surfed
The group is interstate visitors, so divide by their row sum, :
Try it yourself first, then check the working one step at a time.
Answer
(a) , , , , . (b) About 18.5% of interstate visitors were mainly surfing.
Method
Start with a row or column that has only one missing value.
Use each answer to unlock the next row or column.
Check with a row or column you haven't used.
For a percentage, divide by the total of the group named after "percentage of".
Watch out for
Dividing 12 by the Surfing total (42) instead of the interstate total (65). That gives the percentage of surfers who live interstate — a different question.
Counts tell you how many. Percentages let you compare. Each count in a two-way table can be written as a percentage of three different totals — and each one answers a different question.
| Question | Divide by | Percentage |
|---|---|---|
| What percentage of all the students surveyed are Year 11s who study at home? | the grand total, 200 | |
| What percentage of Year 11 students study at home? | the Year 11 row sum, 120 | |
| What percentage of students who study at home are in Year 11? | the Home column sum, 94 |
Tip
Read the words after "percentage of"
"What percentage of Year 11 students …" means divide by the number of Year 11 students. The group named after of is the total you divide by.
Use the study location table. What percentage of Year 12 students study in a library?
Use the study location table. Which calculation gives the percentage of the students who study at school that are in Year 12?
Common mistake
Dividing by the wrong total
Most lost marks in two-way tables come from dividing by the wrong total. Before you calculate, say the group out loud — "of the Year 12 students", "of the students who study at home" — and find that group's total in the table.
Summary
A two-way frequency table counts the individuals in each combination of the categories of two categorical variables.
Row sums add across, column sums add down, and both lead to the same grand total.
A missing count is its row (or column) sum minus the other counts in that row (or column).
A count can be a percentage of the grand total, its row sum or its column sum. The words after "percentage of" tell you which.
Finished the lesson?
Try the 3 quick checks above and the lesson completes itself, or mark it complete now.