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.

30 minFoundation8 graded exercisesFree

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 xi−xˉx_i - \bar{x}. 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.

s2=∑i=1n(xi−xˉ)2n−1,s=s2s^2 = \frac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n - 1}, \qquad s = \sqrt{s^2}
Sample variance and sample standard deviation (the default in this course and in most software)
xi−xˉx_i - \bar{x}
the deviation of the ii-th value from the sample mean
∑(xi−xˉ)2\sum (x_i - \bar{x})^2
the sum of squares (SS): total squared deviation
n−1n - 1
the degrees of freedom: one less than the number of observations (see below)
ss
the standard deviation, in the same units as the data (the variance is in squared units)
σ2=∑i=1N(xi−μ)2N,σ=σ2\sigma^2 = \frac{\sum_{i=1}^{N} (x_i - \mu)^2}{N}, \qquad \sigma = \sqrt{\sigma^2}
Population variance and standard deviation — when the data ARE the whole population of interest
μ\mu
the population mean
NN
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.

  1. Mean: xˉ=(4+8+6+5+7)/5=30/5=6\bar{x} = (4 + 8 + 6 + 5 + 7)/5 = 30/5 = 6.

  2. Deviations: −2,2,0,−1,1-2, 2, 0, -1, 1 (they add to 0, as they always do).

  3. Squares and their sum: 4+4+0+1+1=104 + 4 + 0 + 1 + 1 = 10, so SS =10= 10.

  4. Sample variance: s2=10/(5−1)=2.5s^2 = 10/(5 - 1) = 2.5 minutes². Standard deviation: s=2.5=1.58s = \sqrt{2.5} = 1.58 minutes.

  5. If these five were the entire population of interest, σ=10/5=1.41\sigma = \sqrt{10/5} = 1.41 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…UseSoftware
A sample, used to learn about a larger population or process (almost always)ss, divide by n−1n - 1Excel STDEV.S, R sd(), pandas .std()
The complete population, and you only want to describe itσ\sigma, divide by NNExcel STDEV.P, NumPy np.std() default
Which version?
Loading the interactive…
Drag the points and watch the range and the standard deviation respond.

Try this

  • Drag the 95-minute point down to 40. By how much does the standard deviation fall? The range?

  • Move every point 10 units to the right. The mean changes — does the standard deviation?

  • Bunch all points tightly around 30. What happens to ss as the points get closer together?

Interpreting ss. The standard deviation is roughly the typical distance of an observation from the mean. In the (synthetic) commute dataset, s=23.8s = 23.8 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 s=8.2s = 8.2 minutes around a mean of 43.1 minutes.

Two useful facts: adding a constant to every value does not change ss (everything shifts together), and multiplying every value by a constant cc multiplies ss by ∣c∣|c| and the variance by c2c^2.

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

Not started

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

Not started

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.

bpm

Exercise 3 · Practice, difficulty 2 of 3

A whole population

Not started

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

Not started

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

Not started

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?

Not started

For each situation, decide which standard deviation is appropriate.

Waiting times of 40 randomly selected patients, used to judge the variability of all patients' waits
Salaries of the 7 members of a board, reported only to describe that board
Fill volumes of 25 bottles taken from a production line to monitor the process
Exam scores of all 30 students in a class, used only to describe that class's results
Blood pressure readings of 120 trial participants, used to draw conclusions about patients in general

Exercise 7 · Interpretation, difficulty 2 of 3

What does s = 8.6 minutes mean?

Not started

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?

Choose one

Exercise 8 · Interpretation, difficulty 3 of 3

Explain n − 1

Not started

A colleague asks why spreadsheet function STDEV.S divides by n−1n - 1 instead of nn. In two or three sentences, explain the reason.

0 words

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