Chapter 2: Summarizing a Single Categorical Variable#
Imagine you just asked 200 students at your school what kind of pet they have. You have a jumble of answers—dog, cat, none, fish, cat, dog, dog... That raw list tells you almost nothing. This chapter gives you the tools to turn that pile of data into a clear, honest picture. We will learn how to count and display the answers so anyone can see the story at a glance.
The Big Picture#
When we measure a categorical variable, we sort each person or thing into exactly one category. "Favorite music genre," "eye color," and "yes/no" survey answers are all categorical. Our job is to take those labels and present them honestly. We will build tables that show how often each category appears, and then draw charts that make those numbers easy to compare. Along the way, we will also learn one big rule that keeps charts honest: the area principle.
Counting and Organizing with Tables#
The first thing we do with a pile of categorical data is simply count. A frequency table lists every category we observed and how many times it showed up. Let's build one.
Suppose 30 students were asked their preferred weekend entertainment. The raw answers might look like this: Movies, Movies, Sports, Games, Movies, Reading, Sports, Reading, Movies, Games, Sports, Sports, Games, Movies, Reading, Sports, Sports, Movies, Games, Movies, Games, Movies, Reading, Sports, Movies, Games, Sports, Music, Sports, Reading. That is a lot to scan. Counting it up gives us something much cleaner.
| Entertainment | Frequency |
|---|---|
| Movies | 9 |
| Sports | 9 |
| Games | 6 |
| Reading | 4 |
| Music | 1 |
| Total | 30 |
This is a frequency table (sometimes called a frequency distribution). The numbers in the second column are the frequencies, or counts.
Frequency: The number of times a particular category appears in a dataset.
But raw counts only tell part of the story. If I tell you 50 students prefer soccer, is that a lot? It depends on the total. Fifty out of 60 is huge; 50 out of 2,000 is tiny. So we often calculate a relative frequency, which is just the fraction or percentage of the whole that each category represents.
Relative frequency: The proportion of observations that fall into a given category. It equals the category’s frequency divided by the total number of observations.
To build a relative frequency table, we divide each count by the total. For our entertainment data, the total is 30.
| Entertainment | Frequency | Relative Frequency | Percentage |
|---|---|---|---|
| Movies | 9 | 9/30 = 0.30 | 30.0% |
| Sports | 9 | 9/30 = 0.30 | 30.0% |
| Games | 6 | 6/30 = 0.20 | 20.0% |
| Reading | 4 | 4/30 ≈ 0.133 | 13.3% |
| Music | 1 | 1/30 ≈ 0.033 | 3.3% |
| Total | 30 | 1.00 | 100% |
Notice that the relative frequencies always sum to 1.00 (or 100%). That is a quick check on your arithmetic. Now we can say things like "Sports and Movies together account for 60% of the preferences," something that was not obvious from the raw counts alone.
When categories have a natural order—like survey responses from "Strongly Disagree" to "Strongly Agree"—we list them in that order. Otherwise, we often list categories from highest frequency to lowest, which helps readers spot the most common answers instantly.
📝 Section Recap: A frequency table lists the count for each category, and a relative frequency table adds the proportion or percentage. This turns a messy list of labels into a clear summary.
Bar Charts and the Area Principle#
Numbers in a table are precise, but a picture often makes the pattern jump out faster. The most common picture for a single categorical variable is the bar chart.
A bar chart draws one bar for each category. The bar's height shows either the count or the percentage. The bars are separated by gaps to remind us that the categories are distinct, not connected on a number line.
Here is the crucial design rule that makes a bar chart honest. It is called the area principle.
Area principle: In any statistical graph, the area taken up by a part of the data should be proportional to the size of that data. A category that is twice as large should look twice as large in the picture.
In a bar chart, we satisfy the area principle by making all bars the same width and letting only the height vary. A bar that represents 20% of the data takes up 20% of the total bar area. Simple.
What happens if you break this rule? Imagine you make the bar for "Music" extra wide to make it look more important, even though it only represents 3.3% of the data. Your eye naturally compares the area of the shapes, and you would be tricked into thinking Music is a bigger deal than it really is. That is misleading—and surprisingly common in advertisements and sloppy news graphics.
Starting the vertical axis at something other than zero is another distortion. A bar for 30% must be three times as tall as a bar for 10%. But if you start the axis at 25%, the 30% bar looks enormous and the 10% bar looks tiny. Always check the axes on a bar chart.
Let's picture a proper bar chart for our entertainment data. A horizontal line across the bottom is labeled with the five categories: Movies, Sports, Games, Reading, Music. Above each label rises a vertical bar, all equally thick. The bar for Movies goes up to 9 (or 30%). The bar for Sports matches it at 9. Games stops at 6, Reading at 4, and Music at just 1. Your eye immediately sees two tall bars, one medium, one shorter, and one tiny sliver. The story is clear: Movies and Sports dominate, Music barely registers.
Bar chart variants. Sometimes you see the bars drawn horizontally instead of vertically. This is just a rotated bar chart, useful when category labels are long. Another variant is a stacked bar chart, but that is for showing a second categorical variable, so it belongs to a later topic about relationships between two variables. For a single variable, stick with simple, side-by-side bars.
📝 Section Recap: A bar chart uses the height of equally wide bars to show each category's count or percentage. The area principle demands that bars have equal width and the axis starts at zero, so the picture matches the numbers.
Pie Charts and Ring Charts#
You can also use a pie chart. A pie chart is a circle cut into slices. Each slice stands for a category. The slice's angle—and therefore its area—matches the category's relative frequency.
Think of the whole circle as 100% of the data, or 360 degrees. A category that makes up 30% of the data gets a slice that spans
Pie charts are common and people find them friendly, but they have a real weakness: our eyes are not as good at comparing angles and areas as they are at comparing lengths. In the bar chart, you can instantly rank the bars by height. In a pie chart, telling whether the 20% slice and the 13% slice are in the right ratio is much harder. For this reason, many statisticians prefer bar charts, especially when there are more than three or four categories or when slices are close in size.
Pie chart rule of thumb: Use a pie chart only when you have a small number of categories (ideally 3–5) and you want to emphasize each category's part of a whole. Always label the slices with their percentages.
A ring chart (or donut chart) is a pie chart with a hole in the middle. It shows exactly the same information—each arc's length is proportional to the category's share. The hole sometimes displays a label or an extra summary number. Ring charts have the same strengths and weaknesses as pie charts, and the same careful-use rule applies.
📝 Section Recap: Pie and ring charts show each category as a slice of a circular whole. They work best with few categories and clear labels, but bar charts generally make comparisons easier and are preferred in most data analysis.
The Mode and Other Quick Summaries#
Tables and charts give us the full picture, but sometimes we want a single number that captures the most striking feature. For categorical data, the natural choice is the mode.
Mode: The category that appears most often. It is the category with the highest frequency.
In our entertainment example, the mode is not one category but two: Movies and Sports are tied, each with a frequency of 9. When two categories tie for the highest frequency, we say the data is bimodal. If three or more tie, it is multimodal. If all categories appear exactly equally often, there is no mode at all.
The mode is a simple, honest summary. "The most popular weekend activity among these students is evenly split between movies and sports." That one sentence conveys a lot. But the mode also hides details. It doesn't tell you that reading and music were also chosen, or that music attracted only one person. In fact, suppose 9 students chose Movies, 8 chose Sports, and 8 chose Games. The mode would be only Movies—and you might wrongly assume Movies is the clear favorite, when really the top three are almost tied. This is why we almost always present the mode alongside a frequency table or chart, not alone.
Other summaries. Sometimes we are interested in the least common category, the count of categories (how many distinct answers there are), or the concentration of the data (do two categories dominate, or is it a fairly even split?). Coming chapters will give us numerical measures for ideas like "spread" and "concentration" for quantitative data. For categorical data, we keep it straightforward: frequencies, relative frequencies, and possibly the mode.
📝 Section Recap: The mode is the most frequent category. It gives a quick headline for the data but must be accompanied by a frequency table or chart to avoid misleading conclusions.
Summary#
We began with a messy list. Counting and making relative frequency tables gave us clear numbers. Bar charts made the comparisons visual, and sticking to the area principle kept them truthful. Pie and ring charts can show part-of-a-whole stories, but bar charts are usually easier to read. The mode offers a quick summary, but never replaces the full picture. These basic tools are the foundation for everything else you'll learn in statistics.
| Key idea | What it means (plain English) | Why it matters |
|---|---|---|
| Categorical variable | A measurement that places each individual into a named group (like hair color or yes/no). | Knowing the variable type tells us which tools (tables, bar charts) to use. |
| Frequency table | A list of categories with the count of how many times each one appears. | It organizes raw data into a readable summary. |
| Relative frequency | The fraction or percentage of the total that falls in a category. | It lets us compare categories fairly regardless of the total sample size. |
| Bar chart | A graph with separate, equally wide bars whose heights show frequencies or percentages. | It makes comparisons visual and immediate. |
| Area principle | The rule that the area of a graph element should match the size of the data it represents. | Violating it (e.g., with uneven bar widths or chopped axes) creates misleading graphs. |
| Pie chart | A circle divided into slices, each slice proportional to a category's share. | Good for showing “part of a whole” when there are only a few categories. |
| Mode | The category that appears most often. | It gives a quick one-word summary of the most typical answer. |