Skip to main content

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:

GradePlays a sportNo sportTotal
Freshman7248120
Senior285280
Total100100200

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.

  1. 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 solution
    1. Step 1: Compare across grades, so compute percentages within each grade.
    2. Step 2: Freshmen: 72/120 = 0.60 play a sport and 48/120 = 0.40 don't.
    3. Step 3: Seniors: 28/80 = 0.35 play a sport and 52/80 = 0.65 don't.
    4. Step 4: Draw one 100% bar per grade with a "sport" segment of 60% for freshmen and 35% for seniors.
    5. 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.

  2. 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 solution
    1. Step 1: 48 and 52 are counts, but the grades have different totals: 120 freshmen and 80 seniors.
    2. Step 2: As proportions: 48/120 = 0.40 of freshmen and 52/80 = 0.65 of seniors don't play.
    3. 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

  • AP Statistics Topic 2.1: Tabular and Graphical Representations for Two Categorical Variables

    Michael Porinchak - AP Statistics & AP PrecalculusWatch on YouTube (opens in a new tab)

  • AP Stats 2.A.1.vA - Describing Two Categorical Variables

    Skew The ScriptWatch on YouTube (opens in a new tab)

  • AP Statistics Unit 2 | Graphing Two Categorical Variables | CED 2.1 | Guided Notes

    Goldie's Math EmporiumWatch on YouTube (opens in a new tab)

  • AP Statistics– 2.1 Tabular & Graphical Representation for Distributions of Two Categorical Variables

    The AlgebrosWatch on YouTube (opens in a new tab)

  • Mosaic plots and segmented bar charts | Exploring two-variable data | AP Statistics | Khan Academy

    Khan AcademyWatch on YouTube (opens in a new tab)

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.

Question 1 of 3Calculator allowed

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?

Question 2 of 3Calculator allowed

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 levelBusCarWalk or bikeTotal
Grades 9–10904070200
Grades 11–125012030200
Total140160100400

Invented data: how 400 randomly selected students at a high school usually get to school

Question 3 of 3Calculator allowed

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