Two revision guides are on the headteacher's desk. Both lift the average mark of twelve students to 73.7. With the first, the marks run from 49 to 95. With the second, every student lands between 70 and 77. She would buy the second without a pause, because it leaves nobody behind, and the average cannot tell her which guide is which.

Part 2 was about the one number that stands for the middle. This part is about the second number every summary needs, the one that says how far from the middle the students are. Three are in common use: the range, the interquartile range and the standard deviation. They become more useful and more demanding in that order, and the last of them carries much of the rest of this series. The effect size of Part 8 divides by it. The confidence interval is made from it. The question of how many students a study needs, in Part 11, cannot be asked without it.

So this part takes all three slowly. Each is worked by hand on the same twelve marks and drawn. Then the standard deviation gets the picture it is usually read with, the bell curve, and the part ends with the number it is most often confused with.

Two classes, one mean

Here are the two sets of marks. The first is real, in the sense that it is the twelve students with the guide from Part 1. The second is the imaginary guide that treats every student alike.

The twelve marks Mean Lowest to highest
First guide 49, 55, 58, 62, 66, 71, 79, 84, 86, 88, 91, 95 73.7 49 to 95
Second guide 70, 71, 72, 72, 73, 73, 74, 74, 75, 76, 77, 77 73.7 70 to 77
020406080100 exam mark first guide second guide mean 73.7, both rows 58.189.2 band: 15.5 marks either side band: 2.3 marks either side
Same mean, different classes. The shaded band is one standard deviation either side of the mean, the measure this part builds up to: 15.5 marks for the first guide, 2.3 for the second.

The mean cannot separate these two classes. A measure of spread can, and there are three to choose from.

The range

The simplest measure of spread is the range: the distance from the lowest value to the highest. For the first guide that is 95 − 49 = 46 marks. For the second it is 77 − 70 = 7.

It does its job here. Forty-six against seven is the difference the headteacher saw at a glance. Write-ups often give the two ends instead of the subtraction, "marks ranged from 49 to 95", which tells you more.

first guiderange 46: from 49 to 95 second guiderange 7 first guide, with one student moved from 49 to 20range 75: eleven students have not moved 020406080100exam mark
The range is set by the two students at the ends. Move one of them and the range changes by exactly as much as that student moved, whatever the other eleven did.

The weakness is in the third row of the figure. The range is decided by two students and ignores the other ten. Move the student on 49 down to 20, a bad day or a paper marked wrongly, and the range jumps from 46 to 75 although eleven students have not moved at all. The two students at the ends are also the two least typical, so the range is built entirely from the least representative part of the data.

It has a second weakness that is easier to miss. The range can only grow as you add students. Every new student is another chance of a mark beyond the current ends, so a year group of 200 will almost always have a wider range than a class of 12 drawn from it, without being any more varied. Ranges from groups of different sizes cannot fairly be compared.

So the range is worth looking at as a check on the data, because a mark of 140 out of 100 shows up at once. It is not much use as the measure of spread.

Quartiles and the interquartile range

The cure for the range's weakness is to stop looking at the ends. Part 2 found the median by sorting the marks and cutting the list in half. Cut each half in half again and you have the quartiles: three cut points that split the students into four equal groups.

Here are the first guide's twelve marks, sorted, with the cuts drawn in:

49, 55, 58 | 62, 66, 71 | 79, 84, 86 | 88, 91, 95

  • The lower quartile is the point a quarter of the way up the list. It falls between the third mark and the fourth, 58 and 62.
  • The median is the halfway point, between the sixth and seventh marks, 71 and 79. Part 2 put it at 75.
  • The upper quartile is the point three quarters of the way up, between the ninth and tenth marks, 86 and 88.

Where exactly between? The median takes the midpoint. For the quartiles, the most common software rule places the lower one three quarters of the way from 58 to 62, which is 61, and the upper one a quarter of the way from 86 to 88, which is 86.5. Other packages use slightly different rules and would say 60 and 87. With twelve students the choice moves the answer by a mark. With two hundred it is invisible.

lower quartile 61median 75upper quartile86.5 3 students333 students interquartile range: 25.5 marks, the middle half 020406080100exam mark
Three cuts, four groups of three students. The interquartile range is the distance between the outer two cuts, and it holds the middle half of the class.

The interquartile range (IQR) is the distance between the lower and upper quartiles: 86.5 − 61 = 25.5 marks. It is the width of the middle half of the students. Like the range, it is often more useful given as its two ends: "the middle half of the students scored between 61 and 86.5".

Now repeat the test that broke the range. Move the student on 49 down to 20. The lower quartile still sits between 58 and 62, so it is still 61, and the IQR is still 25.5. That student could score zero and nothing would change. This resistance to extreme values is the property the median has, which is why the two are reported as a pair: the median for the middle, the IQR for the spread.

The tutoring bills from Part 2 show it at full strength. The bills run from £181 to £3,120, a range of £2,939 that is almost entirely one family. The quartiles are £252 and £431. The middle half of the families spent within about £180 of each other, and the big spender does not touch that figure.

The price is that the IQR ignores half the data on purpose. Everything in the two outer quarters could be rearranged and it would not notice.

The box plot

A box plot is the quartiles drawn as a picture, and it is the picture to look for in any results section. It is built from five numbers: the lowest value, the lower quartile, the median, the upper quartile and the highest value.

lowest49lower quartile61median75upper quartile86.5highest95 the studentsthe box plotwhiskerwhisker 020406080100exam mark
A box plot is five numbers drawn to scale. The box is the middle half of the students, the line inside it is the median, and the whiskers reach out to the rest.

Three things can be read off it without any arithmetic. The length of the box is the IQR, so a long box means a spread-out middle. If the median line sits off-centre in the box, the middle half is lopsided. If one whisker is much longer than the other, the data have a tail on that side.

Its real strength is comparison, because several boxes fit side by side on one axis where several lists of numbers would not.

020406080100 exam mark with quarter: 61median 75three quarters: 86.5 without
A box plot: the box is the middle half, the bar is the median, the whiskers reach the rest. Once you can read one you can see at a glance both that the guide helps and that the two groups overlap a great deal.

The box for the students with the guide sits to the right of the other, so the guide helps. The two boxes also overlap by about a third of their width, so plenty of students without the guide beat plenty of students with it. A table of two means shows the first fact and hides the second.

One refinement, which explains the lone dots you will see on published box plots. Most software does not run the whiskers all the way to the ends. It stops each whisker at the last value that lies within one and a half box-lengths of the box, and draws anything further out as a separate dot, an outlier.

For the marks, nothing is that far out, so the whiskers reach the ends as drawn above. The tutoring bills are another matter. Their box is £179 long, so the upper limit for a whisker is £431 + 1.5 × £179, which is about £699. Two families are beyond it.

limit for the whisker: £699 7843,120 outliers, drawn as lone dotsthe box: £252 to £431 01,0002,0003,000pounds spent on tutoring
The tutoring bills as a box plot. The whisker stops at £517, the last bill inside the limit, and the families who spent £784 and £3,120 are drawn as outliers.

Two cautions. The one-and-a-half rule is a drawing convention, not a test. A dot marked as an outlier is a value to look at, not a value to delete, and here both dots are real families. And notice how the box in that figure is squashed into the left-hand corner. For long-tailed quantities a box plot is usually drawn on the logarithmic axis from Part 2, which spreads the ordinary families out and brings the big spender back into the picture.

The standard deviation, one step at a time

The range listens to two students, and the interquartile range sets the outer half aside. The standard deviation asks every student the same question, "how far are you from the mean?", and reports a typical answer. That makes it the most informative of the three and the easiest to distort, and the recipe is worth doing once by hand.

Take the first guide's twelve marks again. The mean is 884 divided by 12, which is 73.7.

Step one: each student's distance from the mean. The student on 49 is 24.7 marks below it. The student on 95 is 21.3 above. Below counts as negative, above as positive.

Step two: square each distance. A distance of −24.7 becomes 608.4. Squaring does two jobs, which the next section explains. For now, notice that it removes the minus signs.

Mark Distance from 73.7 Distance squared
49 −24.7 608.4
55 −18.7 348.4
58 −15.7 245.4
62 −11.7 136.1
66 −7.7 58.8
71 −2.7 7.1
79 +5.3 28.4
84 +10.3 106.8
86 +12.3 152.1
88 +14.3 205.4
91 +17.3 300.4
95 +21.3 455.1
Total 0.0 2,652.7

Step three: add up the squares. The total is 2,652.7, and it has a name, the sum of squares. (The column shows rounded figures. The total is from the unrounded ones.)

Step four: divide by one less than the number of students. There are twelve students, so divide by eleven: 2,652.7 / 11 = 241.2. This is the variance. Its unit is marks squared, which nobody can picture.

Step five: take the square root. The square root of 241.2 is 15.5, and we are back in marks. That is the standard deviation, usually written SD.

Run the same five steps on the second guide's marks and the answer is 2.3. The headteacher's instinct now has a number: the first guide leaves a typical student 15.5 marks from the average, the second leaves them 2.3 away.

Two of those steps look arbitrary. Why square the distances when you could just ignore the minus signs? And why divide by eleven when there are twelve students?

Why square the distances

Look at the middle column of the table. It adds up to exactly zero, and it always will, for any set of numbers. The mean is the balance point, so the distances below it cancel the distances above. Averaging the raw distances gives zero every time, which is useless.

The obvious fix is to drop the minus signs and average what is left. That gives 13.5 marks, and it is a real statistic called the mean absolute deviation. There is nothing wrong with it. It is easier to explain than the standard deviation and you could build a career without needing anything else to describe a single class.

The standard deviation won anyway, for two reasons.

The first is that squaring makes far-away students count for more. The student on 49 supplies 608 of the 2,652, which is 23 per cent of the total from one student in twelve. The student on 71 supplies 0.3 per cent. Whether that is a feature or a flaw depends on the data, and I will come back to it.

The second reason is the one that matters for the rest of this series. Variances add. If the marks vary because students differ and also because markers differ, the variance of the marks is the variance from students plus the variance from markers. Nothing so tidy is true of the mean absolute deviation. Every formula later on, the standard error at the end of this part, the t-test of Part 15, the sample-size calculation of Part 11, works because of that one property.

The cost is the one Part 2 flagged. Because the distances are squared, a single extreme value can own the result. The twelve tutoring bills from Part 2 have a standard deviation of £818. Take out the one family who spent £3,120 and the other eleven have a standard deviation of £174. One family in twelve was supplying most of the number.

Why eleven and not twelve

This is the step every textbook apologises for. The short version is that dividing by twelve gives an answer that is slightly too small, and dividing by eleven corrects it.

Here is why it is too small. We do not really care about these twelve students. We care about what the guide does to students in general, and the twelve are a sample. The distances we would like to measure are distances from the true average of all such students, which we do not know. So we use the sample's own mean instead.

But the sample's own mean has an unfair advantage. It was calculated from these same twelve marks, so it sits in the middle of them by construction. No other number is as close to these twelve marks, taken together, as their own mean is. The true average is somewhere nearby, a little to one side, and distances measured from it would be a little longer.

Dividing by one fewer than the number of students makes up for the shortfall, on average, exactly.

There is a second way to see it. The distances have to add up to zero. So once you know eleven of them, the twelfth is fixed. The twelve distances contain only eleven independent pieces of information about spread, and you divide by the number of pieces you actually have. That count is called the degrees of freedom, a phrase that turns up beside most test results and means nothing more mysterious than this.

You do not have to take the correction on trust. Draw thousands of small classes from an imaginary world where the true variance is known to be 225 (a standard deviation of 15), compute the variance both ways, and average the results.

Students in the class Average when dividing by n Average when dividing by n − 1 True value
3 150 226 225
6 187 224 225
12 206 225 225
100 223 225 225

Dividing by n undershoots, badly for tiny classes and barely at all for large ones. Dividing by n − 1 lands on the truth at every size.

One practical consequence. If your twelve students are the whole population, every student you care about, then there is nothing to estimate and dividing by twelve is correct. Software makes you choose. Spreadsheets offer STDEV.S (sample, n − 1) and STDEV.P (population, n). Python's numpy.std divides by n unless you pass ddof=1, and pandas divides by n − 1 unless you tell it not to, so the same column of marks can give 14.9 in one library and 15.5 in the other. In research the sample version is almost always the one you want.

The bell curve

The plain reading of a standard deviation is the one you already have. An SD of 15.5 says a student typically lands about 15 marks from the average, some closer, some further.

There is a much sharper reading, and it depends on the shape of the data.

Collect a few hundred exam marks, sort them into bins and draw the counts, and they usually pile up in the middle and thin out evenly on both sides. The same shape appears for heights, for measurement errors, and for the weights of loaves from one bakery. Its name is the normal distribution and its nickname is the bell curve.

It turns up so often for a reason. A mark is the sum of many small, separate pushes: forty questions each answered right or wrong, a good or a bad night's sleep, a lucky guess, a topic revised the day before. Most students get a mixture of good and bad pushes that roughly cancel, which leaves them near the middle. To land far out, nearly all the pushes have to go the same way, and that is rare. Any quantity made by adding up many small independent influences ends up bell-shaped, a result statisticians call the central limit theorem.

mean (M) = 62 13.5%34%34%13.5% 2.35%2.35% 17−3 SD32−2 SD47−1 SD62mean77+1 SD92+2 SD107+3 SD 68% within one SD: 47 to 77 95% within two: 32 to 92 99.7% within three: 17 to 107 SD = 15 SD = 15
A bell curve for marks with a mean of 62 and a standard deviation of 15, the round figures this series uses for students without the guide. The peak sits at the mean, and each step of one standard deviation along the axis is 15 marks. The height of the curve shows how common each mark is.

The useful thing about the bell curve is that two numbers describe all of it. The mean says where the peak is. The standard deviation says how wide the bell is. Nothing else is needed, which is why a write-up can report "M = 62, SD = 15" and expect you to see the whole picture: a peak at 62, with the 15-mark steps marked on the figure either side of it.

The picture comes with fixed proportions, and they are worth memorising:

  • about 68 per cent of values fall within one standard deviation of the mean
  • about 95 per cent fall within two
  • about 99.7 per cent fall within three

This turns a standard deviation into statements about students. With a mean of 62 and an SD of 15, two students in three score between 47 and 77. One in twenty is outside 32 to 92, half of those at each end, so a student on 92 or more is in roughly the top 2.5 per cent.

It also gives every measurement a common scale. A mark of 92 is 30 above the mean, and 30 marks is two standard deviations, so the mark is "two standard deviations above the mean". That count has a name, the standard score or z-score: the value minus the mean, divided by the SD. A z-score of +2 means the same thing on a maths paper marked out of 100 and a reading test marked out of 40, which is how results from different exams are put side by side.

Look at the right-hand end of the figure. Three standard deviations above the mean is 107, and the exam is out of 100. By the curve, about one student in 180 scores more than full marks. The bell curve is a model of the marks, not the marks themselves. In the middle of the scale it is a good model, and near the ends of a scale that has limits it is a poor one.

Now check the rule against the first guide's twelve students, whose mean is 73.7 and SD 15.5. Seven of them are between 58.1 and 89.2, which is 58 per cent, and all twelve are within two standard deviations. Close to the rule, not exact, and for a good reason: twelve students from two very different schools are not a bell. They are two clumps.

When the shape is not a bell, the rule can fail outright. The tutoring bills have a mean of £577 and an SD of £818. One standard deviation below the mean is minus £241, and no family has a negative tutoring bill. Whenever "mean minus SD" lands somewhere impossible, the data have a long tail and the standard deviation is the wrong summary. Use the median from Part 2 and the interquartile range from earlier in this part.

A quick test of shape uses the two spreads together. For bell-shaped data the IQR is about 1.35 times the SD. The tutoring bills have an IQR of £179 and an SD of £818, nowhere near that ratio, and the mismatch is the long tail showing up in the summary numbers.

There is a weaker guarantee that holds for any shape at all. At least three quarters of the values lie within two standard deviations of the mean, and at least eight in nine within three. It is called Chebyshev's inequality, and it is what "a student usually lands within about 15 marks of the average, sometimes 30" is quietly relying on.

In a write-up you will see it as "M = 73.7, SD = 15.5", or as "73.7 (15.5)", or as "73.7 ± 15.5". Treat the last form with suspicion until you have checked what the ± means. The final section of this part is about the other thing it might be.

Try it: the bell curve

Set a mean and a standard deviation and the bell is fixed. The bars are a class of students drawn from it, counted in bins four marks wide. The shaded bands are one, two and three standard deviations either side of the mean.

Four things to try. Slide the mean and the whole bell moves along the axis without changing shape. Slide the standard deviation down to 5 and up to 20, and the bell goes from a spike to a low hill while the bands stretch with it. Set the class to 20 students and press Draw a class several times: the bars are ragged and the share within one SD swings between about half and four fifths, which is why the twelve students above gave 58 per cent and not 68. Then tick draw long-tailed data instead. The data now have the same mean and the same SD, and the rule no longer describes them.

Whose spread is it

A standard deviation is always the spread of some particular group, and it changes when the group does.

The 15.5 is the spread of twelve students with the guide, six from School A and six from School B. But School A's marks run about 30 higher than School B's. So a large part of that 15.5 is not students differing from one another. It is two schools differing.

Split them and the number drops. The six School A students with the guide have an SD of 5.6. The six at School B have 7.9. Students who had the same preparation at the same school differ by something like 6 to 8 marks. Mix the schools and it doubles.

Neither number is wrong. They answer different questions. "How much do students with the guide vary?" is 15.5. "How much do students with the guide vary once you know their school?" is about 8.

This is the reason Part 6 gets two very different answers from the same twenty-four students. Shuffle the labels across everyone and the guide's 12 marks have to stand out against 15 or so marks of spread. Shuffle within each school and they only have to stand out against 8. A design that removes a known source of spread makes every effect easier to see, which is the theme of Part 11.

The series uses "about 15 marks" as its round figure for the spread between students. That is the mixed, all-schools number.

Try it: the spread-finder

All three measures on one picture. The twelve dots are the first guide's students, and you can drag any of them along the line. The dark line is the mean, the shaded band is one standard deviation either side, and the paler band is two. The coloured lines above the axis are each student's distance from the mean. Under the axis is the box plot of the same twelve marks, and the bars at the bottom show how much of the total squared distance each student supplies.

Three things to try. Press The second guide and watch the band and the box collapse together while the mean stays where it was. Press The first guide, then Send one student to 5. One student has moved: the range doubles from 46 to 90, the SD jumps from 15.5 to about 24, that student's bar grows to more than half the total, and the box stays exactly where it was, with the student now drawn beyond the whisker as an outlier. Then drag the student on 71 a few marks either way. Almost nothing happens to the SD, because a student near the mean has almost no squared distance to contribute.

Standard deviation is not standard error

There is a second number that looks like the standard deviation, is calculated from it, appears in the same tables with the same ± sign, and means something different.

The standard deviation describes students. It says how far a typical student is from the average.

The standard error describes the average itself. It says how far the average would typically move if you ran the study again with different students. Part 1's demo was a picture of it: the same true gap, measured over and over, landing somewhere different each time.

The two are connected by one line of arithmetic. The standard error of a mean is the standard deviation divided by the square root of the number of students. For the twelve, that is 15.5 / √12 = 4.5 marks.

Now watch what happens to each as the class grows, in a world where the true spread is 15 marks.

Students Standard deviation you would measure Standard error of the mean
6 usually 6 to 24 6.1
12 usually 9 to 21 4.3
24 usually 11 to 19 3.1
100 usually 13 to 17 1.5
480 usually 14 to 16 0.7

The standard deviation does not shrink. Students are as different from each other in a class of 480 as in a class of 6. More students only pin the number down, which is why the range in the middle column narrows around 15.

The standard error does shrink, but slowly. To halve it you need four times the students, because of the square root. That one fact is behind most of the sample sizes in this series.

It also explains a habit worth watching for. A chart whose error bars show standard errors looks far tidier than the same chart showing standard deviations, by a factor of the square root of the sample size. With 100 students the bars are ten times shorter. Both are legitimate. They answer different questions, "how variable are students?" and "how well do we know the average?", and a caption that does not say which one it drew has left out the thing you most need to know.

Try it: more students

Each press draws a fresh class from the same imaginary world. The dots are students, plotted by how far they landed from the true average. The green bar is the class's standard deviation. The red bar is its standard error. Change the class size and press again.

Set the class to 12 and press Draw 20. The green bar changes length from class to class, sometimes by a lot, and the dark line (the class average) wanders several marks either side of the dashed one. Now slide the class to 300 and draw 20 more. The green bar settles at about the true spread and stays there. The red bar has shrunk to almost nothing. More students did not make the students more alike. They made the average more certain.

Which spread, when

Measure What it uses Thrown by one extreme value? Reported with Reach for it when
Range The two end values Completely Either middle, as a check You want to see the ends, or catch an impossible value
Interquartile range The middle half No The median The data have a long tail or outliers, as costs and times do
Standard deviation Every value Yes The mean The data are roughly bell-shaped, or the number feeds a later calculation

The pairings matter. Median with IQR, mean with SD. A write-up that gives a median and a standard deviation has mixed a summary that ignores the tail with one that is dominated by it.

In Python

The standard deviation by hand, the range and quartiles, the bell curve's proportions, and the two simulations behind the tables above.

import numpy as np
from scipy import stats

marks = np.array([49, 55, 58, 62, 66, 71, 79, 84, 86, 88, 91, 95])   # with the guide, both schools
tight = np.array([70, 71, 72, 72, 73, 73, 74, 74, 75, 76, 77, 77])   # the imaginary second guide

# The recipe, one step at a time
mean = marks.mean()
dist = marks - mean
print(f"mean {mean:.1f}, distances sum to {abs(dist.sum()):.1f}, sum of squares {np.sum(dist**2):.1f}")
print(f"variance {marks.var(ddof=1):.1f}, sd {marks.std(ddof=1):.1f}, mean absolute distance {np.abs(dist).mean():.1f}")
print(f"second guide: mean {tight.mean():.1f}, sd {tight.std(ddof=1):.1f}")

# The range and the quartiles, and what one student moving to 20 does to each measure
q1, q3 = np.percentile(marks, [25, 75])
print(f"range {marks.max() - marks.min()} ({marks.min()} to {marks.max()}), quartiles {q1} and {q3}, IQR {q3 - q1}")
moved = marks.copy(); moved[0] = 20
m1, m3 = np.percentile(moved, [25, 75])
print(f"lowest student moved to 20: range {moved.max() - moved.min()}, IQR {m3 - m1}, sd {moved.std(ddof=1):.1f}")

# The box plot's rule for outliers: beyond one and a half box-lengths from the box
bills = np.array([181, 204, 238, 257, 269, 291, 312, 348, 402, 517, 784, 3120])   # pounds spent on tutoring
b1, b3 = np.percentile(bills, [25, 75])
limit = b3 + 1.5 * (b3 - b1)
print(f"bills: quartiles {b1:.0f} and {b3:.0f}, whisker limit {limit:.1f}, outliers {bills[bills > limit]}")

# The trap: numpy divides by n unless told otherwise. ddof=1 means "divide by n - 1"
print(f"np.std default {marks.std():.1f}, with ddof=1 {marks.std(ddof=1):.1f}")

# Reading it: how many students sit within one and two standard deviations of the mean
sd = marks.std(ddof=1)
for k in (1, 2):
    inside = np.sum(np.abs(dist) < k * sd)
    print(f"within {k} sd ({mean - k*sd:.1f} to {mean + k*sd:.1f}): {inside} of {len(marks)}")

# The bell curve: marks with a mean of 62 and a standard deviation of 15
bell = stats.norm(62, 15)
for k in (1, 2, 3):
    print(f"bell curve, within {k} sd ({62 - 15*k} to {62 + 15*k}): {bell.cdf(62 + 15*k) - bell.cdf(62 - 15*k):.1%}")
print(f"a mark of 92 has a z-score of {(92 - 62) / 15:+.1f}, with {bell.sf(92):.1%} of students above it, and the curve puts {bell.sf(100):.2%} above 100")

# Whose spread: the same twelve students, one school at a time
school_a, school_b = np.array([88, 91, 79, 84, 95, 86]), np.array([62, 58, 71, 49, 66, 55])
print(f"School A alone sd {school_a.std(ddof=1):.1f}, School B alone sd {school_b.std(ddof=1):.1f}")

# Why n - 1: draw many small classes from a world whose true variance is 15 squared = 225
rng = np.random.default_rng(3)
for n in (3, 6, 12, 100):
    classes = rng.normal(62, 15, (200_000, n))
    print(f"{n:>3} students: dividing by n averages {classes.var(axis=1, ddof=0).mean():.0f}, "
          f"by n - 1 averages {classes.var(axis=1, ddof=1).mean():.0f}")

# Standard deviation against standard error as the class grows
for n in (6, 12, 24, 100, 480):
    sds = rng.normal(62, 15, (100_000, n)).std(axis=1, ddof=1)
    lo, hi = np.percentile(sds, [2.5, 97.5])
    print(f"{n:>3} students: sample sd usually {lo:.1f} to {hi:.1f}, standard error of the mean {15 / np.sqrt(n):.1f}")

which prints:

mean 73.7, distances sum to 0.0, sum of squares 2652.7
variance 241.2, sd 15.5, mean absolute distance 13.5
second guide: mean 73.7, sd 2.3
range 46 (49 to 95), quartiles 61.0 and 86.5, IQR 25.5
lowest student moved to 20: range 75, IQR 25.5, sd 21.0
bills: quartiles 252 and 431, whisker limit 698.5, outliers [ 784 3120]
np.std default 14.9, with ddof=1 15.5
within 1 sd (58.1 to 89.2): 7 of 12
within 2 sd (42.6 to 104.7): 12 of 12
bell curve, within 1 sd (47 to 77): 68.3%
bell curve, within 2 sd (32 to 92): 95.4%
bell curve, within 3 sd (17 to 107): 99.7%
a mark of 92 has a z-score of +2.0, with 2.3% of students above it, and the curve puts 0.56% above 100
School A alone sd 5.6, School B alone sd 7.9
  3 students: dividing by n averages 150, by n - 1 averages 226
  6 students: dividing by n averages 187, by n - 1 averages 224
 12 students: dividing by n averages 206, by n - 1 averages 225
100 students: dividing by n averages 223, by n - 1 averages 225
  6 students: sample sd usually 6.1 to 24.1, standard error of the mean 6.1
 12 students: sample sd usually 8.9 to 21.2, standard error of the mean 4.3
 24 students: sample sd usually 10.7 to 19.3, standard error of the mean 3.1
100 students: sample sd usually 12.9 to 17.1, standard error of the mean 1.5
480 students: sample sd usually 14.0 to 15.9, standard error of the mean 0.7

Where this leaves us

Three numbers measure spread, and they differ in how much of the data they listen to. The range hears two students and is wrecked by either of them. The interquartile range hears the middle half and ignores the rest, which makes it the partner of the median and the right choice for anything with a long tail. The box plot is the picture of it.

The standard deviation hears everyone. It is the answer to "how far is a typical student from the average?", with "typical" defined by squaring, averaging and taking the root. The squaring is what lets variances add, and it is also what lets one extreme student own the result. For bell-shaped data it comes with a bonus no other measure has: the mean and the SD together describe the whole distribution, with 68 per cent of students within one SD of the mean and 95 per cent within two.

Three habits follow. Ask whose spread a standard deviation is describing, because the same students have a spread of 15.5 across schools and about 8 within one. Check that "mean minus SD" is a possible value before trusting the 68 and 95 per cent reading. And when you see a ±, find out whether it is the spread of the students or the uncertainty of the average, because the two differ by the square root of the sample size.

Everything from here on treats the spread as the noise a real effect has to be heard over. Before that, one more kind of summary needs its own treatment, because it hides its spread completely: the rate.


Next: A Rate Is an Average in Disguise: why a pass rate is a mean of ones and zeros, the four ways of putting an interval on "16 out of 18", one of which claims a pass rate of 103 per cent, and the honest interval for the gap between two rates.