Statistics
Mean, median and standard deviation
How to describe the centre and the spread of a data set, and which measure to trust when.
About 10 minutes
Two questions summarise most data sets: where is the middle, and how spread out are the values? Different measures answer these questions, and they can disagree — which is itself informative.
Measures of centre
The mean is the sum of the values divided by their number. It uses every value, so a single extreme value can pull it a long way.
The median is the middle value of the sorted data (or the average of the two middle values). Half the data lies on each side, and extreme values barely affect it. The mode is the most frequent value.
When the mean is well above the median, the data is usually skewed to the right by a few large values — incomes are the classic example.
Measures of spread
The range is the maximum minus the minimum. The interquartile range is the spread of the middle half of the data, Q_3 - Q_1.
The variance is the average squared distance from the mean, and the standard deviation is its square root, which puts it back in the units of the data. For roughly bell-shaped data, about 68% of values lie within one standard deviation of the mean and about 95% within two.
Sample or population?
If the data covers the entire group of interest, divide by (population variance, \sigma^2). If the data is a sample used to estimate a larger group, divide by n - 1 (sample variance, s^2). The smaller divisor compensates for the fact that a sample tends to be less spread out than the population it came from.
Worked examples
Find the mean and median of 2, 4, 6, 8.
- Mean:
(2 + 4 + 6 + 8) / 4 = 20 / 4 = 5. - Median: the two middle values are 4 and 6; their average is 5.
Answer: Mean 5, median 5
Find the sample standard deviation of 2, 4, 6, 8.
- Deviations from the mean 5:
-3, -1, 1, 3. - Squares:
9, 1, 1, 9; their sum is 20. - Divide by
n - 1 = 3: variance\approx 6.667. - Square root:
s \approx 2.582.
Answer: s \approx 2.582
Common mistakes
- Finding the median without sorting the data first.
- Dividing by when the data is a sample (or by
n - 1for a full population). - Reporting the variance when the standard deviation was asked for — forgetting the square root.
- Using the mean to describe strongly skewed data, where the median is more representative.
Practice problems
- 1.Mean of 3, 7, 8, 10, 12
- 2.Median of 9, 2, 7, 4
- 3.Range of 5, 11, 3, 8
- 4.Population standard deviation of 2, 4, 4, 4, 5, 5, 7, 9
Tools for this lesson
Next lesson: The basic rules of probability