Lesson 10.3 · Data and Statistics
Two-way frequency tables
So far in this unit every data set has been numbers. But many questions are about categories: yes or no, grade level, favorite app. When you record two categorical variables for each person, a two-way table organizes the counts so you can ask whether the variables are related, for example whether students who play an instrument are more or less likely to play a sport.
Two-way frequency tables
A school surveyed students with two questions: Do you play a musical instrument? and Do you play a sport? Each student lands in exactly one of four cells.
| Plays a sport | No sport | Total | |
|---|---|---|---|
| Plays an instrument | |||
| No instrument | |||
| Total |
Definition
Joint and marginal frequencies
A joint frequency is a count in the body of the table: it counts people with one category from each variable. ( students play an instrument and a sport.)
A marginal frequency is a row or column total, written in the margins. It counts one variable alone. ( students play a sport.)
The grand total in the corner counts everyone.
The totals give a built-in check: each row adds across to its total, each column adds down to its total, and both the row totals and the column totals add to the grand total. Here and .
Worked example: Completing a table
A movie theater surveyed customers about whether they bought popcorn. Complete the table.
| Popcorn | No popcorn | Total | |
|---|---|---|---|
| Adult | |||
| Child | |||
| Total |
Work from any row or column that has only one blank.
- Adults with no popcorn: .
- Children in total: .
- Children with popcorn: .
- Popcorn total: . No-popcorn total: .
Check: . ✓
| Popcorn | No popcorn | Total | |
|---|---|---|---|
| Adult | |||
| Child | |||
| Total |
Relative frequencies
Raw counts are hard to compare when groups have different sizes. There are non-musicians who play a sport and only musicians, but there are also more non-musicians overall. To compare fairly, divide by a total to get a relative frequency (a fraction, decimal or percent).
Definition
Relative frequencies
- Joint relative frequency . Example: of all students play an instrument and a sport.
- Marginal relative frequency . Example: of all students play an instrument.
- Conditional relative frequency . It describes one group only. Example: of the students who play an instrument, play a sport.
The word of tells you which total to divide by. "Percent of the musicians who play a sport" divides by the number of musicians.
Common mistake
Changing which group you condition on changes the answer.
- Percent of instrument players who play a sport: .
- Percent of sport players who play an instrument: .
Same cell, different denominators, different questions. Before dividing, ask yourself, "percent of whom?"
Looking for an association
Two categorical variables are associated if knowing one of them changes the likely value of the other. To test this, compare conditional relative frequencies across the groups.
For the survey: of instrument players play a sport, but of the other students do. That's a big difference, so in this school the two variables are associated: students who play an instrument are less likely to play a sport.
Testing for association
Compute the same conditional relative frequency for each group (for example, the percent who say "yes" in each row).
- If the percents are about equal, there is no association.
- If they are clearly different, there is an association.
An association does not tell you why. Maybe music practice leaves less time for sports, or maybe something else explains both. You'll look at this more carefully in the next lesson.
Relative frequency tables
It's often useful to turn a whole table into percents. Dividing each cell by its row total gives a row relative frequency table, and each row then adds to . Dividing by column totals gives a column relative frequency table.
Worked example: Where do you get your news?
A survey asked adults whether they get most of their news online or from TV.
| Online | TV | Total | |
|---|---|---|---|
| Under 30 | |||
| 30 to 50 | |||
| Over 50 | |||
| Total |
Make a row relative frequency table. Is there an association between age group and news source?
Divide each cell by its row total:
| Online | TV | Total | |
|---|---|---|---|
| Under 30 | |||
| 30 to 50 | |||
| Over 50 |
The percent who prefer online news falls from to to as age increases. The percents are very different, so there is a strong association between age group and news source: younger adults in this survey were much more likely to get their news online.
Tip
Row percentages answer "within each row group, how do people split?" Choose the direction that matches your question. To compare age groups, divide by the age-group totals.
Practice
This table is used in the next three problems. It shows whether students ate breakfast this morning.
| Ate breakfast | Skipped breakfast | Total | |
|---|---|---|---|
| Grade 9 | |||
| Grade 10 | |||
| Total |
Look at the breakfast table above. How many grade 10 students skipped breakfast?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Look at the breakfast table above. What percent of all students are in grade 10 and ate breakfast?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Look at the breakfast table above. Of the students who skipped breakfast, what percent are in grade 9? Round to the nearest tenth of a percent.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
The table below is used in the next two problems. It shows how students get to school.
| Walks | Doesn't walk | Total | |
|---|---|---|---|
| Lives within 1 mile | |||
| Lives farther away | |||
| Total |
Look at the walking table above. What percent of all the students walk to school? Round to the nearest tenth of a percent.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Look at the walking table above. Which statement best describes the relationship between distance and walking?
In a survey, of the students who own a pet said they like hiking, and of the students who like hiking own a pet. What percent of the pet owners like hiking?
A club has members. of the members are juniors and the rest are seniors. of the juniors and of the seniors want to go on a class trip. Of the members who want to go on the trip, what percent are seniors? Round to the nearest tenth of a percent.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A survey of two groups produced this table.
| Yes | No | Total | |
|---|---|---|---|
| Group A | |||
| Group B |
For what value of would there be no association between group and answer (the same percent of each group says yes)?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.