How do we describe categorical data?
From “how many people” to “what share”: explore categorical variables using counts, proportions, and charts.
Start with the survey counts: how many people are in each category?
A categorical variable records categories, such as the way students most often travel to school. Below, each person can choose only one main category.
Adjust category counts
Adjust category counts
Whenever you change a category count, the frequency table and chart update together.
Categorical frequency table
| Category | Count | Proportion |
|---|---|---|
| Walking | 40 | 28.6% |
| Bicycle | 25 | 17.9% |
| Bus | 60 | 42.9% |
| Other | 15 | 10.7% |
| Total | 140 | 100.0% |
Counts and proportions answer different questions
A count is the actual number of people; relative frequency is the category's share of all observations. Multiply the relative frequency by 100% to obtain the percentage.
Adjust the survey counts yourself
Adjust category counts
Displayed values are rounded individually, so their sum may differ from 100.0% by 0.1 percentage points. Calculations still use unrounded values.
Percentage bar chart
Largest share: Bus, 42.9%
When sample sizes change, “more people” and “a larger proportion” must be compared separately.
What do bar charts and pie charts each show best?
Bar charts are useful for comparing category sizes; pie charts show the shares of nonoverlapping categories that together form a whole. Compare the two displays using the same data here.
Bar chart: compare sizes directly
Pie chart: examine the composition of a whole
- Walking
- Bicycle
- Bus
- Other
Choose an option.
Comparing two groups: why look at within-group percentages first?
Suppose we survey students in different years about whether they use AI tools. If the groups differ in size, comparing user counts directly can be misleading. First calculate the usage proportion within each group.
Survey data for two groups
Survey data for two groups
The usage proportion is 70.0% for first-year students and 70.0% for second-year students. The difference between the two sample proportions, in percentage points, is 0.0.
This only describes the observed difference in proportions between groups. It does not by itself establish a statistically significant difference between population proportions or establish causation.
Within-group percentages (100% stacked bar chart)
Corresponding 2×2 frequency table
| Group | Use AI | Do not use AI | Total |
|---|---|---|---|
| First year | 70 | 30 | 100 |
| Second year | 42 | 18 | 60 |
| Total | 112 | 48 | 160 |