a. Categorical Data
We can summarize a categorical variable using a frequency table:
| identity | count |
|---|---|
| No Dual | 1,511 |
| Public | 6,068 |
| Secret | 7,928 |
| Unknown | 9 |
| Total | 15,516 |
Recall from 1a: A categorical variable takes values that are labels — categories each case falls into.
A summary statistic is a single number that summarizes a sample.
For categorical data, the common summary statistics are:
Means, medians, and standard deviations are summary statistics for numerical data — that’s the focus of 2b.
Proportion: What fraction of comic characters have a secret identity?
\text{Proportion} = \frac{\text{Count}}{\text{Total}} = \frac{7,928}{15,516} = 0.511
Percentage: What percent of comic characters have a secret identity?
\text{Percentage} = \text{Proportion} \times 100 = 0.511 \times 100 = 51.1\%
Adding proportions to the table reveals patterns more clearly than raw counts:
| identity | count | proportion |
|---|---|---|
| No Dual | 1,511 | 0.097 |
| Public | 6,068 | 0.391 |
| Secret | 7,928 | 0.511 |
| Unknown | 9 | 0.001 |
| Total | 15,516 | 1.000 |
Counts tell you how many. Proportions tell you how much — the share each category takes of the whole.
Frequency table for comic character alignment:
| alignment | count |
|---|---|
| Bad | 7,146 |
| Good | 6,052 |
| Neutral | 2,316 |
| Reformed Criminals | 2 |
| Total | 15,516 |
Compute each — advance for answers:
| Question | Answer |
|---|---|
| Proportion of Good characters | 0.39 |
| Percentage of Bad characters | 46.1% |
| Proportion that are not Neutral | 0.851 |
We can visualize categorical data using a bar plot:
Bar length encodes the count — the visual makes it easy to compare categories at a glance.