# Tabular and Graphical Representations for the Distributions of Two Categorical Variables

> AP Statistics · AP Stats 2024-2026
> Source: https://www.owlsprep.com/study/ap-statistics-u11-tabular-and-graphical-representations-for/

This module covers two-way contingency table construction, calculation of all relative frequency types, creation of segmented bar charts and mosaic plots, and interpretation of displays to detect associations between two categorical variables.

**Prerequisites:** [Basic definitions of categorical and quantitative variables](https://www.owlsprep.com/study/ap-statistics-u1-intro-to-variable-types/); [Calculation of one-variable relative frequency distributions](https://www.owlsprep.com/study/ap-statistics-u2-graphical-representations-for-categorical-data/)

## Learning objectives

- Construct two-way contingency tables for paired bivariate categorical data
- Calculate marginal, joint, and conditional relative frequencies from tabulated data
- Produce properly labeled segmented bar charts and mosaic plots for two categorical variables
- Interpret visual and tabular outputs to identify statistically meaningful associations between variables

## Two-Way Contingency Table Fundamentals

A two-way contingency table organizes paired categorical data by listing levels of the explanatory variable as rows and levels of the response variable as columns, or vice versa. The final row and column of the table store marginal totals, which sum all counts across the opposite axis.

**Contingency Table** — A tabular structure that records the raw number of observations for every possible combination of levels from two categorical variables, plus total counts for each individual variable level.

*Example:* A table tracking 200 student survey responses, with rows for grade level and columns for preferred lunch option.

$$\text{Grand Total} = \sum_{i=1}^{r} \sum_{j=1}^{c} n_{ij}$$

**Worked example:** Construct a contingency table for 150 survey respondents: 80 urban residents, 70 rural residents. 55 urban residents support a new public transit line, 25 oppose it. 30 rural residents support the line, 40 oppose it.

1. Define rows as residence location, columns as transit opinion
2. Fill in joint counts: Urban/Support = 55, Urban/Oppose = 25, Rural/Support = 30, Rural/Oppose = 40
3. Calculate marginal totals: Urban total = 80, Rural total =70, Support total=85, Oppose total=65
4. Verify grand total = 80 +70 = 150, matching the total sample size

**Check your understanding**

Test your understanding of table structure:

1. What is the marginal total for respondents who oppose the transit line?

   - 65
   - 70
   - 80
   - 85

   *Why:* Sum the 25 urban oppose and 40 rural oppose counts to get 65 total opponents.

> **Exam tip:** AP rubrics award 1 full point for correctly verifying that marginal totals sum to the stated sample size, so always perform this check before proceeding to calculations.

## Calculating Marginal, Joint, and Conditional Relative Frequencies

Three distinct relative frequency measures are derived from contingency tables, each answering a different statistical question. Mixing up these denominators is the single most common source of lost points on AP exam free response questions.

| Frequency Type | Denominator | Interpretation |
| --- | --- | --- |
| Joint | Full grand total sample size | Proportion of all observations in that exact category pair |
| Marginal | Full grand total sample size | Proportion of all observations in a single level of one variable |
| Conditional | Marginal total of the conditioning subgroup | Proportion of the subgroup that falls in a specific response level |

**Worked example:** Using the transit survey contingency table from the prior example, calculate the conditional relative frequency of supporting the transit line for rural residents.

1. Identify the conditioning subgroup: rural residents, with marginal total of 70
2. Extract the joint count for rural residents who support the line: 30
3. $$\text{Conditional Relative Frequency} = \frac{30}{70} \approx 0.429, \text{ or } 42.9\%$$
4. Interpretation: 42.9% of rural survey respondents support the new public transit line.

**Exam command terms**

AP exam questions use specific command terms for frequency calculations:

- **Calculate the proportion of all respondents** — Requires a joint or marginal relative frequency, denominator = grand total

- **Calculate the proportion of respondents who are [subgroup]** — Requires a conditional relative frequency, denominator = subgroup marginal total

## Segmented Bar Charts for Two Categorical Variables

Segmented (or stacked) 100% bar charts are the most commonly tested graphical display for two categorical variables on the AP exam. Each bar represents a level of the explanatory variable, and all bars are standardized to a total height of 100%.

**100% Segmented Bar Chart** — A set of equal-height bars where each bar is split into colored segments proportional to the conditional relative frequency of the response variable for that group.

*Example:* Two bars for urban and rural residents, each split into blue (support) and red (oppose) segments.

**Worked example:** Draw a segmented bar chart for the transit survey data, using support/oppose as the response variable.

1. Set x-axis labels to "Urban" and "Rural", set y-axis to 0% to 100% relative frequency
2. For the urban bar: support segment height = 55/80 = 68.75%, oppose segment height = 31.25%
3. For the rural bar: support segment height = 30/70 ≈ 42.9%, oppose segment height ≈ 57.1%
4. Add a clear legend mapping colors to support and oppose categories

> **Sketch Tip**
>
> If you are asked to sketch a segmented bar chart on the exam, you do not need perfectly precise heights, but the relative sizes of segments must be clearly distinguishable to the grader.

## Mosaic Plots and Association Detection

Mosaic plots extend segmented bar charts by making the width of each bar proportional to the marginal size of the explanatory variable subgroup, rather than keeping all bars equal width. This lets you visualize both joint and conditional distributions in a single display.

**Comparing methods**

Compare the two standard graphical displays for two categorical variables:

- **100% Segmented Bar Chart** — Equal bar width, height split by conditional frequency
  - Pros: Easy to compare conditional distributions directly
  - Cons: Does not show relative size of subgroups

- **Mosaic Plot** — Bar width proportional to subgroup size, height split by conditional frequency
  - Pros: Shows joint, marginal, and conditional distributions at once
  - Cons: Harder to draw accurately by hand

**Worked example:** Construct a mosaic plot for the transit survey data where total sample size is 150.

1. Set total plot width to 150 units, allocate 80 units of width to the urban bar, 70 units to the rural bar
2. Split the urban bar vertically at 68.75% height for support, 31.25% for oppose
3. Split the rural bar vertically at 42.9% height for support, 57.1% for oppose
4. Label all axes: x-axis = Residence Location, y-axis = Relative Frequency of Transit Opinion

> **Association Check Rule**
>
> If the heights of corresponding segments across bars are nearly identical, there is no evidence of an association between the two variables. If segment heights differ noticeably, an association may exist.

## Common pitfalls

- **Wrong:** Dividing joint counts by the full grand total when calculating conditional relative frequency
  - Why it fails: Conditional frequencies restrict the denominator to only the subset of the conditioning variable, not the full sample, leading to incorrect values if you use the grand total.
  - Correct: Always confirm which group you are conditioning on, and use that group's marginal total as your calculation denominator.
- **Wrong:** Drawing segmented bar charts with unequal total bar heights when using raw counts instead of relative frequencies
  - Why it fails: Unequal heights distort visual comparison of group proportions, leading graders to deduct communication points for misleading displays.
  - Correct: Standardize all bars to 100% total height to compare conditional distributions fairly across subgroups.
- **Wrong:** Claiming a visible difference in conditional distributions proves a causal relationship between variables
  - Why it fails: Confounding variables could explain the observed association, and no causal claim is permitted from observational categorical data.
  - Correct: Only state that an association exists in the sample, and note that causation cannot be concluded without a randomized experiment.
- **Wrong:** Omitting axis labels or segment legends on graphical displays
  - Why it fails: AP rubrics deduct full credit for unlabeled plots that cannot be interpreted by a third party.
  - Correct: Always label the x-axis with the explanatory variable, y-axis with relative frequency, and add a clear legend for all response category segments.
- **Wrong:** Calculating marginal frequency by summing only a single joint cell count
  - Why it fails: Marginal frequency represents the total count for a single variable category across all levels of the second variable, not just one cell.
  - Correct: Sum all counts in the corresponding full row or column of the contingency table to get the correct marginal total.

## Cheatsheet

| Measure | Formula | Exam Use Case |
| --- | --- | --- |
| Joint Relative Frequency | Joint count / Grand total | Tabulate raw paired data proportions |
| Marginal Relative Frequency | Marginal total / Grand total | Describe distribution of one variable alone |
| Conditional Relative Frequency | Joint count / Subgroup marginal total | Compare distributions across subgroups |
| 100% Segmented Bar Chart | Equal width bars, height split by response | Compare conditional distributions fairly |
| Mosaic Plot | Bar width proportional to subgroup size | Visualize joint and conditional distributions at once |

## What's next

Mastering two-way table representations is the critical foundational step for upcoming inference procedures for categorical data, including chi-square tests for homogeneity and independence that make up 15-20% of the AP Statistics free response section. You will reuse the frequency calculation skills you learned here to verify expected counts, compute test statistics, and interpret p-values for hypothesis tests that assess whether observed associations in sample data generalize to the full population. This content also directly overlaps with unit 2 topics on exploring bivariate relationships, building a consistent framework for analyzing both categorical and quantitative paired data.

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/ap-statistics-u11-tabular-and-graphical-representations-for/
