Variance and standard deviation
Two data sets can share the same mean and look nothing alike. The range, the variance and the standard deviation measure what the mean cannot see: how widely the data is spread around it.
Before you start
This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:
- Mean, median and modeThree answers to one question: which single number best describes a whole data set. The mean shares the total out evenly, the median stands exactly in the middle, and the mode points at the most frequent value — and which one you pick can change the conclusion.
- RootsA root is the inverse of raising to a power. Learn square and cube roots, arithmetic with roots, taking a factor out of a radical, and rationalising a denominator.
All formulas
Range
the simplest measure of spread — it looks only at the two extremes
Deviation from the mean
the deviations always sum to zero, which is why they cannot be averaged as they are
Variance
the mean of the squared deviations from the mean
Standard deviation
the square root of the variance — back in the units of the data
Shortcut formula
the mean of the squares minus the square of the mean — quicker to compute
Sample variance
divisor n − 1, when the data is a sample drawn from a larger population
Two data sets can share a mean and have nothing else in common. The results and the results both have a mean of , but the first is predictable and the second is all over the place. The measures of location from the previous lesson cannot see that difference — measures of spread exist for it.
The range
The simplest of them is the range: the distance between the largest and the smallest value.
It takes a second to compute and is worth about that much: it uses only two observations. A set where everything sits near the mean and one value runs off has the same range as a set spread evenly. A serious description needs a measure that looks at every observation.
Deviation from the mean
The natural idea: for each observation, work out how far it lies from the mean.
Except that these deviations cannot simply be averaged. For every data set:
The positive and negative deviations cancel exactly — which is really another way of saying what a mean is. Their average is always zero, so it is useless as a measure of spread.
The fix is the square: it removes the sign and, along the way, weights large deviations more heavily than small ones.
Variance
The variance is the mean of the squared deviations:
Three steps: find the mean, find the deviations, average their squares.
The same result comes out of the shortcut formula, which never writes a deviation down:
Check it on the same data: . It agrees. This version is far quicker whenever the mean is not a whole number.
Standard deviation
The variance has one flaw: it lives in squared units. If the data is money, the variance comes out in "squared pounds", which compares to nothing. So we take the root:
The standard deviation is in the same units as the data and says directly what order of magnitude the deviations from the mean are. Beware the popular shorthand "σ is the average distance from the mean" — it is not: the average distance is a different measure (the mean absolute deviation), while σ is the root of the mean of the squares, so it weighs large deviations more heavily and always comes out at least as big.
For the set in the example above, . That says the results stay within about two units of the mean of — roughly between and .
The root almost never comes out "nice", and that is normal: a variance may be a whole number, a standard deviation usually is not. That is why is quoted rounded, most often to two decimal places.
Same mean, different spread
Put two sets of five measurements side by side. The first:
The second has the same mean:
Both measures of spread:
The two means are identical and the standard deviation is three times larger in the second set. That is exactly what a description quoting only the mean throws away — and exactly why and are quoted together.
Population or sample
The variance formula sometimes carries the divisor instead of :
The difference is not cosmetic — it is about what the data is:
- population variance (, divisor ) — when the data is the entire group you are describing: every grade in the class, every measurement taken;
- sample variance (, divisor ) — when the data is a sample drawn from something larger and the conclusion is meant to be about that larger thing.
Why ? The deviations are measured from the sample mean, and that always sits closer to the data than the unknown population mean does. The sum of squares therefore comes out slightly too small, and the smaller divisor corrects it. For large data sets the difference is negligible; for a handful of values it is not.
The symbols themselves say which version is meant: and are population measures, and sample ones. The exercises below use the population variance and deviation, dividing by .
Shifting and rescaling the data
Two properties that save a lot of arithmetic:
- adding a constant to every observation changes nothing — not the range, not the variance, not the deviation, because the mean shifts along with the data and every stays put;
- multiplying every observation by multiplies the standard deviation by and the variance by .
Hence the practical rule: changing units (centimetres to metres) changes , but moving the point of reference does not.
Exercises
The three kinds of question match the three measures in this lesson. The Range prompt asks for the difference between the largest and the smallest value. The prompt asks for the variance and the prompt for the standard deviation — both for a population, that is with divisor . A standard deviation is almost never rational, so type it to two decimal places, for instance 3.16; a more precise answer is accepted too. The same tolerance applies to the harder variance questions, where that value comes out fractional as well.
Practice
Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.
Common mistakes
- Averaging the deviations without squaring — they sum to zero, so the answer would be 0 for every data set.
- Confusing the variance with the deviation — a question about needs the root; alone is not the answer yet.
- The wrong divisor — a population variance divides by , not by and not by the number of distinct values.
- Rounding mid-computation — round only the final , otherwise the error accumulates.
- Measuring deviations from the first value or from the median — the reference point is always the mean.
- A negative variance — if you got one, a square went missing somewhere: a mean of squares cannot be negative.
Formula card
Topic: Variance and deviation
Range
the simplest measure of spread — it looks only at the two extremes
Deviation from the mean
the deviations always sum to zero, which is why they cannot be averaged as they are
Variance
the mean of the squared deviations from the mean
Standard deviation
the square root of the variance — back in the units of the data
Shortcut formula
the mean of the squares minus the square of the mean — quicker to compute
Sample variance
divisor n − 1, when the data is a sample drawn from a larger population
