Study Guide

Tabular and Graphical Representations for the Distributions of Two Categorical Variables

AP StatisticsΒ· Unit 3, Skill 2.F: Represent bivariate categorical data with tables and graphsΒ· 12 min read

1. Two-Way Contingency Table Fundamentalsβ˜…β˜…β˜†β˜†β˜†β± 15 min

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.

πŸ“˜ Definition

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.

Grand Total=βˆ‘i=1rβˆ‘j=1cnij\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. 1

    Define rows as residence location, columns as transit opinion

  2. 2

    Fill in joint counts: Urban/Support = 55, Urban/Oppose = 25, Rural/Support = 30, Rural/Oppose = 40

  3. 3

    Calculate marginal totals: Urban total = 80, Rural total =70, Support total=85, Oppose total=65

  4. 4

    Verify grand total = 80 +70 = 150, matching the total sample size

βœ“ Quick check

Test your understanding of table structure:

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

    • 65

    • 70

    • 80

    • 85

    Reveal answer
    65 β€”

    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.

2. Calculating Marginal, Joint, and Conditional Relative Frequenciesβ˜…β˜…β˜…β˜†β˜†β± 18 min

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. 1

    Identify the conditioning subgroup: rural residents, with marginal total of 70

  2. 2

    Extract the joint count for rural residents who support the line: 30

  3. 3
    Conditional Relative Frequency=3070β‰ˆ0.429, or 42.9%\text{Conditional Relative Frequency} = \frac{30}{70} \approx 0.429, \text{ or } 42.9\%
  4. 4

    Interpretation: 42.9% of rural survey respondents support the new public transit line.

3. Segmented Bar Charts for Two Categorical Variablesβ˜…β˜…β˜†β˜†β˜†β± 12 min

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%.

πŸ“˜ Definition

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. 1

    Set x-axis labels to "Urban" and "Rural", set y-axis to 0% to 100% relative frequency

  2. 2

    For the urban bar: support segment height = 55/80 = 68.75%, oppose segment height = 31.25%

  3. 3

    For the rural bar: support segment height = 30/70 β‰ˆ 42.9%, oppose segment height β‰ˆ 57.1%

  4. 4

    Add a clear legend mapping colors to support and oppose categories

4. Mosaic Plots and Association Detectionβ˜…β˜…β˜…β˜…β˜†β± 15 min

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.

Methods compared

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. 1

    Set total plot width to 150 units, allocate 80 units of width to the urban bar, 70 units to the rural bar

  2. 2

    Split the urban bar vertically at 68.75% height for support, 31.25% for oppose

  3. 3

    Split the rural bar vertically at 42.9% height for support, 57.1% for oppose

  4. 4

    Label all axes: x-axis = Residence Location, y-axis = Relative Frequency of Transit Opinion

5. Common Pitfalls

Wrong move:

Dividing joint counts by the full grand total when calculating conditional relative frequency

Why:

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 move:

Always confirm which group you are conditioning on, and use that group's marginal total as your calculation denominator.

Wrong move:

Drawing segmented bar charts with unequal total bar heights when using raw counts instead of relative frequencies

Why:

Unequal heights distort visual comparison of group proportions, leading graders to deduct communication points for misleading displays.

Correct move:

Standardize all bars to 100% total height to compare conditional distributions fairly across subgroups.

Wrong move:

Claiming a visible difference in conditional distributions proves a causal relationship between variables

Why:

Confounding variables could explain the observed association, and no causal claim is permitted from observational categorical data.

Correct move:

Only state that an association exists in the sample, and note that causation cannot be concluded without a randomized experiment.

Wrong move:

Omitting axis labels or segment legends on graphical displays

Why:

AP rubrics deduct full credit for unlabeled plots that cannot be interpreted by a third party.

Correct move:

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 move:

Calculating marginal frequency by summing only a single joint cell count

Why:

Marginal frequency represents the total count for a single variable category across all levels of the second variable, not just one cell.

Correct move:

Sum all counts in the corresponding full row or column of the contingency table to get the correct marginal total.

6. Quick Reference 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

When this came up on past exams

AI-estimated based on syllabus patterns β€” cross-check with official past papers for accuracy. Use only as revision-focus signals.

  • 2023 Β· Paper 1

    Two-way table frequency calculation

  • 2021 Β· Paper 2

    Mosaic plot association interpretation

  • 2019 Β· Paper 1

    Segmented bar chart construction

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.