Summary Statistics for Two Categorical Variables
The same students can represent , or . Learn why the reference group changes the answer, calculate joint, marginal and conditional relative frequencies, and use them to compare groups fairly.
By the end of this lesson, you should be able to:
- Choose the correct numerator and denominator for a question about a two-way table.
- Calculate and interpret joint, marginal and conditional relative frequencies.
- Build a conditional distribution using either row totals or column totals.
- Compare distributions for evidence of association.
- Support a claim with labeled percentages and a conclusion that fits the study.
Before you start: Know how to read a cell, a row total, a column total and the grand total. Review Topic 2.1: Tables and Graphs for Two Categorical Variables if needed.
First time learning this? Follow the school travel example. Say “out of whom?” before every division.
Here to revise? Use the denominator checklist, then try the practice questions before opening the solutions.
The concept in 60 seconds
A relative frequency tells us what fraction of a specified group belongs to a category or combination of categories. It is a count divided by the total for that reference group. Write the answer as a proportion, decimal or percentage.
With two categorical variables, the important step is choosing that group. Are we looking at everyone, or only at observations in one category?
Ask this first: “Who is included in the denominator?” The numerator counts the observations of interest inside that group.
are Grade 9 and walk.
of Grade 9 students walk.
of walkers are Grade 9.
. Panels rearrange the same highlighted individuals schematically; the lighter dots show the rest of each reference group.
The highlighted students are the same in all three panels. The answers change because the reference group changes. A correct answer needs both a number and words that identify the group.
Quick check: why is different from ?
describes Grade 9 walkers as a share of all participating students. describes walkers as a share of Grade 9 students only. Neither is automatically wrong; each answers a different question.
One table, different questions
Continue the original fictional school example from Topic 2.1. The school records each of participating students’ grade level and . There are Grade 9 students and Grade 10 students.
| Grade level | Bus | Walk | Car ride | Row total |
|---|---|---|---|---|
| Grade 9 | ||||
| Grade 10 | ||||
| Column total |
Each student is counted in . The margins give totals for one variable at a time; the bottom-right entry is the grand total. The two variables are grade level and main travel mode. Here, 9 and 10 identify categories rather than measured amounts.
Both labels
“What proportion of all students are Grade 9 and walk?”
Use the Grade 9–Walk cell, , and all students.
One label overall
“What proportion of all students walk?”
Combine walkers from both grades: . Use all students.
Travel within a grade
“Among Grade 9 students, what proportion walk?”
Use walkers out of the Grade 9 students.
Grade within a travel mode
“Among walkers, what proportion are in Grade 9?”
Use Grade 9 students out of the walkers.
All four questions use the same observations. Reading the question carefully determines whether you need an interior cell, a margin or a restricted-group total.
Joint, marginal or conditional?
Joint relative frequency
The share of all observations with a specific combination of categories from both variables.
Grade 9 and Walk: .
Marginal relative frequency
The share of all observations in one category of one variable, combining across the other variable.
Walk overall: .
Conditional relative frequency
The share in a category after restricting attention to a specified group.
Walk among Grade 9: . Grade 9 among walkers: .
The group named as “out of” or “within” gives the denominator. Decide what the sentence asks, then choose the corresponding total.
Use meaning, not just a keyword
“Among,” “of the Grade 9 students,” and “given that the student walks” all suggest a restricted group. But a word alone is not a complete rule. “Among all students, how many are Grade 9 and walk?” still uses the grand total.
- Write the reference group in words.
- Find its total; this is the denominator.
- Count the observations of interest within that group; this is the numerator.
- Divide. Multiply by if a percentage is requested.
- Interpret the result using the same reference group.
Number formats: , and describe the same relative frequency. A proportion is between and ; a percentage is between and . The denominator must be positive.
Keep a fraction or extra decimal places during calculation. Round at the end to a sensible precision, such as for . Rounding can make displayed percentages total or ; that alone does not invalidate a distribution.
Joint and marginal summaries
To build a joint relative frequency table, divide every interior cell count by the grand total. Every interior percentage uses the same denominator, .
| Grade level | Bus | Walk | Car ride | Row share |
|---|---|---|---|---|
| Grade 9 | ||||
| Grade 10 | ||||
| Column total |
Highlighted: are Grade 9 walkers. Across both grades, the Walk margin is .
The add to : . They describe covering all participating students. The Grade 9 row adds to , because Grade 9 accounts for of the students. It does not add to in this whole-table display.
Find a marginal distribution
A distribution lists the categories of a variable and their relative frequencies. The marginal distribution of travel mode is Bus, Walk and Car ride. It combines across grade level. The marginal distribution of grade is Grade 9 and Grade 10.
You can calculate a margin directly from counts or add the joint shares for the cells in that margin. For example, the overall Walk share is , and also .
Check one distribution at a time: travel-mode marginal shares sum to . Grade marginal shares also sum to . Adding both sets together gives , because each student has both a grade and a travel mode.
What an overall percentage can hide
The overall Car ride share does not tell us how travel differs by grade. Grade 9 has car riders, while Grade 10 has . Use conditional distributions to investigate those differences.
of all students belong to this grade.
of all students belong to this grade.
Combine car riders and students.
Weighted check: .
The larger grade contributes more individuals. A simple average, , does not describe the combined students here.
The combined percentage gives each individual equal weight. A simple average of group percentages gives each group equal weight instead, which is inappropriate for the combined student percentage when group sizes differ. If the groups are the same size, those two averages coincide.
Conditional distributions: row or column?
A conditional distribution gives all category shares of one variable within a fixed category of the other. For travel mode within Grade 9, divide each Grade 9 cell by . For travel mode within Grade 10, divide each Grade 10 cell by .
| Reference group | Bus | Walk | Car ride | Total |
|---|---|---|---|---|
| Grade 9 () | ||||
| Grade 10 () |
Each row sums to because each full row is now its own reference group. We have , one for each grade. Adding their percentages down a column has no required total: those percentages describe different groups.
Condition on travel mode instead
To describe grade level among bus riders, restrict to the bus riders: are Grade 9 and are Grade 10. Repeat with the Walk total, , and Car ride total, .
| Grade level | Bus () | Walk () | Car ride () |
|---|---|---|---|
| Grade 9 | |||
| Grade 10 | |||
| Column total |
Each column sums to approximately . This table answers “Which grades are represented within each travel mode?” It answers a different question from the row-conditional table.
All Grade 9 students represent .
All walkers represent .
Each full track is of its named reference group. The same students fill different fractions of those groups.
Rows are not always the denominator. If the table is transposed, Grade 9 becomes a column but the group still contains students. The group named in the question determines the denominator; the table’s orientation determines where you find it.
Read the percentage, including its labels
“ walk” is incomplete here. “Of the participating Grade 9 students, walk” identifies the group, the category and the proportion. Likewise, “Of the walkers, are in Grade 9” states the reverse conditional comparison correctly.
Why can a conditional percentage be larger than its joint percentage?
The same cell can be divided by a smaller reference group. Grade 9 walkers are of all students but of Grade 9 students. In this example, Grade 9 makes up of all students, and . This checks how the group share and its within-group share combine.
Compare distributions for association
Two categorical variables show an association in the observed data when the distribution of one variable differs across categories of the other. Here, compare travel-mode percentages within grades. Use the same travel category in each comparison and each grade’s own total.
Both full bars equal of their own grade. Different segment proportions show different conditional distributions; bar lengths do not represent group counts.
For example, Car ride is in Grade 9 and in Grade 10. That is a difference of percentage points. Walk shares also differ, versus , even though both grades contain walkers. The conditional patterns show an association between grade and travel mode in these data.
What would a matching pattern look like?
In a separate fictional yes/no table, Group A has Yes and No, while Group B has Yes and No. Both conditional distributions are Yes and No. The counts differ because the group sizes differ; the observed category patterns match.
Checking just one matching category is not enough when there are . be Red but differ for Blue and Green. To claim that the full distributions match, examine every category.
Keep the conclusion within reach of the evidence
A table can describe an observed association. It does not itself establish a causal effect or a statistically significant population association. To generalize beyond the participants, consider how they were selected; to justify a causal claim, consider whether treatments were randomly assigned in a suitable experiment.
A useful conclusion: “Among these participating students, the car-rider share is for Grade 9 and for Grade 10. The travel distributions differ by grade, showing an association in these data.”
Six worked examples
Example 1: three questions, three summaries
Question: Find the share of all students who are Grade 9 and walk, the share who walk overall, and the share who walk among Grade 9.
- Joint: both labels, whole-table denominator. .
- Marginal: combine walkers from both grades. .
- Conditional: restrict to Grade 9. .
Interpretation: of all participating students are Grade 9 walkers; of all participants walk; of Grade 9 participants walk. The different statements explain the different answers.
Example 2: reverse the conditional question
Question: Among walkers, what percentage are in Grade 9?
- The reference group is walkers, with total .
- Within that group, are in Grade 9.
- .
Interpretation: are in Grade 9. Dividing by would answer the other question: the share of Grade 9 students who walk.
Example 3: build and check a joint table
Question: Convert the Grade 10 row to whole-table percentages and explain its total.
- Bus: . Walk: . Car ride: .
- The row adds to .
- This equals the marginal Grade 10 share, .
Why the row is not : the denominator is all students, not the Grade 10 students. A conditional Grade 10 row would instead be , , , totaling .
Example 4: use a column total
Question: Describe the grade distribution among car riders, to .
- There are car riders.
- Grade 9: .
- Grade 10: .
Interpretation: About of participating car riders are Grade 9, and are Grade 10. Those shares sum to . They do not say that of Grade 10 students ride in cars; that reverse conditional share is .
Example 5: justify an association claim
Question: A student says, “The grades have the same travel pattern because both have walkers.” Assess the claim.
- Compare the same category using each grade’s own total: walk in Grade 9; walk in Grade 10.
- The equal counts correspond to different shares, a gap of percentage points.
- Car shares differ too: , versus .
Conclusion: the claim is not supported. Travel-mode distributions differ across grades in the observed data. This establishes a descriptive association among participants, not that grade level causes a travel choice.
Example 6: combine unequal groups correctly
Question: A student averages the car-rider percentages, , to find the overall share. Is that valid?
- The groups have unequal sizes: Grade 9 has students and Grade 10 has .
- Combine counts first: .
- Equivalently, weight the percentages by the group shares: .
Explanation: Grade 10 contributes more students, so its car-rider rate gets more weight. The simple average describes an equal weighting of grades, not the overall share of these students.
Explain in context
A strong statistical explanation identifies what was counted, who was included, and what the comparison shows. A decimal by itself does not answer a question about students, customers or survey respondents.
“Of the participating Grade 9 students, walk to school.”
The reference group is Grade 9; the category is Walk; the number is .
“The walking share is in Grade 9 and in Grade 10, a difference of percentage points. These different travel distributions show an association among participants.”
Percentage points or percent change?
Going from to is an increase of percentage points, calculated as . The relative percentage increase is . The baseline matters for percent change. In a straightforward comparison of two conditional percentages, reporting the percentage-point gap is usually clearer.
Use “approximately” when rounding. A calculator can help with division, but the crucial work happens before typing: choosing the group total and matching the numerator to that group. No special calculator command is needed for this lesson.
Improve this answer: “There is a relationship because is bigger.”
The statement does not identify the comparison, and both walker counts are . A better answer is: “Among participating students, of Grade 9 students walk, compared with of Grade 10 students. The conditional walking shares differ, so grade and travel mode are associated in these data.”
Find and fix common mistakes
| Mistake | Why it fails | Better approach |
|---|---|---|
| Divide every answer by . | Conditional questions restrict the group. | Use for “among Grade 9” and for “among walkers.” |
| Use a row total whenever a cell is in a row. | The question may condition on a column category. | Name the reference group before looking for its total. |
| Treat the two conditional directions as interchangeable. | They usually use different denominators. | Walk among Grade 9 is ; Grade 9 among walkers is . |
| Use a cell count for a marginal numerator. | A marginal summary combines over the other variable. | Walk overall uses , not only the Grade 9 walkers, . |
| Require each joint-table row to total . | Joint percentages use the whole-table denominator. | All interior joint cells sum to ; a row sums to its marginal share. |
| Add row and column marginal shares together. | That counts the same individuals across both variables. | Check each variable’s marginal distribution separately. |
| Compare counts to assess patterns in unequal groups. | A larger group can have more individuals but a smaller category share. | Compare conditional percentages using each group’s own size. |
| Average group percentages without checking group sizes. | Equal group weights may not represent the individuals. | Combine counts and totals; here the overall car share is . |
| Say “ higher” for versus . | This confuses percentage-point and relative changes. | Say “ percentage points higher.” |
| Claim causation or population independence from the table alone. | An observed pattern does not supply study-design or inference evidence. | Describe the association, or matching distributions, in these data. |
Practice with hints and solutions
Write the reference group before calculating. Questions 1–3 use the school travel table. Later questions introduce separate fictional data sets. Keep an exact fraction until the final rounding.
1. Identify the type of summary
Classify each question as joint, marginal or conditional, then answer it: (a) What share of all students are Grade 10 and ride in cars? (b) What share are Grade 10 overall? (c) Among Grade 10 students, what share ride in cars?
Hint for question 1
Two labels with an all-students denominator means joint. One overall label means marginal. A restricted Grade 10 group means conditional.
Solution to question 1
(a) Joint: of all participants are Grade 10 car riders. (b) Marginal: are Grade 10. (c) Conditional: of Grade 10 participants ride in cars.
2. Keep the category, change the reference group
Calculate (a) the joint share for Grade 10 and Bus, (b) the overall Bus share and (c) the Bus share within Grade 10. Interpret each percentage.
Hint for question 2
The relevant counts are Grade 10 bus riders, bus riders overall and Grade 10 students.
Solution to question 2
(a) of all participants are Grade 10 bus riders. (b) of all participants ride the bus. (c) of Grade 10 participants ride the bus. The three statements identify the three denominators correctly.
3. Reverse the conditional statement
A student calculates and writes, “ of Grade 10 students ride in cars.” Correct the interpretation, then calculate the percentage that the student’s sentence actually asks for.
Hint for question 3
What group has total ? What group has total ?
Solution to question 3
means that about of participating car riders are in Grade 10. The share of Grade 10 students who ride in cars is . The cell count is unchanged, but the reference group changes.
4. Analyze a new table
A café records from each of respondents.
| Visit time | Tea | Coffee | Total |
|---|---|---|---|
| Morning | |||
| Afternoon | |||
| Total |
Find (a) the marginal Coffee share, (b) the joint Afternoon–Coffee share, (c) the conditional Coffee share among Afternoon respondents, and (d) evidence for an association between visit time and drink preference.
Hint for question 4
Use the grand total for (a) and (b), the Afternoon total for (c), and matching within-time shares for (d).
Solution to question 4
(a) prefer Coffee overall. (b) are Afternoon respondents who prefer Coffee. (c) of Afternoon respondents prefer Coffee. (d) Morning Coffee is , versus Afternoon Coffee at , a percentage-point gap. The conditional preferences differ, showing an association among these respondents. This does not establish that visit time causes drink preference.
5. Recover counts from conditional percentages
Group A contains survey respondents, of whom answer Yes. Group B contains respondents, of whom answer Yes. Find both Yes counts, the joint A–Yes share and the overall Yes share. Then find the share of Yes respondents who belong to A, to .
Hint for question 5
Multiply each within-group percentage by its own group size. Combine the resulting Yes counts before calculating the overall or reverse conditional shares.
Solution to question 5
A Yes: ; B Yes: . There are Yes respondents out of . The joint A–Yes share is . The overall Yes share is . Among Yes respondents, the A share is . It is not , which conditions on A rather than Yes.
6. Check the normalization
Which statement is correct? Explain why the others are not.
- Each row of a joint relative frequency table must sum to .
- In a row-conditional table, each row sums to when its row total is positive.
- The row and column marginal distributions together must sum to .
- A column-conditional table must have every row sum to .
Hint for question 6
For each type of table, identify the group that has been set to .
Solution to question 6
B is correct. A row-conditional distribution divides each row’s cells by that row’s positive total. A is false: all interior joint cells together sum to ; an individual row sums to its marginal share. C is false: each variable’s marginal distribution separately sums to , so the two sets together sum to . D is false: column-conditional distributions sum to down each column, not necessarily across rows.
7. One matching category is not the whole distribution
Group A’s color preference is Red, Blue and Green. Group B’s is Red, Blue and Green. Does the equal Red share show that group and preference have no observed association?
Hint for question 7
Compare the complete distributions, including Blue and Green.
Solution to question 7
No. Red matches, but Blue is in A and in B; Green is in A and in B. The conditional distributions differ, showing an association in the observed data. Matching a single category does not imply matching all categories.
8. Zero count or zero denominator?
Group C has people, with . Group D has . Find the Yes share within each group and explain the difference.
Hint for question 8
with a positive denominator is valid. is not.
Solution to question 8
C: Yes. D: is undefined; there is no observed group on which to base a conditional distribution. Report that there are , rather than assigning it a Yes rate.
9. Combine different-sized classes
Class A has respondents, of whom prefer online revision. Class B has respondents, of whom prefer online revision. Find each class’s conditional share and the combined marginal share. Explain why averaging the two class percentages is misleading here.
Hint for question 9
The combined reference group contains respondents. A and B contribute different numbers of people.
Solution to question 9
A: . B: . Combined: . The simple average gives each class equal weight. For the combined respondents, A supplies and B , so .
10. Justify a matching-pattern conclusion
In a new survey, Group A has Yes and No responses. Group B has Yes and No responses. A student says the different Yes counts prove an association. Write a response using conditional distributions, and explain what you can conclude.
Hint for question 10
The group totals are and . Compare proportions, not just the counts and .
Solution to question 10
A: Yes and No. B: Yes and No. The full conditional distributions match, so this table shows no observed association between group and response. The unequal counts reflect unequal group sizes. The sample table alone does not prove that the variables are independent in the population.
Quick revision
Questions students often ask
Are marginal and conditional distributions the same?
No. A marginal travel distribution combines all grades and uses as the denominator. A conditional travel distribution restricts to one grade and uses that grade’s total. They may happen to have matching percentages in some data sets, but they describe different reference groups.
How do I decide between row percentages and column percentages?
Name the conditioning category in words. If it is Grade 9 in the school table, use its row total, . If it is Walk, use its column total, . Transposing the table changes the location of the total, not the reference group.
Why do rounded percentages sometimes miss slightly?
Rounding each value separately can accumulate a small difference. Use the original counts or unrounded proportions to check the distribution. Keep the requested precision consistent and explain a rounding discrepancy if it matters.
Does a different conditional percentage prove causation?
No. Different conditional distributions describe an association in the observed data. A causal conclusion needs supporting study design, and population conclusions need appropriate sampling and inference. A two-way table alone supplies neither.
Final understanding check
A fictional school surveys students about their preferred revision format. Each student selects . The are Junior and Senior.
| Grade group | Video | Audio | Total | |
|---|---|---|---|---|
| Junior | ||||
| Senior | ||||
| Total |
- Name the observational unit and both categorical variables.
- Find the joint relative frequency for Junior and Video.
- Find the marginal Video relative frequency.
- Find the conditional Video share among Junior students.
- Find the conditional Junior share among Video students, to .
- Write the complete format distribution within each grade group. Use matching evidence to assess association.
- Find the overall Print share. Explain why averaging the two groups’ Print percentages does not give that share.
- Assess “Being a Senior student causes a preference for Print.”
Reveal the full solution
1. The unit is . The variables are grade group, Junior or Senior, and preferred revision format, Print, Video or Audio.
2. Joint: of all respondents are Junior students who prefer Video.
3. Marginal: of all respondents prefer Video.
4. Conditional on Junior: of Junior respondents prefer Video.
5. Conditional on Video: of Video-preferring respondents are Junior students.
6. Distributions: Junior: Print, Video, Audio. Senior: Print, Video, Audio. The Print share is percentage points higher for Senior, and Video shares also differ. The conditional distributions show an association between grade group and preferred format among respondents. The matching Audio share does not undo the differences.
7. Combined Print: . The groups have and students, giving weights and . The weighted result is . The simple average, , weights groups equally despite their unequal sizes.
8. Causation: the school observed preferences rather than randomly assigning a treatment. Other differences between students may explain the association. Describe the observed relationship; these survey results alone do not establish causation or justify a claim about every student.
Ready to move on? You should be able to name the reference group, choose and calculate a relative frequency, interpret it in context, and justify a comparison using matching conditional percentages.
Continue learning
Topic 2.3: Estimating Probabilities Using Simulation →
Use repeated trials of a random process to estimate a probability and understand how relative frequencies behave over many trials.
Previous: Topic 2.1 — Tables and Graphs for Two Categorical Variables · Review denominator choice · Retry the practice · Back to the lesson overview