Second movement · Coupling differences
Exercise 3.3 · Looking at the residuals
What the line left behind, and where R² comes from
In this exercise
Data for this exercise — stones.csv the twelve stones from the book · penguins.csv 342 penguins · bigfive.csv 2634 completed questionnaires · what each column means
hook
Twenty-two penguins of exactly 190 millimetres
prediction · miss
The penguins are old acquaintances — in Exercise 3.2 you drew a line through them yourself: the weight predicted from the flipper length, nearly fifty grams of penguin per millimetre of flipper, and R² = .76.1 Three quarters of all the difference in weight runs along with the flipper. That’s a lot, for living animals, and it sounds as if the line now more or less knows the weight.
And now something odd. The file holds twenty-two penguins with a flipper of exactly 190 millimetres. The line knows only the flipper length, so all twenty-two get the same prediction: 3659.4 grams. What the scales actually said, in grams:
3050 · 3325 · 3400 · 3450 · 3450 · 3450 · 3575 · 3600 · 3600 · 3650 · 3700 · 3700 · 3725 · 3800 · 3900 · 3900 · 3900 · 3950 · 4250 · 4250 · 4250 · 4600
From 3050 to 4600 — a kilo and a half of difference, at one and the same flipper length. The line can do nothing about that: it knows just one thing about a penguin, and that one thing was the same twenty-two times over.
And those twenty-two are no oddity you just happened to hit on. Pick another flipper length and you see the same thing, only with fewer animals in a huddle at once: all along the line, reality sits above it and below it. That sharpens a question we’ve left to one side until now: how far is the line off, penguin by penguin — and what can you do with those misses?
Come along for a moment. The line has had its guess; now we mark its work.
play with it
Work out the misses on the twelve stones
residual · predicted value
You’ve already seen a miss like that written down in the book: DATA = FIT + RESIDUAL. The fit is what the line guesses, the residual is what’s left over — the miss, now no longer measured from the mean but from the line.
You’ll come across this one thing under four names: miss, residual, deviation, and, in software output and in articles, error. Each time it’s the distance between what is really there and what the line guessed. In this exercise it’s called the miss; when JASP says Residual or a plot says residual, it’s exactly the same thing.
Open stones.csv and make two columns in the R box (type Scale; after the name Create Column, after the line Compute column), as in the toolbox: left of the arrow the name of the column, right of it what goes in the R box.
guess -> fitted(lm(shine ~ carat))
residual -> resid(lm(shine ~ carat))
Copy the right-hand side exactly; you don’t have to read it. The top one says “give me what the line guesses”, the bottom one “give me what is left over”. Rounded to one decimal:
guess 30.7 33.9 33.9 40.4 50.0 50.0 53.2 56.4 59.6 59.6 66.1 66.1
residual -10.7 -3.9 -3.9 -10.4 0.0 20.0 26.8 3.6 10.4 20.4 -36.1 -16.1
Then add up residual: Descriptives, residual in Variables, and under Statistics the Sum tick box.
Check whether that sum comes to zero for you too — give or take a little rounding dust. If it doesn’t, somewhere along the way you’ve got hold of something other than the residuals of this model.
Those are exactly the two columns from the table in the book: Else lands on zero (the line runs straight through her), Kees is furthest off, at −36.1. New is only the picture below — you set those two columns against each other instead of reading them:
Run Regression → Linear Regression with shine as Dependent Variable and carat in Covariates, and under Plots tick the option Residuals vs. predicted: the guess on the horizontal axis, the miss on the vertical one, and the zero line straight through it.
Look closely at what that picture does. The regression line has gone flat: everything the line already knew has been calculated out, so what’s left over should hover around the zero line. A residual plot is a scatterplot swept clean — you’re no longer looking at the association, you’re looking at what the association left behind.
Two questions before you read on.
a) Ask for the standard deviation of shine, and that of the residuals. (two numbers, and one sentence on what the difference between the two means)
b) Put two columns next to the data: how far each shine lies from the mean (the deviation column from Exercise 1.1, the blue stroke in the book), and the residual (the burgundy stroke). Square both of those columns and add up each column of squares. (two sums, and say what share of the first is swallowed by the second)
a) Shine itself spreads with SD = 21.74 shine points, the residuals with SD = 17.75. Without the line your best guess for every stone is the mean, and how widely the misses fan out around that mean is what the standard deviation of shine sums up: nearly 22 shine points. Guess with the line, and the residuals fan out around the line instead, and that fan is narrower: nearly 18. So the line does save you something, but not much — with these twelve stones, carat is nowhere near everything.
Don’t confuse that 17.75 with the 18.61 from Exercise 3.2, the number the regression itself prints for the spread around the line. Both come from the same squares of the residuals, the ones you add up in b). A standard deviation divides them by eleven, n − 1, because the mean costs one number; the 18.61 divides by ten, n − 2, because the line costs two (the intercept and the slope). Both then take the square root. In the book that second one is called the standard error of the estimate, Se. If someone asks for the standard error of the estimate, it’s that one: 18.61.
Descriptives with shine and residual: Std. Deviation 21.742 and 17.746.
The 18.61 from Exercise 3.2 is in the Model Summary of your regression, under RMSE: 18.613.
b) Shine around its own mean gives 5200.0; shine around the line gives 3464.3. So of all the difference in shine, two thirds is left over once the line has had its share — and the one third it does take is exactly the R² = .33 you saw in Exercises 3.1 and 3.2.
You already have residual. Make three more columns in the R box (type Scale):
deviation -> shine - mean(shine)
deviation2 -> deviation^2
residual2 -> residual^2
Add up the two columns of squares: Descriptives, deviation2 and residual2 in Variables, and under Statistics the Sum tick box. It says 5200.000 and 3464.286.
The same two are in the ANOVA table of your regression, under Sum of Squares: Total 5200.000 and Residual 3464.286. The top row, Regression 1735.714, is the part the line does take.
Why that is so, you’ll find below.
get it
The residual, and where R² comes from
residual · residual plot · R²
Look at that sum of the residuals once more. Zero — not roughly, but exactly, give or take rounding. That’s no coincidence and no compliment to the line either: it’s the construction. That’s how the line was laid — for every miss on the plus side there’s just as much on the minus side, because if anything were left over, the whole line could shift a bit, and then it wouldn’t have been the best-fitting line.
Build in small moments to check — it ought to be zero; is it? So do hold on to that zero as a checkpoint: if your column of residuals doesn’t add up to zero, something has gone wrong along the way.
But mind what it also means. Precisely because that sum is always zero — with a line that runs tight through the cloud and with a line that leaves all sorts behind — it says nothing about how well the line guesses. Plus and minus cancel out regardless. If you want to know how well, you mustn’t add up but look: how widely do the misses lie around zero?
And that’s exactly what you see in the residual plot. The twenty-two this exercise opened with stand there as a single column: same guess, twenty-two misses, above and below zero.
Open penguins.csv and run Regression → Linear Regression with body_mass_g as Dependent Variable and flipper_length_mm in Covariates; under Plots, tick Residuals vs. predicted. Then make the same column as with the stones:
residual -> resid(lm(body_mass_g ~ flipper_length_mm))
Descriptives gives you the two numbers you need: body_mass_g spreads with Std. Deviation 801.955, residual with 393.700. Divide one by the other and square, in three small steps you can all check by hand:
393.700 / 801.955 = 0.491
0.491 x 0.491 = 0.241
1 - 0.241 = .759
Mind one number in Model Summary: there it says RMSE 394.278 and not 393.700. Neither is wrong — the RMSE divides by 340 (342 animals minus the two numbers that describe the line, the intercept and the slope), a standard deviation by 341.
Without the line your best guess for every weight was the mean — you know that game. The standard deviation of the weight measures how widely the weights lie around that one guess: 801.95 grams. With the line they lie closer together. The standard deviation of the misses measures how widely they lie around the line: 393.70 grams. So the line makes the spread 408.25 grams narrower, just over half of the spread without the line.
And yet Exercise 3.2 said R² = .76. Three quarters. Who’s lying — the half or the three quarters? Neither; they count in a different measure. Think of all the difference in weight as a garden full of variation. Explaining an association isn’t explaining a length but an area, and area goes in squares — so square the two standard deviations before you divide one by the other. Then it says .24: the part of the garden the line leaves behind, divided by the whole garden. The rest the line does take: one minus .24 is .76. In metres along the edge the line wins just over half; in garden area, three quarters. It’s the same gain, measured twice.
And R² needs nothing new for that: everything it knows is already in the misses. Do the same on the twelve stones and out comes .33 — exactly the square of the r you put together yourself at the start of this chapter, with all its decimals (the rounded .58 squared gives .34). Two routes, one number: square the correlation, or keep the books on the misses.
your turn
The bookkeeping of the penguin line
sum of the residuals · residual plot · R² from the misses
Now you, on the line from the hook: the weight of 342 penguins, predicted from their flipper length. You drew it and read it in Exercise 3.2; now you’re going to work out what it left behind.
penguins.csv is open and the regression of body_mass_g on flipper_length_mm is running. One more column to add, next to residual:
guess -> fitted(lm(body_mass_g ~ flipper_length_mm))
Answer the questions in order; they build on each other. The last one is deliberately called Z) and not k): the cloud question always comes last.
There are eleven of them, and that’s too many for one sitting. After e) you have the misses in hand and you’ve found the hook again — a good moment to stop. At f) the bookkeeping starts, and that’s the part R² rolls out of.
In brackets, each time, is what belongs in a complete answer. Where it says that a part is up to you, the wording is free — for the rest, the answer is fixed. And under Exam-style questions, at the end of this exercise, the same topics come round once more, in the form an exam would ask them in.
a) Ask for the prediction and the residual of the first six penguins (the first six rows of guess and residual). For one of the six, add the two together and set the result beside its real weight. (two rows of six, and one sum)
b) Add up all 342 residuals. What comes out, and why is that not a compliment to the line? (one number, and two sentences)
c) Draw the residual plot. What should be there, and what do you see? (two sentences)
d) Find the penguin where the line is furthest off, upwards and downwards. (two numbers with their unit, and say which species they are)
e) Back to the twenty-two from the hook. Ask for the residuals of the penguins with a flipper of exactly 190 millimetres. (the smallest and the largest, and one sentence on what stands above that one guess in the residual plot)
f) Now the bookkeeping. Add up the squared deviations of the weight around its own mean, and those of the residuals around zero. Then add up the squared distances from the line to the mean (all three are in the ANOVA table, under Sum of Squares: at Total, Residual and Regression). (three numbers — and add the last two together)
g) Work out R² from those numbers: one minus the residual sum divided by the total sum. Set it beside the R² in Model Summary. (two numbers)
h) Ask for the standard deviation of the weight and that of the residuals. By what percentage does the line make the spread narrower — and why is that a different number from the R² in g)? (two numbers, and two sentences)
i) Colour the residual plot by species and ask for the mean residual per species. What does that say about the line? (three numbers, and two sentences)
j) Write down your finding in one sentence. (what the line covers, and what it leaves behind per penguin — those two have to be in it, the words around them are up to you; more than one answer is right)
Z) Is the cloud straight, and are there no points in it screwing the whole thing up? Look at your residual plot from c) — is there an arc in it, or does one animal hang so far out that it pulls on the line all by itself? (two short statements, and say which of your answers above depend on them)
a) The six predictions are 3212.3 · 3460.7 · 3907.9 · 3808.5 · 3659.4 · 3212.3 grams, and the six residuals 537.7 · 339.3 · −657.9 · −358.5 · −9.4 · 412.7. Add them up per animal and you have the weight back: the first penguin weighs 3212.3 + 537.7 = 3750 grams, and that’s what’s in the file too. DATA = FIT + RESIDUAL, literally.
Look in your data at the first six rows of guess, residual and body_mass_g. If you want them as a table: under Statistics, at Residuals, tick the option Casewise diagnostics and set it to All.
b) Zero, give or take rounding. And that’s no compliment: it’s the way the line was laid. Every miss on the plus side has a miss on the minus side standing opposite it, and that goes for every best-fitting line — including one that’s completely off. A number that’s always the same can’t tell you anything about how well it’s going.
Descriptives with residual, Sum ticked: it says zero, give or take a little rounding dust.
c) What should be there is a shapeless cloud around the zero line: everything the line already knew has been calculated out, so what’s left over may no longer carry any pattern. And at first sight that’s what you see, too — a band of points that stays about equally wide from left to right and nowhere clearly runs up or down; at Z) you look more closely. What you do see is the vertical stripes: penguins were measured to whole millimetres, so the guesses land on a limited number of spots.
d) Upwards the line is off by 1288.69 grams (an Adelie, row 39) and downwards by 1058.80 grams (a Chinstrap, row 313). A good kilo, both of them — on animals that weigh a good four kilos on average.
Descriptives with residual gives Minimum −1058.797 and Maximum 1288.687. Which two animals those are, you find with the filter: residual == max(residual) leaves one row, and there you read off the species. Switch the filter off again afterwards.
e) From −609 to +941 grams. So in the residual plot, above that one guess of 3659.4, stands a single vertical stripe of twenty-two points, a good kilo and a half tall. That’s the hook, now as a picture: the same prediction, twenty-two different misses.
Put flipper_length_mm == 190 in the filter — 22 animals remain — and ask for the Minimum and Maximum of residual: −609.426 and 940.574. Switch the filter off again afterwards.
f) The total sum is 219 307 697, the residual sum 52 854 796 and the fit sum 166 452 902. Add those last two together and you get the first one back. That’s DATA = FIT + RESIDUAL, but in squared deviations — and that is the form in which the bookkeeping balances.
Check it by hand and you come out one too high: 166 452 902 + 52 854 796 is 219 307 698, and above it says 219 307 697. That’s no crack in the bookkeeping but rounding crumbs — all three sums were rounded separately, and unrounded they coincide, give or take machine noise.
All three are in the ANOVA table, under Sum of Squares: Total 219307697.368, Residual 52854795.628 and Regression 166452901.740. Those are the same three numbers as above, only without the spaces and with three decimals after them.
g) .76, both of them.
Working it out yourself: 1 − 52854795.628 / 219307697.368 = .759 — your own number, so without the zero in front. And in Model Summary it says 0.759, because JASP does carry its zero along.
And that’s the point of this exercise. R² is not a separate measure that JASP conjures up from somewhere: it’s the garden the line takes, divided by the whole garden. You’ve just worked it out from the misses yourself.
h) The standard deviation of the weight is 801.95 grams, that of the residuals 393.70. So the line makes the spread 408.25 grams narrower, and that’s 51 per cent of the spread without the line — just over half, not three quarters.
Two sentences on why both those numbers are right: the 51 per cent counts in grams, along the edge of the garden, and the .76 counts in area. Squaring turns just over half into three quarters — check it: 393.70 divided by 801.95 is .49, and .49 squared is .24, and one minus .24 is .76.
Descriptives with body_mass_g and residual: Std. Deviation 801.955 and 393.700. (The RMSE of 394.278 in Model Summary is a different number — see the box above, at the garden.)
i) Adelie +43.5, Chinstrap −215.7, Gentoo +65.8 grams.
Descriptives, residual in Variables and species in Split: 43.539, −215.683 and 65.789 grams. The coloured residual plot you make in that same Descriptives: take residual out of Variables for a moment, then put in first guess and then residual (the first one goes on the horizontal axis), leave species in Split and, under Customizable Plots, tick Scatter plots.
Two sentences: across all 342 the mean residual is zero, but per species it isn’t — for the Chinstraps the line sits systematically a good two hundred grams too high, and for the other two a little too low. That means there’s a third player in the cloud here too, exactly as in Exercise 3.1; only this time it’s small enough not to tip the line over.
j) For example:
The line of weight on flipper length covered just over three quarters of the differences in weight among 342 penguins (R² = .76), but still left nearly four hundred grams of spread behind per animal (SD of the residuals = 393.70).
Z) Half and half — and the half that doesn’t hold, you know already.
There’s a slight arc in it. A slanting stripe can’t be in it: the association between the guess and the miss is exactly zero, and that’s no finding but the construction — that’s precisely what “the line has gone flat” means. An arc can. Look carefully at your plot from c): at the low and the high guesses the points lie on average a little above the zero line, in the middle on average below it. That’s the dip from Exercise 3.2 — +57, −106 and +41 grams per third of flipper length — now as a picture instead of as three numbers. You can barely see it, and that’s why 3.2 worked it out for you. Where it comes from, you know already too: from the species. At i) the line sat a good two hundred grams too high for the Chinstraps, on average.
And no penguin pulls on the line all by itself. The biggest miss is 1288.69 grams, and that’s a good three times the standard deviation of the residuals — an animal that stands out, but not one that tips the line. Leave it out and the slope barely moves.
Regression → Correlation with guess and residual: Pearson’s r 0.000 — exactly zero, give or take machine noise.
What hangs on it: little here, because the arc is slight. Had it been stronger, the whole bookkeeping would still stand — the sums at f), the R² at g), the standard deviations at h) and the species means at i) are sums over these 342 animals, and those stay right whatever is bent. What you would then redo is every sentence in which you recommend the line: at j) it says it covers three quarters, and if the association runs strongly curved, that’s no lie, but it is a line that lets you down in the wrong place.
final task
The same bookkeeping on 2634 questionnaires
scale score · R² from the misses · the sample sentence
The last word of the whole chapter, and it ends where this book always ends: with people.
bigfive.csv holds 2634 people who rated twenty-five statements about themselves on a scale from 1 to 6. You use ten of them here — five on neuroticism, how easily you get upset, and five on openness, the taste for new things. You met them in Exercises 3.1 and 3.2, with O2 and O5 reversed first; now you do this exercise’s bookkeeping on them.
Open bigfive.csv and make three columns in the R box (type Scale), as in the toolbox: left of the arrow the name of the column, right of it what goes in the R box.
neuroticism -> rowMeans(data.frame(N1, N2, N3, N4, N5))
openness -> rowMeans(data.frame(O1, 7 - O2, O3, O4, 7 - O5))
residual_people -> resid(lm(neuroticism ~ openness))
Copy the right-hand side exactly; you don’t have to read it. The top two are the scales from Exercise 3.1, with the reversal of O2 and O5 in them; the bottom one says “give me what the line leaves behind”.
Then run Regression → Linear Regression with neuroticism as Dependent Variable and openness in Covariates.
a) Ask for the residuals and add them up. (one number, and one sentence on why you could have predicted that)
b) Ask for the standard deviation of neuroticism and that of the residuals. How much does the line save you? (two numbers, and one sentence)
c) Work out R² from the misses, just as with the penguins. (one number, and set it beside the R² in Model Summary)
d) Now the people version of the twenty-two penguins. How many people score exactly 4.0 on openness, what prediction do they all get, and how far apart does their real neuroticism run? (three answers, and one sentence)
e) Write down what you’ve found, in two sentences and in this fixed form:
Within these n people: … (R² = …). Whether that also holds beyond these n, you don’t know yet.
(fill in the n, the finding in plain words and the R² — and leave that second sentence exactly as it stands; for the finding, more than one answer is right)
a) Zero, give or take rounding — and you could have predicted that, because it holds for every best-fitting line, however well or badly it fits. It was so with the diamonds, it was so with the penguins, and so it is here.
Descriptives with residual_people, Sum ticked: zero, give or take a little rounding dust.
b) Neuroticism spreads with SD = 1.1946 scale points, the residuals with SD = 1.1897. So the line saves you 0.0049 of a scale point on a scale from 1 to 6 — in other words: next to nothing. (Four decimals here on purpose: at two you can’t even see the difference any more.) Whoever knows someone’s openness knows hardly any more about their neuroticism than whoever knows only the mean.
Descriptives: Std. Deviation 1.195 for neuroticism and 1.190 for residual_people. If you want to see the four decimals from the text — 1.1946 and 1.1897 — set Preferences → Results → Fix the number of decimals to 4.
c) .01, both of them. Of the whole garden this line takes barely one per cent.
1 − 1.1897² / 1.1946² = .008 — your own number, without the zero in front. In Model Summary it says 0.008.
d) 188 people score exactly 4.0 on openness. All 188 of them get the same prediction: 3.24 scale points of neuroticism. And their real neuroticism runs from 1.0 to 6.0 — from the lowest score that exists on this scale to the highest, all within that one guess.
Put openness == 4 in the filter: 188 rows remain, and that count is in Descriptives at Valid. For neuroticism it says Minimum 1.000 and Maximum 6.000 there. The prediction you work out yourself from the two numbers in Coefficients: 3.774 − 0.133 × 4 = 3.242. Switch the filter off again afterwards.
That’s the same figure as the twenty-two penguins this exercise opened with, only harder: there the real weight ran across a kilo and a half at one guess, here the real neuroticism runs across the whole scale at one guess. With people that’s the rule, not the exception.
e) For example:
Within these 2634 people: whoever is more open scores on average slightly lower on neuroticism, but openness and neuroticism share barely one per cent of their differences (R² = .01). Whether that also holds beyond these 2634, you don’t know yet.
Look at what that second sentence does. Everything you’ve worked out in this chapter — the covariance, the correlation, the line, the residuals, the R² — describes the people in front of you, and nobody else. You’ve been given no reason at all to assume that the next 2634 people would show the same, and no way either of saying how likely that is.
That is exactly where the next movement begins.
exam practice
Exam-style questions
DATA = FIT + RESIDUAL · R² from the misses · residual plot
These six have the form an exam would ask this topic in: four options, and exactly one is the best — the other three may well be true and still not be the best answer. Only questions 2 and 3 need any arithmetic.
1. You add up all 342 misses of the line and zero comes out. What may you conclude from that about how well this line guesses?
- Nothing: with every best-fitting line that sum is zero, even with a line that’s completely off.
- The line fits well: the misses above and below the line keep each other neatly in balance.
- The R² must be 1, because on balance nothing is left over.
- The line guesses neither too high nor too low on average, and that’s exactly what you want from a good line.
2. One of the twenty-two penguins with a flipper of 190 millimetres weighs 4250 grams. The line predicts 3659.4 grams for all twenty-two. How big is the miss for this animal?
- −590.6 grams
- 590.6 grams
- 4250.0 grams
- 7909.4 grams
3. For the line of weight on flipper length, the total sum of the squared deviations is 219 307 697 and the residual sum 52 854 796. What is the R² of this line?
- .24
- .51
- .76
- 3.15
4. The standard deviation of the weight is 801.95 grams, that of the misses 393.70 grams. In grams, then, the line makes the spread 51 per cent narrower, while the R² is .76. Which statement about those two numbers is the best?
- One of the two must be wrong; the same gain can’t have two numbers.
- The 51 per cent counts in grams and the .76 in squared grams; it’s the same gain, measured twice.
- The .76 belongs to the line and the 51 per cent to the misses, so they’re about different things.
- The .76 is too optimistic: 51 per cent is what the line really saves you, and the R² inflates that by squaring.
5. You draw the residual plot: the guess on one axis, the miss on the other. What should be there, and what does it mean if there is a pattern in it?
- A rising cloud — the miss should run along with the guess; if it lies flat, something has gone wrong.
- A shapeless cloud around the zero line; a pattern means the line has left something behind that it could have taken along.
- A shapeless cloud around the zero line; a pattern means there are measurement errors in the file.
- A falling cloud — big guesses always go with smaller misses.
6. You ask for the mean miss per species and it says: Adelie +43.5, Chinstrap −215.7 and Gentoo +65.8 grams. Yet the mean miss over all 342 animals is zero. Which statement is the best?
- Those can’t both be true: three means that aren’t zero can’t add up to zero between them.
- The line is useless for Chinstraps and must be drawn separately for that species.
- The species carries information the line doesn’t have: within a group the balance may tilt, even though over all 342 animals it stands at zero.
- The three species differ too much in size, and so the biggest species pulls the mean towards zero.
1 a · 2 b · 3 c · 4 b · 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. a. That zero is the construction and not the outcome: that’s how the line was laid. A number that’s always the same can’t tell you anything about what differs. b reads the balance as a compliment, and that’s the trap — plus and minus cancel out with a line that leaves all sorts behind, too. c confuses nothing on balance with nothing: the misses aren’t zero, their sum is zero, and the R² is .76. d is the trickiest, because the statement is true — the line guesses neither too high nor too low on average — and precisely because of that it says nothing: it holds for every best-fitting line, so it distinguishes this line from nothing.
2. b. DATA = FIT + RESIDUAL, so the miss is what’s really there minus what the line guessed: 4250 − 3659.4 = 590.6 grams. a has the sign the wrong way round and computes fit minus data; then this animal would be lighter than predicted, while it’s heavier. c names the weight itself. d adds instead of subtracting: 4250 + 3659.4 = 7909.4, and that’s heavier than the heaviest penguin in the file.
3. c. One minus the residual sum divided by the total sum: 1 − 52 854 796 / 219 307 697 = .76. a is the division without that one-minus in front — .24 is exactly the part the line does not take, and that’s exactly why the minus is there. b is the 51 per cent from question 4, the number in grams rather than in squared grams. d divides the fit sum by the residual sum: 166 452 902 / 52 854 796 = 3.15. A share coming out above 1 is your clue that something hasn’t been divided by the total.
4. b. Think of all the difference in weight as a garden: along the edge the line wins just over half, in area three quarters. Area goes in squares, so square first and then divide. a looks for a mistake where there is none; both numbers can be checked. c sets the line and the misses against each other, but they come from the same bookkeeping — the R² was worked out from the misses. d calls squaring an inflating move. It’s a choice of measure, and it’s the measure that explaining an association comes in: area, not length.
5. b. Everything the line already knew has been calculated out, so what’s left over may no longer carry any pattern — and if there is a pattern in it, then there was still something in the misses the line could have used. a and d expect a direction in the residual plot, and there can’t be one: with a best-fitting line the association between the guess and the miss is exactly zero. That the plot is flat is therefore no sign that something has gone wrong, but the intention. c has the right cloud and the wrong conclusion: a pattern points to something the model is missing, not to faults in the scales.
Note that pattern has two guises here, and you meet both. A pattern along the axis is an arc, or a fan that gets wider: then the miss goes with the height of the guess. A pattern per group is what you work out at i): within one species the misses lie on one side on average, while over all 342 animals together they come out at zero. The second you don’t see if you don’t colour the points — and that’s exactly why i) asks you to.
6. c. Over all 342 animals the mean miss is zero, because that’s how the line was laid — but within a group that balance is quite free to tilt. That the Chinstraps are systematically a good two hundred grams off means the species knows something the line doesn’t: the third player from 3.1, now visible in the misses. a is too quick: negative and positive do add up to zero between them, and these are unequal groups besides (151, 68 and 123 animals), so it doesn’t even count with the same number of animals per species. b jumps from an observation to an intervention; two hundred grams on an animal of a good three and a half kilos is small, and this exercise deliberately lets that line stand. d has the biggest species pulling the mean towards zero, and that’s the wrong way round: the zero isn’t there in spite of the species but by construction.
The numbers in these six questions all appear earlier on this page. What’s new is the miss in question 2 and the wrong distractors — and those are all written out above as sums, so you can check them without having to take them on trust.
◠ Same shape in the book
Here: the misses worked out yourself, and R² from the bookkeeping instead of from a button.
In the book: Chapter 3 — The Little Rectangle
That’s where DATA = FIT + RESIDUAL first lands; here you see what’s inside that third term, and that the explained part can simply be counted out of it.
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.↩︎