| identity | count |
|---|---|
| No Dual | 1,470 |
| Public | 5,958 |
| Secret | 7,691 |
| Unknown | 9 |
| Total | 15,128 |
Math 115

We can summarize a categorical variable using a frequency table:
| identity | count |
|---|---|
| No Dual | 1,470 |
| Public | 5,958 |
| Secret | 7,691 |
| Unknown | 9 |
| Total | 15,128 |
Example 1: What proportion of comic characters have a secret identity?
\[\text{Proportion} = \frac{\text{Count}}{\text{Total}} = \frac{7,691}{15,128} = 0.508\]
Example 2: What percentage of comic characters have a secret identity?
\[\text{Percentage} = \text{Proportion} \times 100 = 0.508 \times 100 = 50.8\%\]
Including proportions reveals patterns more clearly than raw counts:
| identity | count | proportion |
|---|---|---|
| No Dual | 1,470 | 0.097 |
| Public | 5,958 | 0.394 |
| Secret | 7,691 | 0.508 |
| Unknown | 9 | 0.001 |
| Total | 15,128 | 1.000 |
Secret identities (50.8%) are most common.
We can visualize categorical data using a bar plot:
Bar plot showing frequencies of identity variable levels
Moving to numerical data:
Why numerical data needs different tools:
Each dot = one Michigan county’s life expectancy
Two measures of center:
Mean: Arithmetic average
\[\bar{x}=\frac{x_1+x_2+\cdots+x_n}{n}\]
Median: Middle value when data are ordered
Michigan life expectancy data:
| mean | median |
|---|---|
| 78.04108 | 77.85 |
Mean (red, dashed) vs. Median (blue, solid)
Percentile: The Xth percentile is a value where X% of observations fall below.
Quartiles divide data into four equal parts:
| Q1 | median | Q3 |
|---|---|---|
| 77.3 | 77.85 | 78.8425 |
Consider the data set: 13, 16, 12, 14, 19, 12, 14, 13, 14
There are 9 points in the data set, n = 9
Drop the 9th point in the set so n = 8 and (n+1)/2 = 4.5
Find the 1st quartile of 9-point set
The 3rd quartile is the midpoint of the set’s second half
Measures of spread (variability):
Range: Maximum - minimum
Interquartile Range (IQR): Q3 - Q1
Most important spread measure:
\[s = \sqrt{\frac{\sum_{i=1}^n(x_i-\bar{x})^2}{n-1}}\]
Interpretation: Typical distance from the mean
Michigan life expectancy data:
| range | IQR | SD |
|---|---|---|
| 6.8 | 1.54 | 1.21 |
Complete summary:
| min | Q1 | median | Q3 | max | mean | SD |
|---|---|---|---|---|---|---|
| 75.08 | 77.3 | 77.85 | 78.84 | 81.88 | 78.04 | 1.21 |
Outlier: Data point unusually far from other observations
1.5×IQR rule: A point is an outlier if it is more than 1.5×IQR beyond Q1 or Q3
For Michigan counties:
Result: 2 Michigan counties identified as outliers (both with high life expectancy)
| County | Life Expectancy (years) |
|---|---|
| Leelanau County | 81.875 |
| Ottawa County | 81.290 |
Outliers shown in red
Car prices (MSRP): Mean = $29,783 (red-dashed); Median = $26,350 (blue-solid)
Mean > median indicates right skew (high prices pull mean upward)
When to use mean vs median:
When to use SD vs IQR:
Key principle: Choose measures that are resistant when data contain extreme values
Four common visualizations:
Each serves different purposes and reveals different aspects of the same data
Best for: Small datasets, seeing individual values
Best for: Large datasets, revealing overall shape
Best for: Smooth representation of distribution shape
Best for: Showing numerical summaries visually
Box construction: