Categorical Variables
with Tables
Learn how to organize, display, and interpret categorical data using frequency tables and relative frequency tables.
What Is a Categorical Variable?
A categorical variable (also called a qualitative variable) places each individual into one of several groups or categories. Unlike quantitative variables, categorical variables do not have meaningful numerical operations: you cannot add or average them.
Why Use Tables for Categorical Data?
Tables are the most fundamental way to summarize categorical data. They tell us how many (or what proportion) of individuals fall into each category, making patterns immediately visible.
The Distribution of a Variable
The distribution of a categorical variable tells us which values (categories) the variable takes and how often it takes each one. A table is the most direct way to display a distribution.
For categorical variables, we describe the distribution by listing every category alongside either a count (frequency) or a proportion/percentage (relative frequency).
The Frequency Table
A frequency table lists each category and the count (number of observations) in that category.
The Relative Frequency Table
A relative frequency table shows the proportion or percentage of observations in each category. Compute it as:
Frequency vs Relative Frequency
| Frequency Table | Relative Frequency Table | |
|---|---|---|
| Shows | Raw counts | Proportions or percentages |
| Values sum to | \( n \) (total observations) | 1.0 (or 100%) |
| Best when | You need exact counts | You need to compare groups of different sizes |
| AP exam tip | Verify total = \( n \) | Verify total = 1.0 (allow rounding) |
Rounding and the 100% Rule
When you convert frequencies to percentages, rounding can cause the total to be slightly different from exactly 100%. This is normal and expected.
How to Build a Frequency Table
Example 1: School Lunch Choices
A school surveyed 200 students about their lunch preference. The raw data yielded: Pizza: 72, Salad: 48, Sandwich: 52, Pasta: 28.
| Lunch Choice | Frequency | Relative Freq. | Percentage |
|---|---|---|---|
| Pizza | 72 | 0.360 | 36.0% |
| Sandwich | 52 | 0.260 | 26.0% |
| Salad | 48 | 0.240 | 24.0% |
| Pasta | 28 | 0.140 | 14.0% |
| Total | 200 | 1.000 | 100% |
Example 2: Comparing Two Schools
School A surveyed 200 students, and School B surveyed 500 students. Both asked about favorite subject. Why do we need relative frequencies here?
| School A (\( n = 200 \)) | School B (\( n = 500 \)) | |
|---|---|---|
| Math | 60 (30%) | 125 (25%) |
| English | 50 (25%) | 175 (35%) |
| Science | 40 (20%) | 100 (20%) |
| History | 50 (25%) | 100 (20%) |
Example 3: From Raw Data to Table
A researcher records the transportation method of 20 commuters:
| Transport | Frequency | Rel. Freq. | Percent |
|---|---|---|---|
| Car | 9 | 0.450 | 45.0% |
| Bus | 5 | 0.250 | 25.0% |
| Train | 3 | 0.150 | 15.0% |
| Bike | 3 | 0.150 | 15.0% |
| Total | 20 | 1.000 | 100% |
Reading and Interpreting a Table
When the AP exam asks you to "describe the distribution," use these three elements:
Describing a Distribution in Context
Using the movie genre example from earlier, here is a model response:
Common Mistakes to Avoid
Summary: Key Takeaways
| Concept | What to Remember |
|---|---|
| Categorical variable | Places individuals into groups; no meaningful arithmetic |
| Frequency table | Lists categories + counts; total = \( n \) |
| Relative frequency | \(\frac{\text{count}}{n}\); total = 1.0 (or 100%) |
| Distribution | What values the variable takes and how often |
| Comparing groups | Always use relative frequencies for different \( n \) |
| Describing | Most/least common + specific values + context |
Question 1 of 5
Which of the following is a categorical variable?
Question 2 of 5
A survey of 250 people found that 75 prefer coffee, 100 prefer tea, 50 prefer juice, and 25 prefer water. What is the relative frequency of people who prefer tea?
Question 3 of 5
A relative frequency table for a categorical variable has four categories with percentages: 28%, 34%, 22%, and 17%. What should you conclude?
Question 4 of 5
School A (\( n = 150 \)) has 60 students who walk to school. School B (\( n = 400 \)) has 120 students who walk. Which school has a higher proportion of walkers?
Question 5 of 5
Which of the following is not an appropriate way to describe the distribution of a categorical variable?