First movement · Difference under the microscope
Exercise 1.1 · The mean and the standard deviation
Mean and standard deviation
In this exercise
Data for this exercise — penguins.csv 342 penguins · stones.csv the twelve stones from the book · what each column means
hook
No penguin weighs exactly the mean
mean · why nobody sits exactly in the middle
Somewhere on a bare rock off Antarctica stands a set of scales, and around it shuffle 342 penguins who never asked for this.1 One by one they are picked up, set on the scales, and let go again. Each time, someone writes down one number. Weight, in grams. Nothing more: 342 animals, 342 numbers.
Add up those 342 numbers, divide by 342, and out comes something tidy: 4202 grams. There you have it, the average penguin: 4.2 kilos. Only — I have been through the list, and on that whole rock there is not a single penguin that weighs 4202 grams. Not one. The average penguin is not among them.
That itches. One number that sums up 342 animals and belongs to none of them — what does a number like that actually tell you? And, perhaps more exciting: what does it leave out? Come along for a moment; we’re going to open that number up.
play with it
Work out the mean in JASP
mean · standard deviation · median
- Open
stones.csvand click Descriptives. - Drag
shineto Variables. - Make sure that under Statistics Mean (arithmetic), Std. deviation and Median are ticked (the first two are on already).
The table now reads M = 50.00, SD = 21.74 and a median of 50.
Twelve stones, the same three numbers as in the book. The mean is 50 and the median is 50 too — for these twelve, the two coincide.
But where does that 21.74 come from? In the book the answer stands as a table, at the sum of squares: for each stone the deviation from the mean, that deviation squared, and at the bottom the sum of each column. Build that table here yourself. Two columns added, two sums, and you can lay your own table next to the one in the book.
- Stay in
stones.csv. In the data view, click the + to the right of the last column (Add computed column), name the columndeviation, choose type Scale and the R icon, and click Create Column. Typeshine - mean(shine): the shine minus the mean. Click Compute column. What you type there is a line of R. You don’t need to know that language; copying it exactly is enough. The steps are also in the toolbox. - One more column like that:
square, withdeviation^2. In the data view your two columns now stand next toshine: that is your table. - Descriptives: drag
deviationandsquareto Variables, and under Statistics tick Sum.
Under Sum you now read 0 for deviation and 5200 for square (JASP puts zeros after the point; the number is the same). The last two steps you do on your calculator: 5200 / 11 = 472.73, and the square root of that is 21.74.
Lay your table next to the one in the book, beside the shine columns on the right. Anna stands at −30 and 900, Kees at −20 and 400: the same numbers. (The book puts a plus in front of the positive deviations, your program does not; the number is the same.) The sum of the deviations is 0, not roughly but exactly. The sum of the squares is 5200: the sum of squares. Divide that by eleven, twelve stones minus one, and you have the variance. The book shows why it is minus one, with three envelopes; here all you have to do is divide. Take the square root of that, and there it is: 21.74, the standard deviation you just got. Behind that one number is nothing but this table.
Now you — with the penguins you already looked at in Exercise 0.1. So you know the data; the move is new. Watch what happens to that mean and that median once the heap stops being so well-behaved.
Bring in the penguins and have three numbers worked out: the mean, the standard deviation and the median of the weight.
- Open
penguins.csvin JASP (menu top left → Open). - Click Descriptives at the top.
- Drag
body_mass_gto the Variables box. - Open the Statistics section and make sure that Mean (arithmetic), Std. deviation and Median are ticked (the first two are on already). The table appears on the right and recalculates as you go.
Three numbers. Read them one at a time:
- Mean: M = 4202. The balance point. Think of all the weights as marbles on a long plank: put your finger under 4202 and the plank sits level. The “middle” — but the middle the weight pivots around.
- Standard deviation: SD = 802. The answer to the question that comes straight after the middle: and how far around it do they lie? Something like the average distance to the middle: a penguin here typically sits 800 grams or so from the mean — some much closer, some much further. (For the purist: the formula squares those distances first and takes the square root afterwards, as you just did with the stones. You can simply keep the reading intuition “typical distance to the mean”.)
- Median = 4050. The middle penguin: put all 342 in a row from light to heavy and see who stands halfway. Hang on — that one sits a fair bit lower than the mean. Hold on to that itch; it comes back in a moment.
Fair is fair: “the average distance to the middle” is not exactly what a standard deviation is. In this book I mostly choose that cosy, slightly wrong reading anyway, because it works. Here, just this once, you see how things really stand.
Take your table of the twelve stones. In the deviation column, strip off the minus signs and add everything up: 220. Divide by twelve, so simply averaging: 220 / 12 = 18.33. That is the average distance to the middle. The standard deviation of the shine was 21.74: a different number, and a bigger one.
That is mostly the square’s doing. Anna lies three times as far from the middle as Hans, 30 against 10, but in the square column she counts nine times as heavily, 900 against 100. That is how the stones far from the middle pull the standard deviation up. A small part comes from dividing by eleven instead of twelve: divide the 5200 by twelve as well and take the root, and you land on 20.82, still a good way above the 18.33. With or without that minus one, the standard deviation never comes out below the plain average distance.
A report always gives the standard deviation. And if someone asks what that number is, you may say it the cosy way, with one thing added: roughly the typical distance to the middle, but by way of the squares, and so a little bigger.
But there is another column in the file: species. Three species of penguin walk that rock — Adelie, Chinstrap and Gentoo. Work out the mean per species, and throw the weights into a picture as well.
- In the same Descriptives analysis, open the Basic Plots section and tick Distribution plots — there are all 342 weights in one picture.
- Now drag
speciesto the Split box: the table splits into three columns, one per species, and you read the three means straight off. (The picture splits along with it; if you want the one big hill back, takespeciesout of Split for a moment.)
And there, the one number comes apart. Adelie: M = 3701. Chinstrap: M = 3733. Gentoo: M = 5076. Two species sitting close together around 3.7 kilos — and one species hanging a good kilo above them. The picture says the same thing in shape: not a neat hill with one top, but a hill with a thick shoulder on the right. That shoulder is the Gentoos.
get it
What 4202 grams does and does not tell you
M and SD together · outliers · what one number leaves unsaid
Back to 4202. What is that number still worth?
More than you might think — and less. First the gain. M says where the middle is, and SD says how widely the animals live around it. Those two together are already half a distribution: “mean 4202, typically 800 or so either side” tells you that a penguin of 3500 or of 4900 grams is perfectly ordinary here (within one SD of the middle), and that the heaviest on the rock — 6300 grams — is a hefty outlier. Whoever reports only the mean gives you a place without an outline; the SD is the outline.
Then the loss. That one mean, 4202, mixes three species together. Two species live around 3700, one around 5076 — and 4202 is the middle of none of the three: for the two light species it is a heavy penguin, for the Gentoos a light one. The average penguin does not exist, and now you can see why not: it is not a typical animal, it is the balance point of a mixed crowd. (That nobody weighs exactly 4202 grams says little in itself: the scales on the rock weigh in steps of 25 grams, so 4202 can’t even appear on them.)
And look what that mixing does to the SD. Within one species the spread is much smaller — Adelie 459, Chinstrap 384, Gentoo 504 — but across everything it was 802. That difference is not extra individual variation: it is the difference between the species, dressed up as spread. One number for the middle hides three middles; one number for the spread counts the distance between groups as if it were ordinary wobble.
Now for the median’s itch. 4050 against 4202: the mean lies higher, because the heavy Gentoo shoulder on the right pulls the balance point towards itself — the median couldn’t care less about shoulders and outliers, it only counts who stands halfway along the row. When mean and median drift apart, that is a signal: this distribution is skewed, or made of pieces. That is what the exercise on the shape of distributions is about; and whether such a difference between groups is real or could also have been chance, that we will shuffle later. For now, the signal will do.
In plain words, one sentence: these 342 penguins weigh about 4.2 kilos on average, with a typical deviation of a little over 800 grams — but that mean mixes three species that each live around a middle of their own.
And that is, from now on, how you read every mean you come across — “the average Dutchman”, “the average income”, “the average patient”. Two questions to go with it, always: how far around it do they lie? (ask for the SD) and who exactly is in that mean? (ask for the groups). A mean without those two answers is an address without a town.
your turn
From belly to bill
the same two measures on a second variable
Your turn — from belly to bill. penguins.csv also holds the column bill_length_mm (in mm). The same two measures, a different variable — and a heap that lies just a little differently from the one for weight.
But first, one column that is not complete. Until now every penguin had a weight and a bill. In nitrogen the measurement is missing for a few animals. That number is not an amount of nitrogen but a measure of what a penguin ate, read from its blood (see what each column means). That is where question a) starts.
First set up the analysis below, then answer the questions. In brackets, each time, is what belongs in a complete answer, so you can check yourself without opening our answer. Where it says more than one answer is right, the wording is up to you — for the rest, the answer is fixed. The last question is called Z) on purpose, and not m): the assumptions always come last, and the odd letter says “and also, every time, this one”.
- In the same Descriptives analysis, drag
nitrogento the Variables box (andbody_mass_gout). To check: Valid 330, Missing 12, M = 8.73. - What is switched on? JASP leaves a penguin without a measurement out by itself and carries on with the rest. It does say so, in the Missing row, but only whoever looks there sees it. The number you computed with is under Valid, and that is not the number of rows in your file.
- Then put
bill_length_mmin the Variables box (andnitrogenout). Under Statistics, Mean (arithmetic), Std. deviation and Median are already on. To check: M = 43.92, SD = 5.46, Mdn = 44.45. Under Basic Plots, Distribution plots is still on: there is the whole heap of bill lengths. - Drag
speciesto the Split box: the same three measures, now per species in a column of its own. Putnitrogenin alongside for a moment, and the Missing row also shows you how many gaps each species has. Then takespeciesout of Split again. - For question e) you make a column that says, for each penguin, whether its bill lies within one standard deviation. In the data view, click the + to the right of the last column (Add computed column), name the column
inside, choose the R icon, click Create Column and typeabs(bill_length_mm - mean(bill_length_mm)) <= sd(bill_length_mm). Copy it exactly; you don’t have to read it. For each penguin it asks: is this bill no further from the mean than one standard deviation? Click Compute column, putinsideunder Variables and tick Frequency tables. To check: true 204 times.
a) Work out the mean of nitrogen. How many penguins are you computing with then, and why isn’t that 342? (two numbers, and one sentence)
b) Compute the mean and the standard deviation of the bill length. (two numbers to two decimals, with their unit)
c) Say in one sentence what that mean says about the bills. (about bills — a number is allowed, as long as its unit is there)
d) And what does that standard deviation say? (one sentence, with the word distance in it)
e) Count how many penguins have a bill that lies within one standard deviation of the mean, so between 43.92 − 5.46 and 43.92 + 5.46 mm. What percentage of the 342 is that? For a heap shaped like a bell (one hill, thick in the middle) a rule of thumb says about 68% lie there. Does that hold here, and why or why not? (a count, a percentage, and one sentence about the shape of the heap in your picture)
f) Look up the median. Does it lie above or below the mean? (one number, and which way)
g) For weight the median was 4050 and the mean 4201.75. For both variables, subtract the median from the mean. (two numbers, and one sentence about what the sign tells you)
h) Is that 5.46 mm a lot, then? For both variables, divide the standard deviation by its own mean — why may you lay those two side by side, and not the bare 5.46 mm and 801.95 g? (two percentages, and one sentence)
i) Work out the mean per species. (three numbers, with their n)
j) For weight, Adelie and Chinstrap lay close together and Gentoo hung a good kilo above them. Which two lie together here? (two species names, and one sentence)
k) Work out the standard deviation per species and lay those three next to the 5.46 of all 342 together. (three numbers, and one sentence about where the difference comes from)
l) Write a conclusion about what it all means, in no more than five sentences. (about penguins and species — a number is allowed, as long as its unit is there; more than one answer is right)
Z) Can you believe everything above? Check:
- are measurements missing, and would they shift your mean and spread?
- does every row measure the same thing — the same bill, the same unit?
- does that one mean describe one heap, or three heaps mixed together?
And then the question that always belongs at the end: if something goes wrong, which answers above do you redo, and which may stand?
a) M = 8.73 ‰, computed on 330 of the 342 penguins. For twelve animals the nitrogen measurement is missing (too little blood, no blood sample, or a result that never came back from the lab), and those twelve cannot take part. So always put the n with it: “mean 8.73” without n hides the fact that twelve penguins are missing. The box What is switched on? above tells you whether your program refuses at such a gap or quietly carries on computing.
b) M = 43.92 mm and SD = 5.46 mm.
c) The balance point of all 342 bills lies at almost 44 millimetres. And just as with weight, nobody lives there: rounded to one decimal, not a single penguin has a bill of 43.9 mm.
d) A bill here lies typically some 5.5 mm from that balance point — the average distance to the middle, roughly.
e) 204 of the 342 penguins, or 59.6%: a good way below the 68%. The rule of thumb holds for a bell, and the bills are not a bell. In your picture you see two humps: the Adelies with short bills, around 39 mm, and the Chinstraps and Gentoos with long ones, around 48 mm. The mean of 43.92 falls in the thin stretch between them. So right around that middle there are fewer penguins than in a bell, and then fewer fall within one standard deviation too. It is the shape that breaks the 68%: two humps with a thin middle. The bell shape itself you will meet further on in the book.
f) The median is 44.45 mm and so lies above the mean.
g) Weight: 4201.75 − 4050 = +151.75 grams. Bill: 43.92 − 44.45 = −0.53 mm. The sign flips, and that is the news. For weight, the heavy Gentoo shoulder pulled the balance point to the right, above the middle penguin; for the bills the heap leans a touch the other way. The same 342 animals, two variables, two shapes.
h) Bill: 5.46 / 43.92 = 12.4%. Weight: 801.95 / 4201.75 = 19.1%. Millimetres and grams cannot be laid side by side — 5.46 against 801.95 only says that a gram is smaller than a millimetre is big. Divide each spread by its own middle and the unit drops out above and below the fraction bar, leaving you a bare number that you may compare. And then it turns out the weight spreads, relatively, a good one and a half times as widely as the bill.
i) Adelie M = 38.79 (n = 151), Chinstrap M = 48.83 (n = 68), Gentoo M = 47.50 (n = 123).
j) Chinstrap and Gentoo lie close together here, 48.83 against 47.50; Adelie stands apart, nine to ten millimetres below. For weight the grouping was exactly the other way round — there Adelie and Chinstrap belonged together and Gentoo stood alone. So which species “belong together” depends on what you measure, and not on the species.
k) Adelie 2.66, Chinstrap 3.34, Gentoo 3.08 — all three well below the 5.46 of the whole rock. You saw the same thing happen with weight: within a species the spread is small, and what you measure on top of that, across the whole rock, is no longer individual difference but the difference between the species, dressed up as spread.
l) More than one answer is right; which five sentences you choose is up to you. Numbers are allowed — what matters is that every number says what it measures, because “43.92” is nothing and “43.92 millimetres of bill” is a penguin. For example: the 342 penguins have a bill of almost 44 millimetres on average, with a typical deviation of about five and a half millimetres. That one mean describes no penguin at all, because three species are mixed together: the Adelies have clearly shorter bills than the Chinstraps and the Gentoos, which hardly differ from each other. Within a species the spread is about three millimetres — well below the five and a half of the whole rock. So whoever knows the species already knows a good deal about how long the bill is.
Z) Yes — and mind why, because the answer here is different from the one you will get later. In this exercise nothing was tested and nothing was estimated: you have only described these 342 penguins. So almost nowhere does a distributional assumption sit under your answers. The only one is the 68% at e), and you already saw that one go down: that rule belongs to a bell, and the bills are not one. What fell there is the expectation of 68%; your count of 204 simply stands.
What can fall over here is the data itself.
- Stands, as long as the n is there: a). That mean is about 330 penguins, not 342. Then also look at where the gaps are: count them per species (the box at the top shows how). Ten of the twelve are among the Adelies, while that species is not even half the rock (151 of the 342). So the mean of the 330 leans a little less on Adelies than that of all 342 would have. How much difference that makes, you don’t know: those twelve measurements you simply don’t have.
- Stands: d) up to and including k). They are descriptions of exactly these 342 animals, and they stay right as long as the measurements are right. If a row were added or one dropped out, they would all shift along — not because an assumption breaks, but because you are describing something else.
- Stands, with a warning attached: b), and with it c) and l). The number 43.92 is simply right. But the sentence “the average penguin has a bill of 43.9 mm” is misleading, and the third question above is exactly why: that mean mixes three species. The number answers a different question from the one you thought you were asking.
And that is the habit this exercise wants to send you off with: before you read out a mean, first check whether it is about one heap. Later, once there is testing, a second list joins this one — the answers you have to redo.
reporting
Write it up like a researcher
reporting · M and SD in one sentence · italics
Reporting sounds like something with thick handbooks and cold sweat, but it is a shopping list in sentence form: what did you study, where did it lie, how spread out — done. Look:
The 342 penguins in the sample weighed over four kilos on average (M = 4201.75 g, SD = 801.95).
That’s it. The whole report — and the sentence stands on its own feet: who got weighed, what was measured, and in brackets the two numbers. Almost too simple for words, and that is exactly the nice part: it is allowed to be this simple. Two small conventions are already creeping in: only the symbols M and SD are in italics — the ordinary words stay upright — and decimals get a point (43.9, not a comma).
Your turn: write a self-standing sentence like that for the bill length (M = 43.92, SD = 5.46). Reading it out loud is allowed. You get used to it quickly, promise.
exam practice
Exam-style questions
what an SD measures · mean against median · relative spread · reporting with n
Above were the open questions; here are the same topics once more, in the form an exam would ask them in. Six of them, four options, and exactly one is the best — the other three may well be true and still not the best answer. Calculating is only needed for question 1, and there the options lie far enough apart to estimate; you don’t need an exact number.
1. “Within one standard deviation of the mean” means: between M − SD and M + SD. The mean weight is M = 4201.75 grams and the standard deviation SD = 801.95 grams. Where do those two limits lie?
- 2597.85 and 5805.66 grams
- 2700 and 6300 grams
- 3399.80 and 5003.70 grams
- 3800.78 and 4602.73 grams
2. The mean weight on the rock is 4202 grams, and not a single penguin weighs exactly that. Why does this mean not describe an ordinary penguin?
- Because not a single penguin weighs exactly 4202 grams: a mean that nobody weighs describes nobody.
- The weights are right-skewed, and then the mean lies beside the hump.
- The mean is the balance point of three species that each live around a middle of their own: for the two light species 4202 is heavy, for the Gentoos it is light.
- The heaviest penguin, at 6300 grams, lifts the mean away from the other animals.
3. For weight the mean lies at 4201.75 grams and the median at 4050 grams. Which statement about those two is the best?
- The mean lies higher because the heavy Gentoos pull the balance point towards themselves; the median only counts who stands halfway along the row.
- The median is the better measure here, because with a mixed heap you may not use the mean.
- The mean is the better measure here, because it uses all 342 animals and the median throws information away.
- That the two lie 151.75 grams apart points to measurement errors in the weights.
4. Weight spreads with SD = 801.95 grams, bill length with SD = 5.46 mm. You want to know which of the two spreads relatively more widely. Which calculation goes with that question?
- 801.95 − 5.46, the difference between the two standard deviations.
- 801.95 / 5.46, the one standard deviation divided by the other.
- Simply lay the two side by side; weight clearly spreads more widely.
- Divide each standard deviation by its own mean, and lay those two bare numbers side by side.
5. Of the 342 penguins, 204 (59.6%) have a bill within one standard deviation of the mean. For a heap shaped like a bell, a rule of thumb says about 68% lie there. Why does this heap not get there?
- 342 penguins is too few; with more animals that 68% does turn up.
- The heap has two humps with a thin middle, so right around the mean there are fewer animals than in a bell.
- The mean, at 43.92 mm, lies below the median of 44.45 mm, and a difference like that always pushes the count below the 68%.
- The rule of thumb belongs to the median and not to the mean.
6. The mean of nitrogen is 8.73 ‰, and for twelve of the 342 penguins that measurement is missing. Which report is the best?
- M = 8.73 ‰ (n = 342) — that is how many penguins are in the file.
- You may not report this mean, because JASP left out the twelve penguins without a measurement and computed over the rest.
- M = 8.73 ‰ (n = 330) — with twelve missing measurements you computed over 330 animals.
- Set the twelve gaps to zero, then you compute over all 342 and hide nothing.
1 c · 2 c · 3 a · 4 d · 5 b · 6 c
Below, for each question, is why — and why the other three options are tempting. If you got one right, you can skip it.
1. c. The SD taken off once and added on once: 3399.80 and 5003.70 grams. In between lives the perfectly ordinary middle of the rock — a penguin of 5000 grams still just fits inside. a works with two standard deviations instead of one. b is the lightest and the heaviest penguin; that is the range, and it hangs on two animals. d halves the SD and shares it out over the two sides, as if “within one SD” meant that the whole band is one SD wide — it is two.
2. c. Two species live around 3700 grams and one around 5076, and 4202 is an ordinary weight for none of the three. a is the hook of this exercise, and it proves less than it seems: the scales on the rock weigh in steps of 25 grams — all 342 weights are a multiple of 25 — so a weight like 4202 cannot even be there. There are plenty of penguins around 4200: five weigh exactly 4200, thirty from 4100 up to and including 4300. That nobody weighs exactly the mean says something about the scales; that the mean fits none of the species says something about the penguins — and an exam asks about that difference. b names the shape and not the cause. That the heap leans to the right, this exercise says itself — but that explains why the mean lies higher than the median, not why it fits none of the species. The two are easily confused: skewness shifts the mean up, the mixing of species puts it between the species. d makes one animal of what is a whole group — take that 6300 away and the mean shifts a few grams; take the Gentoos away and it shifts hundreds of grams.
3. a. The median counts places in the row, the mean weighs the distances too, and so the heavy Gentoo shoulder pulls only on the mean. b picks the same middle on the strength of a ban that does not exist: a mean is allowed with a mixed heap, it just answers a different question — if you want to know how much these 342 animals weigh together, the mean is exactly right. c is right in what it claims (the mean really does use all 342) and draws the wrong conclusion; “more animals taken in” is not the same as “better middle”. d invents a cause that isn’t there: the two middles drift apart because the heap is skewed or made of pieces, not because the weighing was sloppy.
4. d. Divide each spread by its own mean and the unit drops out above and below the fraction bar, leaving you two bare numbers: 12.4% for the bill and 19.1% for the weight. Those you may compare. a subtracts grams from millimetres, and then the result is neither. b is the most tempting, because a ratio already feels unit-free — but above the bar are grams and below it millimetres, and those do not cancel each other out. c draws the very conclusion the question warns against: 801.95 is only a bigger number, not a wider spread.
5. b. Your histogram shows two humps — the Adelies around 39 mm, the Chinstraps and Gentoos around 48 — with the mean of 43.92 in the thin stretch between them. So right around that middle there are fewer animals than in a bell, and then fewer fall within one standard deviation too. It is the shape that breaks the rule of thumb. a points at the sample size, and that is exactly what plays no part here: the rule of thumb hangs on the shape of the heap, not on how many animals are in it. c builds, on two correct numbers, a cause that isn’t there. That the two middles lie apart is indeed a sign that the heap is not a bell — at g) that is called “the news”, and so it is. But that sign is in the direction, not in the size: 0.53 mm on a spread of 5.46 mm is too small to tell which way the count goes, let alone “always”. d moves the rule over to the median; the rule of thumb was written with the mean and the standard deviation.
6. c. The n belongs with it, and the n is 330. “Mean 8.73” without n hides the fact that twelve penguins are missing. a gives the number of rows in the file instead of the number of animals computed with, and here those are two different numbers — that is the whole trap of a column with gaps. b confuses what JASP does with what you may do: that it leaves out the twelve is stated plainly in the Missing row, and what remains is a perfectly reportable mean over the animals that are there. d is the most dangerous of the three, because it looks like honesty: zero is not a missing measurement but a measured zero, and twelve zeros added in pull the mean down to a number that describes no penguin at all.
If you want to see for yourself where the numbers from question 1 come from: you work out the right two on your calculator from the numbers in the question, 4201.75 − 801.95 = 3399.80 and 4201.75 + 801.95 = 5003.70. The lightest and the heaviest penguin of option b are in Descriptives under Minimum and Maximum. Options a and d were computed on the unrounded mean and the unrounded standard deviation; if you check them with the rounded numbers from the question, the last digit can differ by a hundredth. That is rounding, not a different sum.
◠ Same shape in the book
Here: one number for the middle, one for the room around it — and the discovery that this middle fits none of the species.
In the book: Chapter 1 — The Average Gulp
There, you taste why some things can be averaged and others cannot.
Footnotes
Palmer Penguins — Gorman, Williams & Fraser (2014), Palmer Station Antarctica LTER; via the R package
palmerpenguins(CC0). Every number in this exercise has been recomputed on that real data.↩︎