Frequency tables, relative frequency tables, bar graphs, pie charts, two-way tables, marginal and conditional distributions, segmented bar graphs, association, and responsible interpretation of categorical data
When you ask people what sport they play, what political party they support, which brand of phone they own, or whether they prefer coffee or tea, you are collecting categorical data. Categorical data do not come as measurements on a scale — they come as names, labels, types, or group memberships. To make sense of this kind of data, statisticians organize it into tables and displays that reveal how often each category appears, what proportion of the total each group represents, and whether two categorical variables are related to each other.
This chapter introduces the tools for organizing, displaying, and interpreting categorical data. You will learn to build frequency tables, relative frequency tables, bar graphs, pie charts, segmented bar graphs, and two-way tables. More importantly, you will learn to read these displays critically: to compare proportions rather than raw counts, to recognize association between two categorical variables, and to identify misleading or incomplete representations of data.
Throughout this chapter, the goal is not to produce attractive-looking charts. The goal is to ask and answer meaningful questions about groups of people, objects, or outcomes — and to do that with honesty, precision, and context.
A school district surveys 400 high school students about their primary mode of transportation to school. The results show that 160 students drive or get driven, 120 students ride the bus, 80 students walk, and 40 students bike or use another method. How would you display these results clearly? If you wanted to compare transportation habits between freshmen and seniors, what kind of display would you need? If a newspaper reported that "twice as many students drive as bike," is that statement informative or misleading? By the end of this chapter, you will have the tools to answer all three questions carefully.
In Chapter 1, you learned that variables come in two types: categorical and quantitative. Chapter 3 focuses entirely on categorical variables. A categorical variable classifies individuals into groups. The "values" of a categorical variable are not numbers to be added or averaged — they are names, labels, or categories. Examples include eye color, favorite subject, type of housing, preferred streaming service, response to a survey question, and political party affiliation.
Compare these to quantitative variables, which produce measurements that can be added, averaged, and placed on a number line: height in centimeters, annual income in dollars, temperature in Fahrenheit, or number of siblings. Quantitative variables are the subject of Chapters 4 and 5.
| Variable | Type | Example Values | Meaningful Average? |
|---|---|---|---|
| Favorite sport | Categorical | Soccer, Basketball, Tennis | No |
| Grade level | Categorical | Freshman, Sophomore, Junior, Senior | No |
| Height (cm) | Quantitative | 162, 175, 183 | Yes |
| Number of siblings | Quantitative | 0, 1, 2, 3 | Yes |
| Zip code | Categorical | 98052, 10001, 60614 | No — labels only |
The central questions in categorical data analysis are: How often does each category appear? What proportion of the total does each category represent? How do proportions compare across different groups? Is there a relationship between two categorical variables?
Do not assume that because data contain numbers, they are quantitative. Ask whether it would make sense to add, subtract, or average the values. Zip codes, jersey numbers, and student ID numbers look numerical but function as category labels. If averaging the values has no meaningful interpretation, treat the variable as categorical.
The simplest tool for summarizing categorical data is the frequency table. A frequency table lists every category in the data and records the count — the frequency — of how many individuals fall into each category. The last row always shows the total number of individuals, written as n. This total is essential for calculating proportions.
To build a frequency table: (1) identify the variable and list all possible categories, (2) count how many individuals fall into each category, (3) record the counts, (4) sum the counts to verify they add up to n.
Pop: 10 · Rock: 7 · Hip-Hop: 7 · Classical: 4 · Jazz: 2
Verify: 10 + 7 + 7 + 4 + 2 = 30 = n ✓
| Favorite Music Type | Frequency |
|---|---|
| Pop | 10 |
| Rock | 7 |
| Hip-Hop | 7 |
| Classical | 4 |
| Jazz | 2 |
| Total | 30 |
The frequency column shows counts. A high count only means many individuals fall into that category — it says nothing about the proportion unless you know the total n. Always record the total so proportions can be calculated.
Frequency tables have an important limitation: counts are hard to compare across groups of different sizes. Suppose School A reports 120 students with part-time jobs and School B reports 80. If School A has 600 students and School B has 200, the proportions tell the opposite story: 20% at School A versus 40% at School B.
This is why relative frequency matters. The relative frequency of a category is the proportion — or percentage — of the total in that category:
relative frequency = frequency ÷ n
Multiply by 100 to express as a percentage. Relative frequencies should sum to 1.00 (or 100%). Small rounding differences — such as 0.999 or 1.001 — are acceptable.
Pop: 10 ÷ 30 ≈ 0.333 = 33.3%
Rock: 7 ÷ 30 ≈ 0.233 = 23.3%
Hip-Hop: 7 ÷ 30 ≈ 0.233 = 23.3%
Classical: 4 ÷ 30 ≈ 0.133 = 13.3%
Jazz: 2 ÷ 30 ≈ 0.067 = 6.7%
Check: 0.333 + 0.233 + 0.233 + 0.133 + 0.067 = 0.999 ≈ 1.00 ✓ (rounding)
| Music Type | Frequency | Relative Frequency | Percentage |
|---|---|---|---|
| Pop | 10 | 0.333 | 33.3% |
| Rock | 7 | 0.233 | 23.3% |
| Hip-Hop | 7 | 0.233 | 23.3% |
| Classical | 4 | 0.133 | 13.3% |
| Jazz | 2 | 0.067 | 6.7% |
| Total | 30 | 1.000 | 100% |
When reporting data from a sample, always report the sample size n alongside relative frequencies. A percentage like "40% of respondents preferred X" means very different things if the sample was 10 people versus 10,000 people. Omitting n is one of the most common ways statistics are presented irresponsibly.
While tables organize categorical data precisely, graphs communicate patterns at a glance. The most common display for categorical data is the bar graph. Each category is represented by a bar, and the height of the bar represents the frequency or relative frequency of that category.
Equal width bars — all bars must have the same width.
Gaps between bars — unlike histograms (used for quantitative data), bar graphs have visible gaps between bars.
Labeled axes — vertical axis labeled with frequency or relative frequency; horizontal axis lists categories.
Title — every graph needs a descriptive title.
Use relative frequency — when comparing groups of different sizes, always use percentages rather than raw counts.
Draw a vertical bar graph. Place the five music categories on the horizontal axis, ordered from most to least frequent: Pop, Rock, Hip-Hop, Classical, Jazz. Draw vertical bars to the following heights: Pop at 33.3%, Rock at 23.3%, Hip-Hop at 23.3%, Classical at 13.3%, Jazz at 6.7%. Leave a visible gap between each bar. Label the vertical axis "Relative Frequency (%)" from 0% to 40% in increments of 10%. Label the horizontal axis "Favorite Music Type." Add the title "Music Preferences Among 30 Students."
When comparing the distribution of a categorical variable across two groups, use a side-by-side (grouped) bar graph. For each category on the horizontal axis, draw two bars placed next to each other — one for each group — using different colors or shadings. Always use relative frequencies (percentages) when group sizes differ, so the comparison is fair.
A pie chart is a circular display divided into sectors, where each sector is proportional to the relative frequency of that category. A category with 25% of the data gets a sector occupying 25% of the circle's area — equivalently, a central angle of 0.25 × 360° = 90°. Pie charts are common in news reports and business presentations, giving an immediate visual impression of how a whole is divided among parts.
Pie charts work best when there are relatively few categories (generally five or fewer) and the parts-to-whole relationship is the primary message. However, they have serious limitations that statisticians recognize.
| Limitation | Why It Matters |
|---|---|
| Hard to compare sector sizes | Human perception of angles and areas is much less accurate than perception of bar lengths. A 5% difference between sectors is nearly impossible to detect visually. |
| Fail with many categories | More than five or six categories produces cluttered, overlapping labels and tiny sectors that are meaningless visually. |
| Cannot compare two groups | Comparing sector sizes across two separate circles is especially unreliable. Side-by-side bar graphs or segmented bar graphs are far better for group comparisons. |
| 3D effects are actively misleading | Three-dimensional pie charts cause front sectors to appear larger than back sectors even when representing equal proportions — a common technique in misleading presentations. |
Three-dimensional pie charts should generally be avoided in serious data communication. They are frequently used — intentionally or not — to exaggerate differences between categories. When precision matters, a relative frequency table or flat bar graph is almost always the better choice. When you see a 3D pie chart, always read the labeled percentages directly rather than trusting the visual impression.
The tools so far — frequency tables, relative frequency tables, bar graphs, and pie charts — describe the distribution of a single categorical variable. But many of the most interesting questions in statistics involve two variables at once: Do men and women have different preferences for a product? Do freshmen and seniors travel to school by different methods? Is there a relationship between smoking status and disease outcome?
To answer these questions, we use a two-way table (also called a contingency table). A two-way table organizes data by placing one categorical variable in the rows and another in the columns. Each cell records the count of individuals who fall into that particular combination of categories.
Interior cells — counts for each combination of row category and column category.
Row totals — total count for each row category, placed in a final column.
Column totals — total count for each column category, placed in a final row.
Grand total — total number of individuals, placed in the lower-right corner.
| Grade Level | Participates | Does Not Participate | Row Total |
|---|---|---|---|
| Freshman | 28 | 22 | 50 |
| Sophomore | 34 | 16 | 50 |
| Junior | 38 | 12 | 50 |
| Senior | 40 | 10 | 50 |
| Column Total | 140 | 60 | 200 |
Do not confuse row totals with the grand total. The row total for freshmen is 50, not 200. When you calculate proportions, use the correct total for the question you are answering. "What proportion of freshmen participate?" requires dividing by 50. "What proportion of all students participate?" requires dividing by 200.
The marginal distribution of a variable in a two-way table is the distribution of that variable alone, found by looking at the row totals or column totals as proportions of the grand total. The word "marginal" refers to the totals written in the margins (edges) of the table.
To find the marginal distribution of the column variable, divide each column total by the grand total. To find the marginal distribution of the row variable, divide each row total by the grand total.
| Participation | Count | Relative Frequency |
|---|---|---|
| Participates | 140 | 140 ÷ 200 = 70% |
| Does Not Participate | 60 | 60 ÷ 200 = 30% |
| Total | 200 | 100% |
| Grade Level | Count | Relative Frequency |
|---|---|---|
| Freshman | 50 | 50 ÷ 200 = 25% |
| Sophomore | 50 | 50 ÷ 200 = 25% |
| Junior | 50 | 50 ÷ 200 = 25% |
| Senior | 50 | 50 ÷ 200 = 25% |
| Total | 200 | 100% |
A conditional distribution gives the distribution of one variable restricted to a specific value of another variable. It answers: "Among only the students in this group, what is the breakdown?" Conditional distributions are the key to detecting association — whether the distribution of one variable changes depending on the value of the other.
To find the conditional distribution of the column variable given a specific row category: locate that row, divide each cell count by the row total for that category, and express as proportions or percentages.
| Grade Level | % Participating | % Not Participating | Total |
|---|---|---|---|
| Freshman | 28 ÷ 50 = 56% | 22 ÷ 50 = 44% | 100% |
| Sophomore | 34 ÷ 50 = 68% | 16 ÷ 50 = 32% | 100% |
| Junior | 38 ÷ 50 = 76% | 12 ÷ 50 = 24% | 100% |
| Senior | 40 ÷ 50 = 80% | 10 ÷ 50 = 20% | 100% |
Always divide by the correct total when calculating a conditional distribution. If you want the conditional distribution of participation given grade level, divide by the row total — the number of students in that grade. If you divide by the grand total instead, you will get a very different and incorrect proportion.
| High Energy | Low Energy | Row Total | |
|---|---|---|---|
| Exercises Regularly | 112 | 48 | 160 |
| Does Not Exercise | 56 | 84 | 140 |
| Column Total | 168 | 132 | 300 |
Among exercisers: 112 ÷ 160 = 0.70 = 70% report high energy
Among non-exercisers: 56 ÷ 140 = 0.40 = 40% report high energy
A segmented bar graph (also called a stacked bar graph) is the natural visual complement to a table of conditional distributions. Each bar represents one category of the row variable. Each bar is divided into segments corresponding to the conditional distribution of the column variable. All bars are drawn to the same total height representing 100%, so visual comparisons reflect proportions — not counts.
Draw a vertical segmented bar graph with four equal-width bars on the horizontal axis, labeled Freshman, Sophomore, Junior, and Senior. Each bar has the same total height representing 100%. Divide each bar into two segments: a lower segment (solid fill) representing the percentage who participate, and an upper segment (hatched fill) representing the percentage who do not. Mark the boundary between segments at the following heights: Freshman at 56%, Sophomore at 68%, Junior at 76%, Senior at 80%. Label the vertical axis "Relative Frequency (%)" from 0% to 100%. Include a legend identifying the two segments. Title the graph "Extracurricular Participation by Grade Level."
Only use the segmented bar graph format with all bars the same height (representing 100%) when comparing groups. If bars are drawn to the height of raw counts instead of percentages, a bar representing a larger group will look taller simply because the group is bigger — not because the proportion is different.
Statistics rarely asks about a single isolated group. Most interesting statistical questions ask about differences between groups. When the variable of interest is categorical, comparing groups means comparing conditional distributions. This section walks through a complete comparison from two-way table to interpretation.
| Grade Category | Eats Breakfast Regularly | Does Not Eat Regularly | Row Total |
|---|---|---|---|
| Underclassmen | 72 | 88 | 160 |
| Upperclassmen | 88 | 72 | 160 |
| Column Total | 160 | 160 | 320 |
Marginal distribution: 160 ÷ 320 = 50% eat regularly; 50% do not
Underclassmen: 72 ÷ 160 = 45% eat regularly; 88 ÷ 160 = 55% do not
Upperclassmen: 88 ÷ 160 = 55% eat regularly; 72 ÷ 160 = 45% do not
Two categorical variables are associated if knowing the value of one variable tells you something useful about the likely distribution of the other. In two-way table terms, this means the conditional distributions differ across the categories of one variable. If the conditional distributions are all the same (or nearly the same), the variables show little or no association — knowing someone's group membership gives no information about their category on the other variable.
| Residence | Support Park | Do Not Support | Row Total |
|---|---|---|---|
| Within 1 Mile | 84 | 16 | 100 |
| More Than 1 Mile | 52 | 48 | 100 |
| Column Total | 136 | 64 | 200 |
Within 1 mile: 84 ÷ 100 = 84% support; 16% do not
More than 1 mile: 52 ÷ 100 = 52% support; 48% do not
Difference: 84% − 52% = 32 percentage points
Association in a two-way table means the two variables are related. It does not mean one causes the other. This distinction is fundamental to responsible statistical interpretation. A headline saying "People who eat X are more likely to develop Y" reports an association from observational data — not a proven causal relationship. Always ask: how was the data collected? Could confounding variables explain the pattern?
Bar graphs, pie charts, and tables can be displayed in ways that distort the truth — sometimes accidentally, sometimes deliberately. A reader who recognizes the techniques of misleading display is much harder to manipulate. Here are the most common ways categorical data displays are made misleading.
Vertical axis runs from 55% to 65% — a 4-point difference looks like a 4× difference visually.
Always check whether the vertical axis starts at zero. If not, recalibrate your visual impression by reading the actual labeled values.
Front sectors appear larger than back sectors even when they represent identical proportions.
Use flat (2D) pie charts, or better yet, use a bar graph instead. Always read the labeled percentages directly.
A wider bar at the same height appears to represent more data — the area, not just the height, creates the visual impression.
All bars in a bar graph must have equal widths. Unequal widths should raise immediate suspicion.
"1,000 people prefer Brand X" — without knowing n, this count is uninterpretable.
Always report n alongside frequencies or percentages. Without knowing the denominator, a percentage cannot be evaluated.
A satisfaction survey reports only "very satisfied" and "satisfied" while omitting "neutral," "dissatisfied," and "very dissatisfied."
Make sure all categories are reported. When reading a published display, ask whether any categories might be missing.
Group A has 500 who prefer X; Group B has only 200 — but if Group A has 5,000 members and Group B has 400, the proportions (10% vs. 50%) tell the opposite story.
Always use relative frequencies when comparing groups of different sizes. Raw counts across groups of different sizes are nearly always misleading.
Visual height of A: 52% − 46% = 6 units above axis baseline
Visual height of B: 48% − 46% = 2 units above axis baseline
Ratio: 6 ÷ 2 = 3 — Candidate A's bar appears 3× as tall
Actual percentage ratio: 52% ÷ 48% ≈ 1.08 — barely a 8% larger share
Categorical data appear everywhere in public life: elections and polling, public health reports, education statistics, business market share, social surveys, and scientific research. Reading these responsibly requires a set of critical questions.
1. Sample size? A percentage based on 20 respondents is far less reliable than one based on 2,000.
2. Who was surveyed? A convenience sample of online volunteers differs greatly from a representative probability sample.
3. Counts or proportions? Identify which is being reported and ask for the other if it is missing.
4. All categories reported? Look for missing categories or selectively omitted groups.
5. Visual display accurate? Check axes, scales, and 3D effects.
6. Association vs. causation? Watch for causal language applied to observational data.
7. How was data collected? Response rates, survey wording, and data source all matter.
Sample size: Not stated — could be 25 or 2,500. The claim is based on unknown data volume.
Who was surveyed: Were all business owners contacted, or only downtown association members?
Survey question wording: Not stated — phrasing strongly influences responses.
Completeness: "Business community" is broad — suburban and small businesses may differ.
Editorial language: "Strongly supports" is a judgment — 72% majority, but 28% opposed.
"Our school has 60 multilingual students; the neighboring school has only 20."
If the first school has 1,200 students (5%) and the second has 150 students (13%), the count comparison tells the wrong story. Use relative frequencies when comparing groups of different sizes.
Students who eat school lunch are more likely to report feeling tired — therefore school lunch causes tiredness.
Use careful language: "associated with," "related to," or "linked to" rather than "causes" when describing observational data. Many confounding variables could explain both eating school lunch and tiredness.
60 females prefer Product A out of 100 females total — student calculates 60 ÷ 200 = 30% instead of 60 ÷ 100 = 60%.
Identify which question you are answering: "What proportion of females…?" requires dividing by the number of females, not the grand total.
"60% of all students prefer online resources, so 60% of students in each grade prefer online resources."
The marginal distribution describes the full sample, not individual groups. Use conditional distributions when making claims about specific subgroups.
51% of Group A and 49% of Group B prefer Option X — student concludes there is a meaningful association.
Small differences between conditional distributions may be due to chance variation in the sample. Formal hypothesis tests (Chapter 13) exist to evaluate whether observed differences are statistically meaningful.
A pie chart with 18 categories — sectors become tiny, labels overlap, display is unreadable.
Combine small categories into an "Other" group, or use a bar graph instead. Pie charts should generally have no more than five categories.
Two bars at 62% and 58% look very different because the axis runs from 55% to 65%.
Always check the vertical axis scale before interpreting bar heights. If the axis does not start at zero, adjust your interpretation accordingly.
Each problem shows a student's work or a claim. Identify the error and write the correct response.
A two-way table shows 60 females out of 100 females total prefer Product A. 140 out of 200 total respondents prefer Product A. A student calculates: "60 ÷ 200 = 30% of females prefer Product A."
60 ÷ 200 = 30% of females prefer Product AIdentify the error. What is the correct calculation? Why does the error lead to a misleading conclusion?
A student builds a relative frequency table and calculates: Pop 10/30 = 33.3%, Rock 7/30 = 23.3%, Hip-Hop 7/30 = 23.3%, Classical 4/30 = 13.3%, Jazz 2/30 = 6.7%. The student says: "The totals don't add to 100%, so I made an error somewhere."
These relative frequencies don't sum to 100%, so the table is wrong.Is the student correct that there is an error? Explain what is actually happening and how to respond.
A report states: "Neighborhoods with more coffee shops have higher property values. Therefore, opening more coffee shops causes property values to rise."
Opening more coffee shops causes property values to rise.Identify the statistical error in this reasoning. Suggest at least one confounding variable that might explain both the number of coffee shops and the property values.
A news story says: "City A has 800 residents who use public transit daily. City B has only 200." The reporter concludes: "City A has a much stronger culture of public transit use."
City A has a much stronger culture of public transit use.What critical information is missing? Explain how the conclusion could be completely reversed if the missing information were provided.
A student uses the marginal distribution of a two-way table (overall 65% of students prefer a digital format) to conclude: "Since 65% of all students prefer digital, about 65% of students in each grade level prefer digital."
The marginal distribution applies equally to each grade level.Explain why this conclusion is not valid. What tool should be used instead to describe format preferences within each grade level?
The tools introduced in Chapter 3 — frequency tables, relative frequency tables, two-way tables, conditional distributions, bar graphs, and segmented bar graphs — are the foundation for formal statistical inference about categorical data.
In Chapter 4, you will turn from categorical variables to quantitative variables, where the tools change — dot plots, stem-and-leaf plots, histograms, and box plots replace bar graphs — but the same questions persist: What is the shape? Where is the center? How much spread is there? Are there outliers?
In Chapter 9, you will return to two-way tables through the lens of conditional probability and independence. The conditional distribution of one variable given another is mathematically equivalent to a conditional probability, and association in a two-way table corresponds to statistical dependence between events.
In Chapter 13, you will learn about the chi-square test for association — a formal hypothesis test that determines whether observed differences in conditional distributions are larger than what chance variation alone would produce. That test asks the formal version of the question you learned to answer informally here: is there real evidence of association?
In college statistics and data science, two-way tables and conditional distributions are revisited in the context of tests for independence, relative risk, odds ratios, logistic regression, and epidemiological study design. The proportional reasoning skills you develop in this chapter are directly applicable to research in psychology, medicine, public health, social science, and business analytics.