From Recorded Responses to Category Counts
A categorical variable records each individual in a group, such as a preferred transport mode or a type of appointment. Before comparing categories or displaying them in a graph, it is useful to know how many observations fall into each category and what share of the observations each count represents. Those quantities are category counts and relative frequencies.
A total can also serve as a basic data check. If each included observation belongs to exactly one category, the category counts should add to the number of included observations. If they do not, the categories may overlap, omit a possible response, or have been counted incorrectly. Missing responses need particular care: the denominator should match the set of observations whose responses are actually being summarized.
The subscript \(j\) identifies a category; it does not change what is counted. For example, if a variable has the categories bus, bicycle, and walking, \(n_{\text{bus}}\) is the number of included observations classified as bus. Each count is a whole number greater than or equal to zero. A relative frequency is between 0 and 1, inclusive, and a percentage is between 0% and 100%, inclusive.
Here, \(\hat{p}_j\) describes the observed data being summarized. It is not automatically the proportion in a larger population. If the data are a sample, a sample proportion may be used to estimate a population proportion, but that is a separate inferential question.
When Should Category Counts Add to the Total?
For category counts to add exactly to \(n\), the categories must form a partition of the observations included in the calculation. This means two conditions hold. Mutually exclusive categories do not overlap: no included observation belongs to more than one category. Exhaustive categories cover all included observations: each one belongs to at least one category. Together, these conditions mean each included observation is counted once and only once.
The denominator is part of this check. If \(n\) means the number of people with a recorded, valid response, then the categories need to cover those valid responses. People who did not answer are not included in that \(n\). If the analysis instead defines “no response” as its own category, those observations are included in the denominator and counted there. Either approach can be appropriate, but the choice should be clear and consistent.
Why the Totals Agree: A Short Justification
Suppose there are \(k\) categories and every included observation belongs to exactly one of them. Each of the \(n\) observations therefore contributes 1 to one category count and 0 to all the others. Adding the counts counts every observation once, so the total is \(n\). Dividing that identity by the same positive denominator \(n\) gives the relative-frequency identity:
Multiplying each relative frequency by 100 gives percentages whose exact sum is 100%. The logic depends on using the same set of observations and the same denominator throughout. If categories overlap, some observations contribute more than once. If categories omit responses, some contribute zero times. In either case, the count total need not equal \(n\).
Worked Examples
Worked Example: Counts and Percentages for Travel Modes
Suppose, in a clearly hypothetical survey, 12 students each report one usual way of getting to campus. Their responses are: bus, walking, bicycle, bus, car, walking, bus, bicycle, walking, bus, car, bus. Calculate each category count and percentage, then check the totals.
The listed categories are bus, walking, bicycle, and car. Each student gave exactly one response, and every response belongs to one of those categories. Thus, for these 12 recorded responses, the categories are mutually exclusive and exhaustive. The denominator is \(n=12\).
Counting the responses gives 5 bus, 3 walking, 2 bicycle, and 2 car. The counts add to \(5+3+2+2=12\), as expected. The bus relative frequency and percentage are:
For walking, \(\hat{p}_{\text{walking}}=3/12=0.2500\), or 25.00%. For bicycle, \(\hat{p}_{\text{bicycle}}=2/12=0.1667\), or 16.67%. For car, \(\hat{p}_{\text{car}}=2/12=0.1667\), or 16.67%. Before rounding, the relative frequencies add to \((5+3+2+2)/12=1\). The displayed percentages total 100.01% because the repeating decimal \(2/12\) has been rounded to four significant figures before conversion. The small excess is a rounding effect, not a disagreement in the counts.
In context, 5 of the 12 hypothetical students reported bus as their usual travel mode, representing about 41.7% of the recorded responses. This describes these 12 responses; by itself, it does not establish the percentage for all students at the campus.
Worked Example: A Denominator That Excludes Missing Responses
Suppose a hypothetical clinic asks 20 visitors to select one of three appointment times: morning, afternoon, or evening. Eighteen provide a valid selection, and two leave the question blank. Among the valid selections, 9 are morning, 6 are afternoon, and 3 are evening. Calculate the proportions among valid responses and check their count total.
For this calculation, define the included observations as the 18 visitors who supplied a valid answer, so \(n=18\). The three time categories are mutually exclusive because each person selected just one time, and exhaustive because each valid answer is one of the three listed times. The blank responses are not part of the valid-response categories.
The counts agree with the chosen denominator: \(9+6+3=18\). The morning proportion and percentage among valid responses are:
The afternoon proportion is \(6/18=0.3333\), or 33.33%, and the evening proportion is \(3/18=0.1667\), or 16.67%. Their exact proportions sum to \((9+6+3)/18=1\). The interpretation must name the denominator: 50.0% of the 18 visitors with valid responses selected morning, not 50.0% of all 20 visitors.
A different summary could include “blank” as a fourth category. Then the denominator would be 20, and the counts would be 9 morning, 6 afternoon, 3 evening, and 2 blank. Those counts also total 20. The two summaries answer different questions, so they should not be mixed: using counts that total 20 with a denominator of 18 would produce invalid relative frequencies.
Worked Example: Overlapping Categories Do Not Partition People
Suppose 10 hypothetical patients are asked which of two reminder methods they used, and they may select both text message and email. Six report using a text message and 5 report using email. Three report using both. Check whether these two category counts should total 10.
They should not be expected to total 10, because the categories overlap. The 3 patients who used both are included in both counts. Adding the two counts gives \(6+5=11\), which counts those 3 patients twice. The total of 11 is not a count of distinct patients.
If the question is instead how many patients used at least one method, count the overlap only once. Of the 6 text-message users, 3 also used email, so 3 used text message only. Of the 5 email users, 3 also used text, so 2 used email only. Including the 3 who used both gives \(3+2+3=8\) patients who used at least one method. The remaining \(10-8=2\) used neither.
For a summary of each method separately, a proportion can still be calculated with all 10 patients as the denominator: \(6/10=60\%\) used text messages and \(5/10=50\%\) used email. These percentages add to 110%, which is not an error because a patient may be in both groups. They are not percentages of a set of mutually exclusive categories.
Using Totals as a Practical Check
A mismatch between a category-count total and the stated number of observations is a reason to investigate, not a reason to force the numbers to agree. Check what the denominator represents, whether a response can belong to multiple categories, whether a category has been omitted, and whether missing or invalid responses have been handled consistently. A count total smaller than \(n\) may signal uncovered observations; a total larger than \(n\) may signal overlapping categories or duplicate counting. Either pattern can also arise from a simple counting or data-entry error.
Category definitions need to be precise enough to avoid accidental gaps or overlaps. For instance, if age is grouped into “under 20” and “20 or older,” a person aged exactly 20 belongs to one clear category. In contrast, categories described as “under 20” and “20 and older,” alongside “20 or older,” would overlap if both latter descriptions were used. When labels are ambiguous, the tally may be inconsistent even if the arithmetic is correct.
Rounding should be checked separately from counting. The counts and unrounded proportions are the primary check: if the counts sum to \(n\), then the exact proportions sum to 1 under the partition conditions. Percentages rounded for display may sum to slightly less or more than 100%. If the difference is small and can be explained by rounding, it does not imply that an observation is missing. If the difference is large, review the counts and denominator rather than attributing it to rounding.
Common Mistake
Wrong reasoning: “These category counts add to more than the number of people, so one count must be wrong.” That conclusion is not justified when people may select more than one response. In the reminder-method example, the three people who used both methods appear in both counts, so the total of 11 counts selections, not distinct patients.
Correction: First decide what is being counted: people assigned to exactly one category, or responses/selections that may overlap. Check whether categories are mutually exclusive and exhaustive for the chosen set of observations. Then use a denominator that matches that set and state it when reporting a proportion. Only expect counts to add to \(n\) when every included observation belongs to exactly one category.
Check Your Understanding
Use the category definitions and denominator in each question when deciding what totals to expect.
- In a hypothetical group of 25 people, 10 choose tea, 9 choose coffee, and 6 choose water as one preferred drink. Calculate the percentage choosing coffee and check the count total.
- A question has 30 participants, but only 27 give a valid answer. If a proportion is calculated among valid answers, what should its denominator be, and how could the three blank answers be handled in a separate summary?
- Why might counts for “uses a bicycle” and “uses public transit” add to more than the number of people surveyed?
- Three mutually exclusive and exhaustive categories have counts 8, 7, and 5. What is \(n\), and what should the three relative frequencies add to?
- Displayed percentages add to 99.9%, while the underlying counts add to the stated total. Give one possible explanation and one check that would help distinguish rounding from a counting problem.