A two-way table counts individuals by two categorical variables at once, and dividing a count by the right total gives a joint, marginal or conditional relative frequency. Two categorical variables are associated when the conditional relative frequencies of one variable differ across the categories of the other. Segmented and mosaic bar charts let you see those differences at a glance.
Quick check
Is "how a student gets to school (walk, bus or car)" a categorical or a quantitative variable?Show answerHide answer
Categorical: it places each student in a group rather than measuring a number.
Of 150 Grade 12 students, 90 ride to school in a car. What proportion of Grade 12 students ride in a car?Show answerHide answer
. This is a conditional relative frequency: the denominator is the Grade 12 total, not the whole table.
Know these already? Jump to the practice questions
What you'll be able to do
- Calculate joint, marginal and conditional relative frequencies from a two-way table.
- Identify which total is the denominator from the wording of a question.
- Interpret side-by-side, segmented and mosaic bar charts.
- Determine whether two categorical variables are associated by comparing conditional relative frequencies, and explain the conclusion in context.
Key terms
Joint relative frequency
A cell count divided by the table total.
- In plain English
- The proportion of everyone in both categories at once.
- Don't write
- "joint" for a proportion out of a row or column total.
Marginal relative frequency
A row or column total divided by the table total.
- In plain English
- The proportion of everyone in one category, ignoring the other variable.
- Don't write
- A marginal value as if it describes one subgroup.
Conditional relative frequency
A cell count divided by the total of its row or its column.
- In plain English
- The proportion within one group: "of the Grade 12 students…".
- Don't write
- A proportion out of the wrong group's total.
Association
Two categorical variables are associated if the conditional distribution of one variable differs across the categories of the other.
- In plain English
- The groups behave differently.
- Don't write
- "associated, so one causes the other".
What are joint and marginal relative frequencies?
This hypothetical table shows how 300 students get to school.
| Walk or bike | Bus | Car | Total | |
|---|---|---|---|---|
| Grade 9 | 30 | 81 | 39 | 150 |
| Grade 12 | 24 | 36 | 90 | 150 |
| Total | 54 | 117 | 129 | 300 |
The totals in the margins give the marginal distributions: for example, the proportion of all students who ride in a car is .
A joint relative frequency uses one cell: the proportion of all 300 students who are in Grade 12 and ride in a car is . Joint and marginal relative frequencies both divide by the grand total.
Check yourself
Show answerHide answer
, a joint relative frequency.
What is a conditional relative frequency?
A conditional relative frequency divides a cell by its row or column total. The words "of the…", "among…" or "given that…" name the group.
- Of the Grade 12 students, the proportion who ride in a car is .
- Of the car riders, the proportion who are in Grade 12 is .
Same cell, different groups, different denominators. One group's full set is its conditional distribution: for Grade 9, 0.20 walk or bike, 0.54 bus and 0.26 car, adding to 1.
Key idea
Find the group named after "of" or "among": its total is the denominator.
Check yourself
Show answerHide answer
. The group is the walk-or-bike column, so its total, 54, is the denominator.
How do bar charts show two categorical variables?
- Side-by-side bar chart: a cluster of bars for each group. Use proportions, not counts, when group sizes differ.
- Segmented bar chart: one bar per group, each of height 1, split into that group's conditional relative frequencies. For the transport table, the Grade 9 bar is split 0.20, 0.54, 0.26 and the Grade 12 bar 0.16, 0.24, 0.60.
- Mosaic plot: a segmented bar chart whose bar widths are proportional to group sizes, so it shows the marginal distribution (widths) and the conditional distributions (segments) at once.
Segments that line up across the bars mean matching conditional distributions; clearly different heights mean association.
Check yourself
Show answerHide answer
Yes. Both grades have 150 students, so their bars are equally wide.
How do you decide whether two variables are associated?
Compare the conditional distribution of the response variable across the groups. Here, compare transport within each grade.
Car use is 0.26 in Grade 9 and 0.60 in Grade 12; bus use is 0.54 against 0.24. The conditional distributions clearly differ, so grade and transport are associated for these students.
If the conditional distributions were the same, there would be no association.
Association is not causation: in a survey, other variables (such as having a driver's license) could explain the pattern.
Examiner's eye
Credit is lost when only one group's proportion is given. Quote a conditional proportion for each group, compare them, and state the association in context.
Check yourself
Show answerHide answer
No. Both conditional proportions equal , so jogging rates are the same for the two groups.
Which method?
| The question says | Denominator |
|---|---|
| "of all those surveyed", "and" (in both categories) | Table total (joint) |
| One category, out of everyone | Table total (marginal) |
| "of the…", "among…", "given that…" | That row or column total (conditional) |
| "Is there an association?" | Compare conditional proportions across groups |
Worked example 1: Choosing the right denominator
Question: A hypothetical survey asked 500 adults their main news source.
| Online | TV | Total | |
|---|---|---|---|
| Age 18–34 | 128 | 32 | 160 |
| Age 35–54 | 117 | 63 | 180 |
| Age 55+ | 56 | 104 | 160 |
| Total | 301 | 199 | 500 |
Find, to four decimal places where needed, the proportion of: (a) all adults who are 55+ and prefer TV; (b) all adults who prefer online; (c) adults aged 18–34 who prefer online; (d) online-news adults who are aged 18–34.
What tells you the method
"all adults" means the table total; "adults aged 18–34" and "online-news adults" name a group whose total is the denominator.
Step 1: Joint and marginal.
(a) . (b) .
WhyBoth are about all 500 adults.
Step 2: Conditional on age.
(c) .
WhyThe group is the 18–34 row, total 160.
Step 3: Conditional on news source.
(d) .
WhyThe group is the Online column, total 301.
Check it
The 18–34 row adds to 1: .
Answer
(a) (b) (c) (d)
Worked example 2: Is there an association?
Question: Hypothetical survey data for 300 students:
| Has a job | No job | Total | |
|---|---|---|---|
| Completed all homework | 42 | 168 | 210 |
| Did not | 38 | 52 | 90 |
| Total | 80 | 220 | 300 |
Is having a job associated with completing all homework for these students? Justify with conditional proportions to four decimal places, and say whether the data show that jobs cause lower completion.
What tells you the method
"associated" means compare conditional proportions of homework completion across the job groups.
Step 1: Conditional proportions.
Job: . No job: .
WhyThe groups differ in size, so each uses its own column total.
Step 2: Compare.
is well below .
WhyDifferent conditional distributions mean the variables are associated.
Step 3: Causation.
This is a survey, so it cannot show that jobs cause lower completion; students with jobs may differ in other ways, such as grade level.
WhyOnly a randomized experiment supports cause and effect.
Check it
Counts would mislead: more students without jobs missed homework (52 against 38), yet their proportion is lower.
Answer
Yes: of students with a job completed all homework, against without one. The survey cannot show that jobs cause lower completion.
Your turn
Question: In a hypothetical survey, 72 of 120 Plan A customers and 48 of 80 Plan B customers were satisfied. Are plan and satisfaction associated?
Step 1:
Plan A: satisfied.
Step 2: Your go: find the proportion of Plan B customers who are satisfied, compare and conclude.
Show the full solutionHide the solution
Plan B: . The conditional proportions are equal (and so are the "not satisfied" proportions, 0.4 each), so knowing the plan does not change the chance of satisfaction.
Answer: No association: the proportion satisfied is for both plans.
Traps
Trap
Dividing by the column total when the question names a row group.
It seems right because the cell is correct. But "of the Grade 12 students" means divide by the Grade 12 total, 150, giving 0.60; the car total, 129, answers a different question.
Check yourself
Show answerHide answer
. The group is the car riders, so their total, 129, is the denominator.
Trap
Comparing counts to judge association when the groups differ in size.
It seems right because a bigger count looks like a stronger effect. But a larger group has larger counts just from its size, so compare conditional proportions.
Check yourself
Show answerHide answer
Group A: against , even though Group B has more "yes" answers.
What's examined
Two-way tables appear on the AP® Statistics exam (Two-variable data), in multiple-choice and free-response questions, with command words such as Calculate, Compare and Justify. Later, a chi-square test decides whether an association in sample data is convincing evidence about a population.
Practice questions
- Recall What type of relative frequency is "the proportion of all students surveyed who are in Grade 9 and walk or bike"?
- A) Marginal
- B) Conditional
- C) Joint
- D) Cumulative
Show answer
Answer: C) Joint
Marking points:
- One cell (Grade 9 and walk or bike) divided by the table total is a joint relative frequency.
- A uses a row or column total as the numerator. B divides by a row or column total. D adds up proportions across ordered categories.
- Apply In a hypothetical survey of 200 adults, 54 of the 120 daily coffee drinkers sleep 7 hours or more and 66 sleep less; of the 80 others, 56 sleep 7 hours or more and 24 sleep less. Find, to four decimal places, the proportion of (a) coffee drinkers who sleep under 7 hours and (b) under-7-hour sleepers who drink coffee daily.
Show answer
Answer: (a) (b)
Marking points:
- (a) The group is coffee drinkers: .
- (b) The group is short sleepers, adults: .
- Apply Using the coffee data in question 2, which comparison best shows whether coffee drinking and sleep are associated?
- A) compared with
- B) compared with
- C) compared with
- D) compared with
Show answer
Answer: A) compared with
Marking points:
- A compares the conditional proportion sleeping 7 hours or more in each group: 0.45 against 0.70.
- B compares counts from groups of different sizes. C compares the marginal totals of one variable. D compares joint proportions, which still depend on group size.
- Exam-style In a hypothetical survey of 250 students, 24 of the 60 who play an instrument named math as their favorite subject, as did 56 of the 190 who do not. (a) Find each group's proportion naming math, to four decimal places. (b) Do these data suggest an association between playing an instrument and naming math? Justify your answer.
Show answer
Answer: (a) Players , non-players . (b) Yes: a higher proportion of players than non-players named math, so the variables are associated for these students.
Marking points:
- and .
- The conclusion compares the two conditional proportions and is stated in context.
- It does not claim that playing an instrument causes a preference for math.
- Recall In a mosaic plot, what does the width of each bar show?
- A) The conditional relative frequency of each segment
- B) The count in each cell
- C) The joint relative frequency of each cell
- D) The proportion of all individuals in that bar's group
Show answer
Answer: D) The proportion of all individuals in that bar's group
Marking points:
- Widths are proportional to group sizes, which is the marginal distribution.
- A is shown by segment heights, not widths. B and C are shown by the areas of the rectangles, not the bar widths.
- Apply Of 120 hypothetical customers at Store A, 66 rated service "Good". Of 300 at Store B, 150 did. Which statement is supported?
- A) Store B has better service, because more customers rated it "Good".
- B) A higher proportion of Store A's customers rated service "Good".
- C) There is no association, because both proportions are about one half.
- D) Shopping at Store A causes higher ratings.
Show answer
Answer: B) A higher proportion of Store A's customers rated service "Good": 0.55 against 0.50.
Marking points:
- and .
- A compares counts from groups of different sizes. C ignores a difference of 0.05 in the proportions. D claims causation from observational data.
- Exam-style In a hypothetical survey of 400 people, 35% are under 30. Of those under 30, 60% prefer texting to calling; of the rest, 25% do. (a) How many people prefer texting? (b) What proportion of texters are under 30? Give four decimal places.
Show answer
Answer: (a) people (b)
Marking points:
- Under 30: , and prefer texting. Others: , and .
- (a) .
- (b) The group is texters: .
Key points
Recall, then reveal
Say the main points from memory first, then check them.
Show key pointsHide key points
- Joint and marginal relative frequencies divide by the table total; conditional ones divide by a row or column total.
- The group after "of" or "among" sets the denominator, so "of the car riders" and "of the Grade 12 students" give different answers from the same cell.
- Segmented bar charts show conditional distributions; mosaic plots also show group sizes through bar widths.
- Variables are associated when conditional distributions differ across groups; compare proportions, not counts.
- Association from a survey does not show cause and effect.