Study Guide

Summary Statistics for Two Categorical Variables

AP StatisticsΒ· 12 min read

1. Structure of Two-Way Contingency Tablesβ˜…β˜…β˜†β˜†β˜†β± 10 min

A two-way contingency table organizes raw count data for observations classified by two separate categorical variables. Rows represent categories of the first variable, columns represent categories of the second variable, and each cell stores the number of observations that fall into the paired row and column category.

πŸ“˜ Definition

Two-way contingency table

A tabular summary of raw counts for all cross-classified category pairs from two categorical variables, including row, column, and grand total sums.

Example:

A table tracking 200 student survey responses, with rows for 'pass/fail' exam outcome and columns for 'studied less than 5 hours / studied 5+ hours'.

πŸ“ Worked Example

A school records 120 total students: 40 9th graders who play sports, 30 9th graders who do not play sports, 25 10th graders who play sports, 25 10th graders who do not play sports. Construct the full two-way contingency table including all totals.

  1. 1

    Define rows as grade level (9th, 10th) and columns as sports participation (play, do not play)

  2. 2

    Populate raw count cells with the given values

  3. 3

    Calculate row totals: 70 total 9th graders, 50 total 10th graders

  4. 4

    Calculate column totals: 65 total sports players, 55 total non-players

  5. 5

    Confirm grand total sum equals 120, matching the total student count

βœ“ Quick check

Test your understanding of table structure:

  1. What value should the sum of all individual cell counts equal?

    • Sum of all row totals

    • Grand total sample size

    • Sum of all column totals

    • All of the above

    Reveal answer
    All of the above β€”

    All three values are mathematically identical for a properly constructed two-way table.

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

All three relative frequency types use raw counts from the two-way table, but differ in the denominator used for calculation. The denominator is the key detail AP graders check for full credit on calculation questions.

Frequency Type

Denominator

Example Calculation

Joint

Grand total sample size

Number of 9th graders who play sports / 120 total students

Marginal

Grand total sample size

Total number of sports players / 120 total students

Conditional

Subgroup total size

Number of sports players / 70 total 9th graders

πŸ“ Worked Example

Using the 120-student two-way table from the prior example, calculate the joint relative frequency for 10th graders who do not play sports, the marginal relative frequency for 9th graders, and the conditional relative frequency of playing sports given the student is in 10th grade.

  1. 1

    Joint relative frequency: 25 non-playing 10th graders / 120 total students = 0.208, or 20.8%

  2. 2

    Marginal relative frequency for 9th graders: 70 total 9th graders / 120 total students = 0.583, or 58.3%

  3. 3

    Conditional relative frequency of playing sports for 10th graders: 25 playing 10th graders / 50 total 10th graders = 0.5, or 50%

3. Detecting Association Between Two Categorical Variablesβ˜…β˜…β˜…β˜†β˜†β± 12 min

Two categorical variables have no association (are independent) if the conditional relative frequency of one variable is identical across all categories of the second variable. If conditional frequencies differ by a meaningful margin, the variables are associated.

πŸ“ Worked Example

For our student dataset, the conditional relative frequency of playing sports for 9th graders is 40/70 = 57.1%, and for 10th graders it is 50%. Is there evidence of association between grade level and sports participation?

  1. 1

    Compare the two conditional relative frequencies directly: 57.1% vs 50%

  2. 2

    Note that the proportion of students playing sports is 7.1 percentage points higher for 9th graders than 10th graders

  3. 3

    Conclude that there is observed association between grade level and sports participation in this sample

Exam tip:

AP exam association questions almost always require you to compare two conditional relative frequencies explicitly, not just state a trend.

4. Visualizing Relationships with Segmented Bar Chartsβ˜…β˜…β˜…β˜†β˜†β± 10 min

Segmented bar charts (also called stacked bar charts) use bars of equal total height, split into colored segments proportional to conditional relative frequencies, to make association easy to visualize. For no association, every bar will have identical segment proportions.

πŸ“ Worked Example

Outline the steps to draw a segmented bar chart for our grade level and sports participation dataset

  1. 1

    Draw two equal height bars, one labeled '9th Grade' and one labeled '10th Grade' on the x-axis

  2. 2

    Label the y-axis 'Relative Frequency' with a scale from 0 to 1

  3. 3

    Split the 9th grade bar 57.1% / 42.9% for sports players / non-players

  4. 4

    Split the 10th grade bar 50% / 50% for sports players / non-players

  5. 5

    Add a legend assigning distinct colors to 'Play Sports' and 'Do Not Play Sports'

5. Common Pitfalls

Wrong move:

Using the grand total sample size as the denominator for conditional relative frequency calculations

Why:

This produces a joint frequency value instead of the requested conditional value, leading to zero points for the calculation on AP FRQs

Correct move:

Explicitly identify the restricted subgroup before selecting your denominator for conditional frequency problems

Wrong move:

Using raw counts instead of relative frequencies to compare subgroups of unequal size

Why:

Larger subgroups will always have higher raw counts, leading to false conclusions about association

Correct move:

Convert all counts to relative frequencies before making any cross-group comparison

Wrong move:

Claiming no association exists just because conditional frequencies are not perfectly identical

Why:

Small differences from random sampling variation are expected even for independent variables

Correct move:

Note that perfect independence requires 100% identical conditional frequencies, and only claim association if differences are large enough to be meaningful

Wrong move:

Drawing segmented bars of unequal total height

Why:

AP graders deduct a full scoring point for this error, as unequal heights distort proportional comparisons

Correct move:

Set all bars to a total height of 1 (100%) to represent full conditional relative frequency distributions

Wrong move:

Concluding a causal relationship between two associated categorical variables

Why:

Observational two-way table data cannot rule out unmeasured confounding variables

Correct move:

Only state that observed association exists, and never claim causation unless the data comes from a randomized controlled experiment

6. Quick Reference Cheatsheet

Statistic Type

Denominator

Core Use Case

Joint Relative Frequency

Grand total sample size

Share of observations in one specific cross-category pair

Marginal Relative Frequency

Grand total sample size

Share of observations in one single variable category

Conditional Relative Frequency

Restricted subgroup total

Share of observations in a target group given a pre-defined condition

7. Frequently Asked

Do I need to calculate all three types of relative frequency for every two-way table AP problem?

No, you only need to calculate the type explicitly requested in the prompt. However, AP graders will deduct points if you fail to explicitly label which frequency type you are reporting, even if your numerical value is correct.

If conditional relative frequencies are not identical, does that prove a causal relationship between the two variables?

No. Non-identical conditional frequencies only demonstrate association, not causation. You can never conclude causation from observational two-way table data, as unmeasured confounding variables may explain the observed relationship.

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 FRQ part a frequency calculation

  • 2022 Β· Paper 2

    Association identification MCQ set

  • 2021 Β· Paper 1

    Segmented bar chart construction task

What's Next

Mastering two categorical variable summary statistics is the critical foundation for your upcoming unit on chi-square inference tests, the most heavily tested hypothesis procedure for categorical data on the AP Stats exam. You will reuse the exact relative frequency calculation skills you learned here to compute expected counts for chi-square goodness of fit, chi-square test for independence, and chi-square test for homogeneity problems, all of which carry significant point weight on both the multiple choice and free response sections. You will also build on this knowledge to identify Simpson’s paradox, a famous statistical anomaly where observed association trends reverse when a third confounding categorical variable is added to the two-way table. Continue your progress with the linked resources below.