AP Statistics · Unit 2 · Probability, Random Variables and Probability Distributions
2.1 Two categorical variables: tables and graphs
Organize data for two categorical variables in a two-way table, interpret its values, and describe a relationship by comparing percentages.
1/5A two-way table sorts each unit by two categorical variables
- A two-way table sorts each unit by two categorical variables
- Totals around the edges describe each variable alone
- Each value must be read with both of its categories
- Comparing percentages within groups reveals a relationship
- A segmented bar chart shows the same comparison visually
- Check your recall
- Practice: 10 questions
Part 1 of 5: A two-way table sorts each unit by two categorical variables
A school asks 200 students how they get to school and which grade level they are in. Each student gives two answers. One table can show both answers together.
A two-way table lists the categories of one variable in rows and the categories of another in columns. Each cell holds a joint frequency, the number of units in that pair of categories. Every unit belongs in exactly one cell. To build the table:
- List the categories of one variable down the side.
- List the categories of the other variable across the top.
- Tally each unit into the one cell that matches both answers.
- Add the row totals and the column totals.
Key terms · tap one for its definition
two-way table
A two-way table is a table of counts that classifies each unit by the categories of two categorical variables.
joint frequency
A joint frequency is the count of units in one particular pair of categories, found in a single cell.
Part 2 of 5: Totals around the edges describe each variable alone
Now look at the edges of the finished table. The row totals and column totals sit in the margins. Each one is a marginal frequency, the total count for one category of a single variable.
Travel to school by grade level (number of students)
- Grade level
- Underclass
- Bus
- 66
- Not bus
- 54
- Total
- 120
- Grade level
- Upperclass
- Bus
- 20
- Not bus
- 60
- Total
- 80
- Grade level
- Total
- Bus
- 86
- Not bus
- 114
- Total
- 200
The count in the bottom-right corner is the grand total. It is the number of all units in the table. Here, 200 students were surveyed, and 86 of them ride the bus. Marginal frequencies describe each variable alone. For example, 120 students are underclass, and 114 students do not ride the bus.
Key terms · tap one for its definition
marginal frequency
A marginal frequency is the total count for one category of a single variable, found in a row total or column total.
grand total
The grand total is the count of all units in a two-way table, which equals the sum of all cell counts.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: C · Worked explanation
Part 3 of 5: Each value must be read with both of its categories
A number in the table means little until you name its row and column. Here are four readings of the table above.
- The cell 66 means that 66 underclass students ride the bus.
- The row total 80 means that 80 upperclass students were surveyed.
- The column total 114 means that 114 students do not ride the bus.
- The grand total 200 means that the survey included 200 students.
Counts depend on group size, so they can mislead. To compare fairly, convert a count to a relative frequency, a count divided by a total.
Worked example
Finding a relative frequency
- Word equation: relative frequency = cell count divided by grand total.
- Substitute the cell count 20 and the grand total 200: .
- Calculate: , which is 10%.
Answer: 10% of all students surveyed are upperclass students who ride the bus.
Key term
relative frequency
A relative frequency is a count divided by a total, written as a proportion or a percent.
Part 4 of 5: Comparing percentages within groups reveals a relationship
To compare the two grade levels fairly, find a percent within each row. Divide each cell by its own row total. Of 120 underclass students, 66 ride the bus, which is 55%. Of 80 upperclass students, 20 ride the bus, which is 25%.
Percent within each grade level
- Grade level
- Underclass
- Bus
- 55%
- Not bus
- 45%
- Grade level
- Upperclass
- Bus
- 25%
- Not bus
- 75%
The two grade levels have different percents. When the distribution of one variable differs across the categories of the other, the variables have an association. Here, bus riding is more common among underclass students. If the percents were nearly equal, the table would show little or no association.
Key term
association
An association exists between two variables when the distribution of one variable differs across the categories of the other.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: A · Worked explanation
Part 5 of 5: A segmented bar chart shows the same comparison visually
A table of percents is accurate, but a picture makes the pattern quick to see. A segmented bar chart draws one bar for each group. Each bar is divided into segments showing the percent in each category of the other variable.
Every bar has the same total height of 100%. Different segment sizes in the bars point to an association. Look for segments that change size from one bar to the next. A side-by-side bar chart instead places separate bars next to each other, grouped by the other variable.
Key terms · tap one for its definition
segmented bar chart
A segmented bar chart is a graph with one bar per group, in which segments show the percent of each category within that group.
side-by-side bar chart
A side-by-side bar chart is a graph that places separate bars next to each other to compare categories across groups.
Check your recall[13 marks]
6 written questions. Answer each one in your head or on paper, then open the mark scheme.
- 1.Identify[1 mark]
Identify the name for the totals found along the right edge and bottom edge of a two-way table.
Show mark schemeHide mark scheme
Model answer
They are marginal frequencies.
- 1 mark for naming them marginal frequencies
- 2.Calculate[2 marks]
A two-way table of 250 people shows 45 people who are both left-handed and under 30. Calculate the percent of all people who are left-handed and under 30.
Show mark schemeHide mark scheme
Model answer
Relative frequency = cell count divided by grand total = , so 18%.
- 1 mark for dividing the cell count 45 by the grand total 250
- 1 mark for giving the answer 18%
- 3.Explain[2 marks]
Explain why comparing raw counts can mislead when the groups have different sizes.
Show mark schemeHide mark scheme
Model answer
A larger group can have a larger count even when a smaller percent of its members are in the category. Percents within each group adjust for group size and allow a fair comparison.
- 1 mark for stating that a larger group can produce a larger count without a larger percent
- 1 mark for explaining that percents within each group adjust for group size
- 4.Describe[3 marks]
Describe how to build a segmented bar chart from a two-way table.
Show mark schemeHide mark scheme
Model answer
Draw one bar for each category of the variable that defines the groups. Convert each group’s counts to percents of that group’s total. Divide each bar into segments for the other variable’s categories so that every bar totals 100%.
- 1 mark for drawing one bar for each group
- 1 mark for converting each group’s counts to percents of that group’s total
- 1 mark for dividing each bar into segments so that every bar totals 100%
- 5.Justify[3 marks]
Club A has 150 members, and 60 prefer tea. Club B has 50 members, and 30 prefer tea. Justify whether club and drink preference show an association.
Show mark schemeHide mark scheme
Model answer
In club A, prefer tea. In club B, prefer tea. The percents differ, so the distribution of preference differs between the clubs, and the variables show an association.
- 1 mark for finding 40% for club A
- 1 mark for finding 60% for club B
- 1 mark for concluding that the distributions differ, so there is an association
- 6.Describe[2 marks]
Describe what it means for two categorical variables to have an association.
Show mark schemeHide mark scheme
Model answer
The distribution of one variable differs across the categories of the other variable. For example, the percent in a category changes from group to group.
- 1 mark for stating that the distribution of one variable differs across categories of the other
- 1 mark for giving a correct example or description of percents changing between groups

Practice this topic
10 quick-fire multiple-choice questions, easy to hard. Tap an answer to see if you're right and the worked explanation. (The written questions with mark schemes are under “Check your recall” above.)
0 right0 of 10 answered
Includes the 2 quick checks in the note above.
EasyIdentify[1 mark]
Show answer and explanation
Answer: B · Worked explanation
MediumCalculate[2 marks]
Show answer and explanation
Answer: D · Worked explanation
MediumDetermine[2 marks]
Show answer and explanation
Answer: A · Worked explanation
MediumCalculate[2 marks]
Show answer and explanation
Answer: B · Worked explanation
MediumIdentify[2 marks]
Show answer and explanation
Answer: C · Worked explanation
HardDetermine[2 marks]
Show answer and explanation
Answer: D · Worked explanation
HardInterpret[2 marks]
Show answer and explanation
Answer: B · Worked explanation
HardDetermine[2 marks]
Show answer and explanation
Answer: A · Worked explanation