In short
When each individual has two categorical variables recorded, a two-way table shows the counts for every combination. Graphs compare the groups: side-by-side bar charts, segmented bar charts (one bar per group, split into proportions) and mosaic plots (segmented bars whose widths also show group size). If the distribution of one variable differs between the groups of the other, the variables are associated.
What you need to know
- Construct and read a two-way table of counts.
- Construct side-by-side and segmented bar charts and read a mosaic plot.
- Compare the distributions of a categorical variable across groups.
- Justify a claim about association using a table or graph.
Two-way tables
A school surveyed 300 students about whether they play an organised sport and whether they usually eat breakfast. Each student is counted once, in the cell for their pair of answers:
| Eats breakfast | No breakfast | Total | |
|---|---|---|---|
| Plays sport | 90 | 30 | 120 |
| No sport | 96 | 84 | 180 |
| Total | 186 | 114 | 300 |
The row and column totals are the marginal totals: they describe one variable on its own (120 of 300 students play sport). The inside cells are joint counts: both conditions at once (90 students play sport and eat breakfast).
Graphs for two categorical variables
Comparing raw counts is unfair here, because the groups differ in size (120 versus 180). Instead, find the breakfast proportions within each sport group: 90/120 = 0.75 of sport players eat breakfast, compared with 96/180 ≈ 0.53 of non-players. A segmented bar chart shows exactly this: one bar per group, each 100% tall, split into the proportions.
- A side-by-side bar chart puts the bars for each group next to each other; with relative frequencies it shows the same comparison.
- A mosaic plot is a segmented bar chart where each bar's width is proportional to the group's size, so you see both the comparison and how big each group is.
Is there an association?
Two categorical variables are associated if knowing one changes what you expect about the other. Here, the proportion eating breakfast is clearly higher for students who play sport (0.75) than for those who don't (0.53), so in this sample sport and breakfast are associated. If the segments in the two bars had been about the same height, there would be little evidence of association.
Key terms
- Two-way table
- A table of counts for every combination of two categorical variables.
- Joint frequency
- The count (or proportion) in one cell: both conditions at once.
- Marginal frequency
- A row or column total, describing one variable alone.
- Segmented bar chart
- One full-height bar per group, divided into the proportions of each category of the other variable.
- Mosaic plot
- A segmented bar chart whose bar widths are proportional to group sizes.
- Association
- A relationship where the distribution of one variable differs across the groups of the other.
Common mistakes
Comparing raw counts between groups of different sizes.
Compare proportions within each group.
Using the overall total as the denominator for a within-group comparison.
Divide by the group's total (120 sport players), not by 300.
Claiming one variable causes the other.
Say the variables are associated in this sample unless there was random assignment.
How this topic is tested
- State which proportions you are comparing and show the fractions.
- Use the words 'is associated with' and quote two proportions.
- Label segmented bar charts with a legend and a 0 to 1 scale.
Practice questions
Original AP-style multiple-choice questions. Pick an answer to see the explanation.
Question 1 · SP 3 · Analyze Data
In the sport and breakfast table, what proportion of the 300 students play sport and skip breakfast?
Question 2 · SP 4 · Interpret Results
Which comparison shows whether sport and breakfast are associated?
Question 3 · SP 4 · Interpret Results
A segmented bar chart shows 40% of urban and 41% of rural residents support a policy. What does this suggest?
Question 4 · SP 3 · Analyze Data
What extra information does a mosaic plot show that a segmented bar chart does not?
Question 5 · SP 3 · Analyze Data
In a two-way table of 500 shoppers, 200 used a coupon. Of the coupon users, 150 bought more than ₹1,000 of goods. What proportion of coupon users bought more than ₹1,000?
Free-response practice
Write your answer first, then mark it against the scoring guide.
Practices 3 and 4 · 4 points
A random sample of 400 adults was asked whether they live in a city or a village and whether they use a mobile payment app. Of 250 city residents, 175 use an app; of 150 village residents, 60 use an app.
- (a) Construct a two-way table with row and column totals.
- (b) Calculate the proportion of app users in each location.
- (c) Explain whether the data suggest an association between location and app use.
Scoring guide: one point for each of the following
Part (a)
- City: 175 use, 75 don't, 250 total; Village: 60 use, 90 don't, 150 total.
- Column totals: 235 use, 165 don't, 400 overall.
Part (b)
- City: 175/250 = 0.70; village: 60/150 = 0.40.
Part (c)
- Yes: the proportion of app users is much higher among city residents (0.70) than village residents (0.40), so knowing where someone lives changes the expected app use.
Connected topics
Frequently asked questions
Which variable goes in the rows?
Either, but put the explanatory variable (the one you split groups by) in the rows when comparing, so you compare across rows.
Do segmented bars always reach 1?
Yes. Each bar shows the whole of one group, so its segments add to 1 (100%).
How different must proportions be to show association?
Here you judge by eye. Unit 3's chi-square test decides whether a difference is larger than chance would produce.