Lesson 1 / 13 · 11 min read
Descriptive Statistics
Mean, median, mode, range, variance, and standard deviation.
Measures of center
For a dataset, "center" can mean different things.
Mean (average): sum the values, divide by the count.
xˉ=n1∑i=1nxi
Median: the middle value when the data is sorted. If n is even, average the two middle values.
Mode: the value that appears most often. (A dataset can have multiple modes or none.)
Example. Data: {2,4,4,6,9}.
- Mean: (2+4+4+6+9)/5=25/5=5
- Median: middle value is 4
- Mode: 4 (appears twice)
Mean vs. median — when does it matter?
The mean is sensitive to outliers. The median isn't.
Salaries at a small company: {40k,42k,45k,48k,500k}.
- Mean: 135k (misleading — only the CEO earns near that)
- Median: 45k (a much more honest sense of the typical employee)
Rule of thumb: use the median when data is skewed or has outliers.
Measures of spread
Range = max − min. Simple but ignores everything in the middle.
Variance (σ2 or s2): average squared distance from the mean.
σ2=n1∑i=1n(xi−xˉ)2
(For a sample variance you divide by n−1 instead of n — Bessel's correction.)
Standard deviation (σ or s): the square root of the variance.
σ=σ2
Standard deviation lives in the same units as the data, which is why it's the spread measure people quote.
A worked example
Data: {2,4,4,4,5,5,7,9}. Mean = 5.
| xi | xi−xˉ | (xi−xˉ)2 |
|---|---|---|
| 2 | -3 | 9 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
Sum of squared deviations = 32. Variance (population) = 32/8=4. Standard deviation = 4=2.
Key takeaways
- Mean, median, mode all describe the center — choose based on the data.
- Mean is pulled around by outliers; median isn't.
- Standard deviation is the most-used measure of spread.