Track 2 · Describing Data · Lesson 4 of 11
Variance and standard deviation
Calculate the range, variance and standard deviation, choose between the sample (n − 1) and population (n) versions, and interpret a standard deviation in context.
Two couriers both average 40 minutes per delivery. One is almost always between 35 and 45 minutes; the other swings from 15 to 70. Customers experience the second as unreliable — and the mean alone cannot tell them apart. Measures of spread can.
The simplest measure of spread is the range: maximum minus minimum. It is easy to compute and to explain, but it depends on only two observations — the most extreme ones — so a single unusual value can double it.
A better measure uses every observation and asks: how far, typically, is a value from the mean? Each value's deviation is . Deviations above the mean are positive, those below are negative, and they always add up to exactly zero — so their plain average is useless. Squaring them removes the signs.
- the deviation of the -th value from the sample mean
- the sum of squares (SS): total squared deviation
- the degrees of freedom: one less than the number of observations (see below)
- the standard deviation, in the same units as the data (the variance is in squared units)
- the population mean
- the population size (every member is measured)
Worked example
Five waiting times
A clinic samples five patients' waiting times (minutes): 4, 8, 6, 5, 7. Find the sample variance and standard deviation.
Mean: .
Deviations: (they add to 0, as they always do).
Squares and their sum: , so SS .
Sample variance: minutes². Standard deviation: minutes.
If these five were the entire population of interest, minutes.
s² = 2.5 min², s ≈ 1.58 minutes: a typical wait is about 1.6 minutes away from the mean of 6.
| Your data are… | Use | Software |
|---|---|---|
| A sample, used to learn about a larger population or process (almost always) | , divide by | Excel STDEV.S, R sd(), pandas .std() |
| The complete population, and you only want to describe it | , divide by | Excel STDEV.P, NumPy np.std() default |
Interpreting . The standard deviation is roughly the typical distance of an observation from the mean. In the (synthetic) commute dataset, minutes around a mean of 37.3 minutes: commutes vary a lot from employee to employee. For the 60 delivery routes in delivery_process, the average time per parcel before a routing change has minutes around a mean of 43.1 minutes.
Two useful facts: adding a constant to every value does not change (everything shifts together), and multiplying every value by a constant multiplies by and the variance by .
Quick check
Every delivery time in a dataset is increased by 5 minutes (a new loading procedure). What happens to the standard deviation?
Exercises
The lesson is complete when every exercise is answered correctly. Hints are free; viewing a worked solution before solving means the exercise won't count towards mastery.
0 of 8 exercises correct (not saved — sign in to keep your progress)
Exercise 1 · Guided, difficulty 1 of 3
Sum of squares and variance
A call centre supervisor samples the number of calls five agents handled in an hour: 32, 15, 27, 22, 29.
Find (a) the sum of squared deviations from the mean and (b) the sample variance. Give both to 2 decimal places.
Exercise 2 · Practice, difficulty 1 of 3
Sample standard deviation
A gym records the resting heart rate (beats per minute) of eight randomly chosen members:
80.8, 67.5, 78.0, 83.7, 63.8, 60.5, 78.8, 76.8
Calculate the sample standard deviation to 2 decimal places.
Exercise 3 · Practice, difficulty 2 of 3
A whole population
A retail chain has exactly six branches. Last month their numbers of customer complaints were 26, 54, 52, 20, 26, 50. The regional manager wants to describe the variation among these six branches — not to estimate anything beyond them.
Calculate the appropriate standard deviation to 2 decimal places.
Exercise 4 · Application, difficulty 2 of 3
Variability before and after a routing change
The delivery_process dataset records the average delivery time per parcel on 60 routes before (before_min) and after (after_min) a routing change. Treat the routes as a sample. Calculate the sample standard deviation of each column and the range of after_min, all to 2 decimal places.
Data: delivery_process · Open in the lab to explore and calculate.
Exercise 5 · Challenge, difficulty 3 of 3
Changing units
A company's commute times have mean 29 minutes and standard deviation 17 minutes.
(a) Roadworks add exactly 6 minutes to every employee's commute. What is the new standard deviation, in minutes?
(b) Going back to the original times, an analyst converts them to hours. What is the variance in hours²? Give it to 4 decimal places.
Exercise 6 · Practice, difficulty 2 of 3
n or n − 1?
For each situation, decide which standard deviation is appropriate.
Exercise 7 · Interpretation, difficulty 2 of 3
What does s = 8.6 minutes mean?
After a routing change, the average delivery time per parcel across 60 routes has mean 40.4 minutes and standard deviation 8.6 minutes. Which interpretation is correct?
Exercise 8 · Interpretation, difficulty 3 of 3
Explain n − 1
A colleague asks why spreadsheet function STDEV.S divides by instead of . In two or three sentences, explain the reason.
What you can now do
- Calculate the range, variance and standard deviation by hand and from a dataset
- Choose the sample (n − 1) or population (N) version and explain why
- Predict how adding a constant or changing units affects the SD and variance
- Interpret a standard deviation as a typical distance from the mean, in context