# Typical Error, Agreement and a First Model

Class 21, Chapter 11: Is the Change Real? Statistics and Machine Learning. 29 slides, about 37.5 minutes.

## 1. Title

Slide up while people sit down. Six weeks ago an athlete jumped thirty point one centimetres. Today the app says thirty-two point one. Everyone in this room has a number like that from the first week. Today we learn to say whether a change is real, and to say it in words an athlete can use.

## 2. Harper's 2 cm  (1 min)

Meet Harper, a middle blocker on a university volleyball team. In week one the jump app said thirty point one centimetres. After six weeks of plyometric work it says thirty-two point one. Harper is pleased. The coach asks the question of this chapter: is that two centimetres the training, or would Harper have jumped that high on a good day anyway? Measure anyone twice with nothing changed and the numbers differ. Part is the athlete, part is the measurement. You cannot pull them apart with one test, and for a decision you do not need to. You need their combined size.

## 3. Five teammates, two days apart  (2 min)

[Ask the room, take two answers, then click.] Five of Harper's teammates jumped twice, two days apart, same time of day, same warm-up. The changes go both ways, from minus one point four to plus one point six. The mean change is small, plus zero point three six, which is what you expect: nobody improves in two days. The interesting number is the spread of the changes, one point two six. But each change is the difference of two noisy tests, so it carries both noises. Divide by the square root of two and you get the noise of one test: zero point eight nine centimetres.

## 4. Typical error from a test and a retest  (2 min)

Here is the formula. Typical error is the standard deviation of the test-retest changes divided by root two. For the five teammates, one point two six over one point four one four is zero point eight nine centimetres. Hopkins calls this the most useful single measure of reliability, because it is in the units of the test. The engineer's note shows where root two comes from: variances of independent errors add. Two cautions on the right. The typical error belongs to a protocol, not to an app: change the camera height or the warm-up and it changes. And five pairs give only a rough estimate; next class we put an interval on it.

## 5. The smallest worthwhile change comes from the sport  (1.5 min)

The typical error says how big the noise is. It does not say how big a change has to be to matter. That is a second number, the smallest worthwhile change, and it comes from the sport. For a fitness test in a team sport, a common default is a fifth of the spread between athletes. The teammates' day-one standard deviation is three point two six, so the smallest worthwhile change is zero point six five centimetres. In a sport scored by time or distance, set it from the result itself. Either way, coach and athlete agree on it before the retest, not after they see the number.

## 6. A decision rule that ends in words  (2.5 min)

Now Harper. The change is two centimetres, and both tests are single tests, so the noise of the change is root two times the typical error, one point two six. Treat the change as the best guess of the true change, with that noise around it. Ask three chances: bigger than plus the smallest worthwhile change, inside the band, or below minus it. For Harper: eighty-six percent gain, twelve trivial, two loss. Numbers like that are hard to say aloud, so put a word on them. Eighty-six is likely. On the right, Harper's interval reaches into the shaded band. A four centimetre change clears it. The honest sentence: likely improved, but a trivial change cannot be ruled out.

## 7. Listing 11.1: typical error, SWC and the three chances  (1.5 min)

Here is the whole rule in fifteen lines. Two arrays hold the two days. The typical error is the standard deviation of the differences over root two. The smallest worthwhile change is a fifth of the day-one spread. Then the three chances from the normal curve, the same formula as the last slide. I left out two print lines to fit the slide; the full file is on the class page. [Point at the output.] Zero point eight nine, zero point six five, eighty-six, twelve, two. In homework you change the arrays to your own jumps and the change to your own, and you write down what you expect before you run it.

## 8. The cheapest precision: measure again  (1.5 min)

Two cheap improvements follow from the formula. Average three trials on a day and the noise of that day's value falls by about root three, from zero point eight nine to about zero point five one. And a baseline of several sessions beats a single before test, because the mean of n sessions carries the typical error over root n. Comparing one new session with a baseline mean, the noise is the typical error times root of one plus one over n. You will code exactly that next week. The disc app already works this way: it refuses to grade until it has five matching clips of you.

## 9. A range by resampling: pick the independent unit  (1.5 min)

The bootstrap puts a range on any summary. Draw five values from your five with replacement, take the mean, and repeat ten thousand times. The middle ninety-five percent is the interval. For the five recoveries, the mean runs from twenty-one point two to twenty-eight point five. The median runs from the smallest value to the largest: with five values the bootstrap says little more than somewhere in the range you saw, so show the values. The bigger lesson is on the right. Resample the unit that is independent. Treat forty repeats as independent and the interval is too narrow. Resample the eight sessions and it is almost twice as wide, and honest. Recovery numbers are training information, not a health test.

## 10. The instructor's data: two nights on a chest strap  (2 min)

Now real data: the instructor's own chest strap, two nights in June. The file gives one number per night: the median of five-minute RMSSD values. Night one, fifty point three milliseconds. Night two, fifty-eight point seven. Is that a real change? [Let someone answer.] We cannot say. We have one pair, and no typical error for this measure on this person. Notice too that the lowest heart rate went up on the second night, the opposite of what you might expect if recovery improved. To judge it, you would record many nights with nothing changed, exactly the test-retest we just did for jumps. This is a training measurement, not a health test.

## 11. Correlation is not agreement  (1.5 min)

The question when you have two methods is agreement: can one replace the other? That is not the same as: are they related? Here is the cleanest example. The jump app only counts a foot as airborne once it is four centimetres up, so it adds a correction to the flight time. Suppose an analyst forgets the correction for some jumps. Put it through the height formula and the corrected height is exactly the plain one plus four centimetres. Plot one against the other: a perfect line, correlation one. They never agree. Bland and Altman made this point in nineteen eighty-six, and it is still the most common error in method comparison.

## 12. Bias and limits of agreement find a data error  (2.5 min)

Bland and Altman's alternative: for each pair, take the difference and the mean. The bias is the mean difference. The limits of agreement, the bias plus or minus one point nine six standard deviations, are where about ninety-five percent of single differences fall. Here it is on the course's running data. Stride length is in the file, and it can also be computed as speed over stride rate. A correlation of zero point nine nine one would pass most eyes. The limits, minus twelve to plus fourteen centimetres, do not. The plot shows why: almost every trial is on zero, and two trials of one runner sit far above. Their speed label was one rung too low. Remove those fifty rows and the limits shrink below a centimetre. The check found a data error.

## 13. A watch and a strap correlate at r=0.98  (2 min)

[Thirty seconds. Hands up for A, B, C, D.] The answer is D. A correlation says the two move together along some line. It says nothing about how far apart they are. A ten beat offset, or an offset that grows with intensity, can sit with a correlation of zero point nine eight. We just saw a correlation of exactly one with a four centimetre gap. A and B both need the bias and the limits of agreement, which we have not computed. C mixes up two ideas: a correlation below one says the points scatter around the line, not that one device reads high.

## 14. Two devices, one athlete  (1.5 min)

Here is how this sounds to a coach. A correlation between a watch and a strap tells them nothing they can use. Two questions do: on average, how far apart are the two, and how far apart can they be on a single day? That second number is the limit of agreement. If it is wider than the change you are trying to see, keep the same device for the whole block and never compare one device's numbers with the other's. One more rule from Bland and Altman: if each person gives several pairs, do not pool them as if they came from different people.

## 15. A size, its interval, and the spread of people  (2 min)

Sometimes the question is about a group. Do runners load the leg harder at a higher speed? Three numbers answer it. The size: one rung up the ladder adds zero point zero nine one body weights on average. The interval: plus zero point zero six eight to plus zero point one one four, the true mean changes that fit the data. And the effect size, the change divided by the spread between runners: zero point four, small to moderate. From rung four to five it is zero point three three, with d of one point oh seven. But look at the box: the eighteen runners' changes run from almost nothing to nearly a whole body weight. The mean describes almost none of them.

## 16. What a p-value answers  (2.5 min)

The output also prints a p-value. It answers one question: if the true change were exactly zero, how often would data like these turn up? With eighteen runners, four in ten thousand. [Ask: what if we count all one thousand and twenty steps as independent? Take guesses, then click.] Ten to the minus forty-nine. Forty-five orders of magnitude, same mean change. The p-value shrinks with the amount of data, so a trivial effect becomes significant with enough rows. But the steps are not independent people. A coach never asked whether the change is exactly zero. A coach asked whether it is big enough to matter and how sure we are. That is the size and its interval.

## 17. Confounders, and a plan on one page  (1.5 min)

The speed ladder was close to an experiment: the protocol set the speeds and each runner was compared with themselves. Most athlete data are not like that. If athletes who lift more also run faster, fitness could drive both. So could fatigue, weather, new shoes, or a test that drifted from morning to evening. Only three things move a comparison toward a cause: assign the change yourself by chance, hold the confounders fixed, or measure them and compare like with like. Write it on one page first: six items. The book's example: one athlete, ten test days at four in the afternoon, a coin picks the warm-up. It answers the question for that athlete, not the team.

## 18. Peak force against speed: 22 runners, 2\,620 steps  (2.5 min)

Regression fits a formula that predicts one number, the target, from others, the features. The data are real: a course module's running mechanics file. The question: can the peak force under the left foot be predicted from ten gait measures a camera could estimate? First it was cleaned: two hundred ninety-two duplicate rows, short fragments, and the fifty mislabeled rows we just found. That leaves two thousand six hundred twenty steps from twenty-two runners. A straight line through them has slope zero point two five body weights per metre per second, and speed alone explains forty-seven percent of the variation. Remember the vertical spread at one speed, about one body weight. It comes back next class.

## 19. Ten predictors: a better fit, unstable coefficients  (2.5 min)

Add all ten measures and the fit improves: R squared from zero point four seven to zero point six four. Now read a coefficient. Each one is the change in predicted force for one unit of that measure, with the other nine held fixed. That phrase is the trap. Speed, stride rate and stride length are tied exactly, so you cannot hold two fixed and move the third. The model fits, but it cannot share the credit. Fifty rows out of two thousand six hundred seventy moved speed's coefficient from zero point zero three five to zero point six four eight and flipped the sign of stride length. The variance inflation factor flags it: seven hundred forty. Predict with it; do not coach from a coefficient.

## 20. Residuals and overfitting  (2 min)

Before you believe a fit, look at the residuals: observed minus predicted. Against the fitted values they should look like even noise. Here peak force rises faster than a line at the top speeds, so you see a curve. In recorded order they should not run in streaks. The Durbin-Watson statistic is about two with no streaks; here it is zero point three eight. Why? Neighboring rows are steps of the same runner, and the model knows nothing about runners. Then overfitting. A flexible extra-trees model scores R squared one point oh oh on its own training steps. That is memory, not skill. Thursday we see what it scores on a runner it has never met.

## 21. Before Class 22  (1.5 min)

Project step twenty-two is due at the start of next class. Repeat the tests you ran in weeks one to three, under the same protocol, and compute your own typical error and smallest worthwhile change. Then a first model on your project data, scored against a simple baseline, with a written plan for what you will hold out. The exercises are listed on the slide; eleven point nine is the jump app lab, three jumps on each of two days. Checkpoint two of the team project goes in with it. Read sections eleven point five to eleven point twelve before Thursday: individual models, classification, leakage and time series.
