Educerie

Educerie · AP · Statistics

AP Statistics 2.1

Tabular and Graphical Representations for the Distributions of Two Categorical Variables

How do we describe chance and variation, so that a claim about a population can be backed by numbers?

What you will learn

  • Understand that a two-way table summarizes two categorical variables with counts or relative frequencies
  • Know the three displays: side-by-side bar chart, segmented bar chart and mosaic plot
  • Understand that two variables are associated when the distribution of one changes across the levels of the other
  • Know how to justify a claim with figures and in context

You must be able to

  1. Compare percentages within each group to decide whether two variables are associated
  2. Justify a claim from a table or graph using figures and context
  3. Calculate relative frequencies for each group from a two-way table
  4. Read a segmented bar chart scaled to 100%
  5. Explain why counts mislead when group sizes differ
  6. Choose the display that compares groups of different sizes

In the exam. Section I multiple choice often gives a two-way table or a segmented bar chart and asks which statement it supports, or which graph shows a stated relationship. In Section II, a two-way table or a segmented bar graph turns up in the questions on analyzing and interpreting data (Question 2, and parts of Question 4): compare two groups with percentages, then justify a claim in context. The skills tested are 4.A (describe and compare representations) and 4.B (justify a claim from them).

1The two-way table

Example (invented): a school asks 400 students how they usually get to school. The table below gives the count in every combination of grade and travel mode.

WalkBusCarTotal
Grade 10487230150
Grade 123575140250
Total83147170400
  • The row totals (150 and 250) and column totals (83, 147 and 170) sit in the margins. The number in the bottom right corner, 400, is the total for the whole table.
  • Each interior cell is a count of individuals who have both properties. The 140 are students who are in Grade 12 and come by car.
  • Check the arithmetic every time: the row totals must add to the grand total, and so must the column totals. Here 150+250=83+147+170=400150 + 250 = 83 + 147 + 170 = 400.

A table of relative frequencies replaces each count by a proportion. Which total you divide by decides what the table says, and Topic 2.2 sets out the options. For comparing groups, divide each row by its own row total.

2Why counts mislead

Look at the car column. 30 Grade 10 students and 140 Grade 12 students come by car. It is tempting to say that Grade 12 is much more likely to come by car. That may be true, but the counts do not show it, because the grades are different sizes (150 and 250).

To compare groups of different sizes, turn each group's counts into percentages of that group.

Grade 10: 48150=0.32,72150=0.48,30150=0.20each Grade 10 count over the Grade 10 total\text{Grade 10: } \frac{48}{150} = 0.32, \quad \frac{72}{150} = 0.48, \quad \frac{30}{150} = 0.20 \qquad \textcolor{#838c91}{\text{each Grade 10 count over the Grade 10 total}}Grade 12: 35250=0.14,75250=0.30,140250=0.56each Grade 12 count over the Grade 12 total\text{Grade 12: } \frac{35}{250} = 0.14, \quad \frac{75}{250} = 0.30, \quad \frac{140}{250} = 0.56 \qquad \textcolor{#838c91}{\text{each Grade 12 count over the Grade 12 total}}

Each row now adds to 100%. A row of percentages like this is the distribution of travel mode within that grade. Comparing the two rows is comparing two distributions.

  • 56% of Grade 12 students come by car, against 20% of Grade 10 students.
  • 32% of Grade 10 walk, against 14% of Grade 12.

3The graphs

Three graphs display two categorical variables. In every one, the categories of one variable are drawn for each category of the other.

  • Side-by-side (clustered) bar chart. One cluster of bars for each group, one bar for each category. The heights can be counts or relative frequencies. With counts, unequal group sizes distort the picture exactly as in the table.
  • Segmented (stacked) bar chart. One bar for each group, divided into segments, one segment for each category. When each bar is stretched to 100%, the segment heights are relative frequencies and the bars compare directly. This is the display the exam uses most.
  • Mosaic plot. A segmented bar chart in which the width of each bar is also proportional to its group's size. Here Grade 10 would take 150/400=37.5%150 / 400 = 37.5\% of the width and Grade 12 the other 62.5%62.5\%. The area of each rectangle is then the share of all 400 students who are in that cell. The heights carry the same comparison as in the segmented bar chart.

Figure 1 is the segmented bar chart for the travel table.

Figure 1. Segmented bar chart: each bar is one grade and stacks to 100%; the segments show the percentage who walk, take the bus or come by car, and the car segment is much larger for Grade 12 25% 50% 75% 100% 0 percentage of the grade Grade 10 (n = 150) Grade 12 (n = 250) walk 32% bus 48% car 20% walk 14% bus 30% car 56%
Figure 1 · Segmented bar chart of travel mode by grade, with each bar scaled to 100%

Read it from the segment up. The car segment, at the top of each bar, is 20% of the Grade 10 bar and 56% of the Grade 12 bar. The walk segment, at the bottom, is 32% and 14%. Because both bars are stretched to 100%, the two groups can be compared even though one has 100 more students.

4Association

Two categorical variables are associated if the distribution of one variable is different for different categories of the other. Equivalently: knowing a student's grade changes what you would predict about how they travel.

  • Associated: the segments in the bars clearly differ in size. In Figure 1, nobody could claim that grade and travel mode behave the same way.
  • Not associated: the segments are about the same in every bar. If 30% of both groups walked, 40% of both took the bus and 30% of both came by car, knowing the group would tell you nothing about the travel mode.

Two cautions:

  • Samples vary, so a small difference between two percentages can be chance. Whether a difference is too large to be chance is a question for inference, in later units. Here, say what the data show, and avoid saying "proves".
  • Association is not cause. These data show that Grade 12 students are more likely to come by car. They do not show that being in Grade 12 makes someone come by car.

5Justifying a claim

Skill 4.B asks you to support a claim with numbers from the table or graph, in the context of the question. A full answer has three parts:

  1. The comparison, with figures. Give the relative frequencies for each group, and say which is larger.
  2. The conclusion, in context. Use the variables' names and the groups' names.
  3. The reason it follows. The distributions differ, so the variables are associated (or they are about the same, so no association is suggested).

Worked example 1. The school claims that Grade 12 students are more likely than Grade 10 students to come by car. Do the data support the claim?

Yes. In the sample, 56% of the 250 Grade 12 students come by car, compared with 20% of the 150 Grade 10 students. The proportion is much larger for Grade 12, so the data support the claim that grade and travel mode are associated, in the sense that Grade 12 students are more likely to come by car.

Notice what the answer does not do. It does not compare 140 with 30, and it does not say that Grade 12 causes car travel.

Worked example 2 (a graph that misleads). Imagine a side-by-side bar chart of the same data with the heights as counts. The two "bus" bars are 72 and 75, almost level. A student reading it might say "about the same number of each grade take the bus, so the grades are alike". That is wrong, because 72 of 150 is 48% and 75 of 250 is 30%. Whenever group sizes differ, compare percentages within each group.

Worked example 3 (which graph?). A teacher wants to show, in one picture, how the percentage of students in each travel mode changes between two grades of different sizes. A segmented bar chart of relative frequencies, one bar for each grade, does it: both bars total 100% and the segments compare directly.

Practice questions

30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.