AP® Statistics review sheet from Aim for Five (aimforfive.com/stats/units/2/2-1)
Unit 2 · Topic 2.1
2.1 Tabular and Graphical Representations for the Distributions of Two Categorical Variables
When each unit has two categorical variables, a two-way table shows both at once. Graphs like side-by-side bar charts, segmented bar charts and mosaic plots let you compare one variable across the categories of the other and see whether the two are associated.
Key terms
- two-way table
- side-by-side bar chart
- segmented bar chart
- mosaic plot
- association
Two-way tables
A two-way table, sometimes called a contingency table, has the categories of one variable as rows and the other as columns. Each cell counts the units that fall in that row and that column. Row and column totals sit around the edges, and the grand total is in the corner.
Here 200 students were asked their grade and whether they play a school sport:
| Grade | Plays a sport | No sport | Total |
|---|---|---|---|
| Freshman | 72 | 48 | 120 |
| Senior | 28 | 52 | 80 |
| Total | 100 | 100 | 200 |
Graphs for two categorical variables
All three graphs show the distribution of one variable within each category of the other.
- Side-by-side bar chart: for each grade, draw bars for "sport" and "no sport" next to each other. Using percentages within each grade makes the groups comparable.
- Segmented (stacked) bar chart: one bar per grade, each 100% tall, split into segments for sport and no sport. Freshmen: 60% sport, 40% none. Seniors: 35% sport, 65% none. Comparing the segment heights across bars shows the relationship.
- Mosaic plot: a segmented bar chart where each bar's width is proportional to the group's size. Freshmen make up 60% of the sample, so their bar is wider than the seniors' bar. You see both the group sizes and the conditional percentages.
Association
Two categorical variables are associated if knowing the value of one changes what you'd expect for the other. In a segmented bar chart, that shows up as segments that differ from bar to bar. If every bar is split about the same way, there's little or no association.
In the example, 60% of freshmen play a sport but only 35% of seniors do, so grade and sport participation are associated in this sample.
Association isn't causation. These are observational data, and many things differ between freshmen and seniors (schedules, jobs) that could explain the difference.
Which way to compare
Decide which variable you're comparing across. If the question is "Does sport participation differ by grade?", compare percentages within each grade (row percentages). Using the counts alone would mislead here, because there are more freshmen than seniors.
You could also compare the other way: among sport players, what share are freshmen (72%), and among non-players, what share are freshmen (48%)? That also shows an association. Pick the direction that matches the question, and say which one you used.
Worked examples
Try each one yourself first, then open the solution.
- Example 1Calculator allowed
Read a segmented bar chart
Using the grade-and-sport table above, describe the segmented bar chart you'd draw to compare sport participation by grade, and say whether the variables appear associated.
Show the solutionHide the solution
- Step 1: Compare across grades, so compute percentages within each grade.
- Step 2: Freshmen: 72/120 = 0.60 play a sport and 48/120 = 0.40 don't.
- Step 3: Seniors: 28/80 = 0.35 play a sport and 52/80 = 0.65 don't.
- Step 4: Draw one 100% bar per grade with a "sport" segment of 60% for freshmen and 35% for seniors.
- Step 5: The segments differ a lot (60% vs. 35%), so the variables are associated in this sample.
Answer: Bars: freshmen 60% sport / 40% none; seniors 35% sport / 65% none. Freshmen in the sample are much more likely to play a sport, so grade and sport participation appear associated.
- Example 2Calculator allowed
Trap: comparing counts
A student notes that 48 freshmen and 52 seniors don't play a sport and says, "Not playing a sport is about equally common in both grades." Is that right?
Show the solutionHide the solution
- Step 1: 48 and 52 are counts, but the grades have different totals: 120 freshmen and 80 seniors.
- Step 2: As proportions: 48/120 = 0.40 of freshmen and 52/80 = 0.65 of seniors don't play.
- Step 3: Not playing is far more common among seniors.
Answer: No. 40% of freshmen vs. 65% of seniors don't play a sport. The similar counts hide very different proportions.
Common mistakes
- Comparing counts instead of conditional percentages when group sizes differ.
- Drawing a segmented bar chart whose bars don't each add to 100%.
- Saying an association proves one variable causes the other.
- Ignoring bar widths in a mosaic plot; width shows group size.
On the exam
- Multiple-choice questions often show a segmented bar chart or mosaic plot and ask whether there's an association. Look for differences between bars.
- On free response, support "associated" with specific conditional percentages from each group.
Connected topics
Videos
Check yourself
3 questions on 2.1 Tabular and Graphical Representations for the Distributions of Two Categorical Variables. Pick an answer to see if you got it, and why.
A mosaic plot shows the relationship between age group (under 30, 30–59, 60 and over) and whether people prefer reading news online or in print. The bar for the 30–59 group is the widest. What does this tell you?
A segmented bar chart shows the results of a survey of adults in three regions about their main source of electricity at home. In each region's bar, the segment for solar power is about 15% of the bar, the segment for natural gas is about 40%, and the segment for other sources is about 45%. Which conclusion is best supported?
| Grade level | Bus | Car | Walk or bike | Total |
|---|---|---|---|---|
| Grades 9–10 | 90 | 40 | 70 | 200 |
| Grades 11–12 | 50 | 120 | 30 | 200 |
| Total | 140 | 160 | 100 | 400 |
Invented data: how 400 randomly selected students at a high school usually get to school
A segmented bar chart is made with one bar for each grade group, split by the way of getting to school. Which feature of the chart would show the association?
0 of 3 answered