01 · Learn the idea
One table, two questions
Categorical data sorts people or things into groups: grade 9 or grade 10, bus or car. A two-way frequency table shows two categorical variables for the same group at once. One variable labels the rows and the other labels the columns.
Here is a small case, with invented numbers. A school asked 80 students their grade and how they get to school. Rows: grade 9, grade 10. Columns: bus, car. Counts: grade 9 bus 36, grade 9 car 12, grade 10 bus 16, grade 10 car 16.
Each of those four counts is a joint frequency. It counts the students who fit a row and a column together. The 36 means 36 students are in grade 9 and ride the bus.
Add across each row and down each column to get the totals. Row totals: grade 9 has 36 + 12 = 48 and grade 10 has 16 + 16 = 32. Column totals: bus has 36 + 16 = 52 and car has 12 + 16 = 28. These totals are called marginal frequencies because they sit in the margins of the table. Each one describes a single variable. The 52 means 52 students ride the bus, whatever their grade.
The grand total goes in the corner. The row totals give 48 + 32 = 80 and the column totals give 52 + 28 = 80. Both must match the number of students surveyed.
02 · Build understanding
Worked example: build a table from a description
An invented robotics club polled its 50 members. 28 members are in middle school and the rest are in high school. 20 members want morning meetings and the rest want afternoon meetings. 12 of the middle school members want mornings. Build the two-way table.
Step 1: Set up the frame so every fact has a place. Rows: middle school, high school, total. Columns: morning, afternoon, total.
Step 2: Enter what you are told. The grand total is 50. The middle school row total is 28. The morning column total is 20. The joint frequency for middle school and morning is 12.
Step 3: Finish the middle school row. Its total is 28 and one cell is 12, so middle school and afternoon is 28 − 12 = 16.
Step 4: Find the high school row total. The two row totals add to 50, so high school has 50 − 28 = 22 members.
Step 5: Finish the morning column. Its total is 20 and one cell is 12, so high school and morning is 20 − 12 = 8.
Step 6: Finish the high school row. Its total is 22 and one cell is 8, so high school and afternoon is 22 − 8 = 14.
Step 7: Check. The afternoon column is 16 + 14 = 30, and 50 − 20 = 30 members wanted afternoons. The four joint frequencies add to 12 + 16 + 8 + 14 = 50.
03 · Build understanding
Worked example: relative frequencies
A relative frequency is a count written as a fraction or percent of some total. Which total you divide by depends on the question. Use the school travel table. Rows: grade 9, grade 10. Columns: bus, car. Counts: grade 9 bus 36, grade 9 car 12, grade 10 bus 16, grade 10 car 16. Totals: grade 9 is 48, grade 10 is 32, bus is 52, car is 28, everyone is 80.
Step 1: Joint relative frequency. What percent of all the students are grade 9 bus riders? Divide the joint frequency by the grand total: 36/80 = 0.45 = 45%.
Step 2: Marginal relative frequency. What percent of all the students ride the bus? Divide the marginal frequency by the grand total: 52/80 = 0.65 = 65%.
Step 3: Conditional relative frequency. What percent of the grade 9 students ride the bus? The words "of the grade 9 students" shrink the group to the grade 9 row, so divide by that row’s total: 36/48 = 0.75 = 75%.
Step 4: Do the same for grade 10. Of the 32 grade 10 students, 16 ride the bus: 16/32 = 0.5 = 50%.
Step 5: Flip the condition and the answer changes. What fraction of the bus riders are in grade 9? Now the group is the bus column, so divide by 52: 36/52 = 9/13, about 69.2%.
Step 6: Check. Within grade 9, the bus and car percents must cover everyone in the row: 75% + 25% = 100%, where 12/48 = 25% go by car.
conditional relative frequency = joint frequency / row or column total
04 · Build understanding
Worked example: signs of an association
Two categorical variables are associated when knowing one tells you something about the other. To look for an association, compare conditional relative frequencies across the rows. Here are two cases.
Step 1: In the travel table, find the bus rate for each grade. Grade 9: 36/48 = 75%. Grade 10: 16/32 = 50%.
Step 2: Compare. The rates are 25 percentage points apart. Knowing a student’s grade changes your best guess about how that student gets to school. In this group, grade and travel are associated.
Step 3: Now try an invented survey of 100 students. Rows: has a pet, no pet. Columns: prefers mornings, prefers evenings. Counts: pet and mornings 24, pet and evenings 36, no pet and mornings 16, no pet and evenings 24. The row totals are 60 and 40.
Step 4: Find the morning rate for each row. Pet owners: 24/60 = 40%. Students with no pet: 16/40 = 40%.
Step 5: Compare. The rates are equal, so knowing whether a student has a pet tells you nothing about mornings or evenings. This table shows no association.
Step 6: Check with the other column. Evening rates are 36/60 = 60% and 24/40 = 60%, equal again.
A table can only show a possible association in the group that was surveyed. A small gap in a small survey can happen by chance. And an association, even a large one, does not tell you that one variable causes the other.
05 · Build understanding
Three mistakes to watch for
Dividing by the wrong total. "What percent of grade 9 students ride the bus?" is 36/48 = 75%. Dividing by everyone gives 36/80 = 45%, which answers a different question: what percent of all students are grade 9 bus riders.
Reversing the condition. "Of the grade 9 students, what fraction ride the bus?" is 36/48. "Of the bus riders, what fraction are in grade 9?" is 36/52. Same joint frequency, different group, different answer. Find the words after "of" to choose the denominator.
Comparing counts when the groups are different sizes. In the pet survey, 24 pet owners prefer mornings and only 16 students without pets do. That looks like a difference, but there are 60 pet owners and 40 students without pets. The rates are both 40%. When the groups differ in size, compare the percents.
Apply and explain
Your turn
An invented survey of 200 teens asked whether they have a part-time job and whether they own a bike. Rows: has a job, no job. Columns: owns a bike, no bike. Counts: job and bike 30, job and no bike 50, no job and bike 45, no job and no bike 75. A classmate says, "More teens without jobs own bikes, 45 compared with 30, so not having a job is associated with owning a bike." Explain whether the table supports this.
Use paper or explain your thinking aloud before opening the solution.
Check your reasoning
The table does not support it. The classmate compared counts, but the groups are different sizes: 80 teens have a job and 120 do not. The conditional relative frequencies are 30/80 = 37.5% of teens with a job and 45/120 = 37.5% of teens without a job. The bike rate is the same in both rows, so this table shows no association between having a job and owning a bike.
- Finds the row totals 80 and 120 and says the groups are different sizes.
- Computes the conditional relative frequencies 30/80 and 45/120 as 37.5% each.
- Concludes there is no association because the rates are equal, not because of the counts.
Ready to practice?
Try the questions, get feedback, and review your reasoning.
Two-way frequency tables: practice →