StreamSnagSample reading edition. Made by StreamSnag from an invented lecture, written for this purpose and not taken from any real course. No AI was used on this page. The times open the sample study page, which has no video.Reading editionStudy guideStudy pageAll samples
Statistics for the life sciences · Reading edition

From a sample to a claim: standard error, confidence intervals and p-values

From the lecture's captions. Hesitation sounds and doubled words were taken out by rule. Nothing is reworded.

From a sample to a claim

00:01–06:34
00:01

Lecturer: Alright, let's make a start. Can everyone see the screen? Okay. One piece of housekeeping before we begin. Quiz two has moved. It is now on Wednesday, not Monday, same room, and you will want a calculator with a square root button, because, as you are about to find out, we take a lot of square roots in this half of the course.

00:34

Lecturer: So. Up to now everything we have done has been description. You have a pile of numbers, you draw a histogram, you work out a mean and a standard deviation, and you describe what you have got. Today we cross a line. Today we start making claims about things we have not measured. That is what inference is.

01:04

Lecturer: We measure a few, and we say something about all of them, and the whole lecture is really about one question: how wrong could we be?

Slide 2Population and sample
01:20

Lecturer: Let me set up the example we are going to use for the whole hour. Suppose we want to know how long students at this university sleep on a weeknight. All of them. That group, everybody we care about, is the population, and the true average for that whole population gets a Greek letter, mu. Mu is called a parameter. It is a fixed number.

01:51

Lecturer: It exists. We just do not know it, and we are never going to know it exactly, because we are not going to follow twenty thousand people home. What we do instead is take a sample. So say we survey sixty-four students, chosen at random, and we get a sample mean of six point eight hours, with a standard deviation of one point six hours. The sample mean gets the symbol x-bar, and x-bar is called a statistic. So, parameter for the population, statistic for the sample.

02:36

Lecturer: P goes with P, S goes with S, if that helps you. Now here is the uncomfortable thing. If I had surveyed a different sixty-four students, I would not have got six point eight. I might have got six point six, or seven point one. The parameter does not move, but the statistic moves every time you take a new sample. So when I report six point eight, the honest question is, how much would that number have bounced around?

03:17

Student: Does it matter how big the university is? Like, sixty-four out of twenty thousand seems tiny.

03:27

Lecturer: Good question, and the answer surprises people. As long as the population is much bigger than the sample, the size of the population barely matters. What matters is the size of the sample. Sixty-four random students tell you about as much about a university of twenty thousand as about a country of twenty million. The word doing the heavy lifting there is random. A big sample that is not random is worse than a small one that is.

Slide 3The sampling distribution of the mean
04:11

Lecturer: So let's do a thought experiment. Imagine we did not run the survey once, but thousands of times. Each time, a fresh sixty-four students, each time we write down the mean. Six point eight, six point six, seven point one, six point nine, and so on. And then we draw a histogram, not of students, but of those means. That histogram has a name.

04:45

Lecturer: It is the sampling distribution of the mean, and it is the most important idea in this course. It is a distribution of a statistic, not of individual people. And we know three things about it, without ever having to run those thousands of surveys.

  1. First, it is centred on mu, the true population mean. So the sample mean is not biased; on average it lands in the right place.
05:21
  1. Lecturer: Second, its spread is the population standard deviation divided by the square root of the sample size. Sigma over root n.
  2. And third, and this is the central limit theorem, its shape is approximately normal, the bell curve, even if the population itself is not normal at all.

That third one is slightly magical. Sleep is not normally distributed. There is a long tail of people who sleep four hours, there are a few who sleep eleven. It is lopsided.

06:01

Lecturer: It does not matter. Once you average thirty or more of them, the averages pile up in a bell shape. The usual rule of thumb is a sample size of about thirty is enough, a bit more if the population is very skewed.

06:26

Lecturer: Now, that spread, sigma over root n, is so useful that it has its own name.

Standard error

06:35–13:56
06:35

Lecturer: It is the standard error of the mean. And since we do not know sigma, the population standard deviation, we use the sample standard deviation, s, in its place. So the standard error is s over the square root of n. Let's do it for our survey. The standard deviation was one point six hours. The sample size was sixty-four, and the square root of sixty-four is eight. So one point six divided by eight is zero point two.

07:16

Lecturer: The standard error is zero point two hours, which is twelve minutes. I want you to be very clear on the difference between those two numbers, because it is the single most common mistake on the exam. The standard deviation, one point six hours, tells you how much individual students differ from each other. The standard error, zero point two hours, tells you how much the sample mean would differ from survey to survey. Standard deviation is about people. Standard error is about the precision of your estimate.

08:01

Lecturer: If you collect more data, the standard deviation does not shrink, students are as varied as they ever were. The standard error does shrink. And how fast does it shrink? Look at the formula. It is the square root of n on the bottom. So to halve the standard error, you need four times the data.

08:31

Lecturer: If we went from sixty-four students to two hundred and fifty-six, the square root is sixteen, and one point six over sixteen is zero point one. Four times the work for twice the precision. That is the law of diminishing returns in statistics, and it is why studies do not just keep getting bigger.

09:00

Lecturer: Okay. So now we can build the thing you will see in every paper you ever read, the confidence interval. The logic goes like this. The sampling distribution is normal. In a normal distribution, ninety-five percent of the values fall within one point nine six standard deviations of the centre. So ninety-five percent of the time, our sample mean will land within one point nine six standard errors of the true mean.

09:35

Lecturer: And if x-bar is within that distance of mu, then mu is within that distance of x-bar. Same distance, just seen from the other end. So the recipe for a ninety-five percent confidence interval is, the sample mean, plus or minus one point nine six times the standard error. For us, one point nine six times zero point two is zero point three nine two, call it zero point three nine.

Slide 5The 95 % confidence interval
10:12

Lecturer: So six point eight minus zero point three nine is six point four one, and six point eight plus zero point three nine is seven point one nine. Our ninety-five percent confidence interval for the mean sleep of all students is six point four one to seven point one nine hours. That plus or minus part, the zero point three nine, is called the margin of error.

10:44

Lecturer: What if you want to be more confident? You can have a ninety-nine percent interval. The multiplier goes up from one point nine six to two point five seven six. Two point five seven six times zero point two is about zero point five two, so the interval becomes six point two eight to seven point three two. Notice what happened. More confidence, wider interval.

11:16

Lecturer: You never get something for nothing. If you want an interval that is both confident and narrow, the only honest way is a bigger sample.

Slide 6What “95 % confident” means
11:32

Lecturer: Now I have to be a little bit annoying, because there is a right way and a wrong way to say what ninety-five percent means, and nearly everyone says it the wrong way. The wrong way is, there is a ninety-five percent chance that the true mean is between six point four one and seven point one nine. It sounds perfectly reasonable. It is not what the method gives you.

12:08

Lecturer: Here is why. Mu is a fixed number. It is not jumping around. It is either inside this particular interval or it is not. The thing that is random is the interval, because the interval came from a random sample. So the ninety-five percent describes the procedure.

12:32

Lecturer: If we repeated the survey a hundred times and built a hundred intervals, about ninety-five of them would contain the true mean, and about five would miss it. That is the picture on the slide, a hundred horizontal bars, and a handful, drawn in red, that do not cross the vertical line. And the awkward part is, you never know whether yours is one of the red ones. You ran one survey, you have one interval. So the careful sentence is, we are ninety-five percent confident, meaning we used a method that works ninety-five percent of the time. I am not going to take marks off if you slip in conversation.

13:28

Lecturer: I will take marks off if you write the wrong version in the exam.

13:37

Student: So is it wrong to say there's a five percent chance we're wrong?

13:44

Lecturer: It is closer. I would say, the method is wrong five percent of the time. That keeps the probability attached to the method, where it belongs.

Small samples: Student's t

14:00–21:47
14:00

Lecturer: Right, a complication. Everything so far quietly assumed we had a decent sized sample. Remember we swapped sigma, which we do not know, for s, which we estimated. With sixty-four people, s is a pretty good estimate. With a small sample it is not, it is itself quite wobbly, and if we ignore that, our intervals come out too narrow. We would be claiming more precision than we have.

14:35

Lecturer: The fix was worked out by a man called William Gosset, who was a brewer at Guinness in Dublin, and who published under the name Student because the brewery did not want competitors to know they employed statisticians. So it is called Student's t distribution. It looks like the normal curve, but with fatter tails, and exactly how fat depends on the degrees of freedom, which for one sample is n minus one.

15:11

Lecturer: Let's see what difference it makes. Suppose we had only surveyed sixteen students and happened to get the same mean and standard deviation. The standard error is now one point six over the square root of sixteen, so one point six over four, which is zero point four. Degrees of freedom, sixteen minus one, fifteen. And instead of one point nine six, the table gives us two point one three one. So the margin of error is two point one three one times zero point four, about zero point eight five.

15:56

Lecturer: The interval runs from five point nine five to seven point six five. Much wider than before, partly because the sample is smaller, and partly because of that bigger multiplier. As the sample grows, t settles down towards the normal value. At thirty degrees of freedom the multiplier is two point zero four two. At a hundred it is one point nine eight four. So in practice, sorry, in practice people just use t all the time when sigma is unknown, which is always, and for large samples it makes no real difference.

16:47

Lecturer: Okay, second half of the story. So far we have estimated. Now we test. Suppose the university wellbeing leaflet says, our students get a healthy seven and a half hours of sleep a

Slide 8Hypothesis testing
17:03

Lecturer: Night. And you look at your six point eight and think. A hypothesis test is the formal version of.

17:14

Lecturer: It goes in steps.

  1. Step one, state the null hypothesis, the claim you are testing. Here, mu equals seven point five.
  2. Step two, ask, if that were true, how surprising is my data? We measure surprise in standard errors. Our mean is six point eight, the claim is seven point five, the difference is minus zero point seven, and the standard error is zero point two.
17:48

Lecturer: Minus zero point seven divided by zero point two is minus three point five. Our sample mean is three and a half standard errors below what the leaflet says. That number is the test statistic, here a z score.

18:08
  1. Lecturer: Step three, turn that into a probability. If the null were true, how often would a sample land three and a half standard errors away or further, in either direction? The answer is about zero point zero zero zero five. Five times in ten thousand. That probability is the p-value.
  2. And step four, compare it with a threshold you chose in advance, called alpha, which by convention is zero point zero five.
18:43

Lecturer: Our p-value is far below that, so we reject the null hypothesis. The data are not compatible with seven and a half hours. Now try a different claim. Suppose the leaflet had said seven hours. Then the difference is six point eight minus seven, minus zero point two, divided by the standard error of zero point two, which is minus one. One standard error away.

19:17

Lecturer: The p-value for that is about zero point three two. That would happen about a third of the time just by the luck of the draw. So we do not reject. And notice the wording. We do not say we have proved that the mean is seven. We say we fail to reject.

19:45

Lecturer: Absence of evidence against is not evidence for. And here is something neat that ties the two halves together. Seven point five was outside our ninety-five percent confidence interval, and we rejected it. Seven was inside the interval, and we did not. That is not a coincidence. The ninety-five percent confidence interval is exactly the set of values that a test at the five percent level would not reject.

20:22

Lecturer: So the interval tells you everything the test does, and more, because it also tells you how big the effect might be. I want to spend five minutes on what a p-value is not, because it is the most misunderstood number in science. The definition, once more. The p-value is the probability of getting data at least as extreme as yours, if the null hypothesis is true. It starts from the assumption that the null is true.

21:07

Lecturer: So, misreading number one. The p-value is not the probability that the null hypothesis is true. A p-value of zero point zero three does not mean there is a three percent chance the leaflet is right. It is the probability of the data given the hypothesis, not the probability of the hypothesis given the data, and those are different things. The probability that you are in this lecture hall, given that you are a statistics student, is high. The probability that you are a statistics student,

What a p-value is not

21:47–27:35
21:47

Lecturer: Given that you are in this lecture hall, well, some of you are here for the heating. Misreading number two. A small p-value does not mean a big or important effect. It is partly about the effect and partly about the sample size. Let me show you. Suppose we survey ten thousand students, and the mean comes out just zero point zero five hours below the claim.

22:20

Lecturer: Zero point zero five hours is three minutes. Nobody cares about three minutes of sleep. But the standard error with ten thousand people is one point six over a hundred, zero point zero one six. So the test statistic is zero point zero five over zero point zero one six, which is about three point one, and the p-value is about zero point zero zero two. Highly significant, and completely unimportant. So we separate statistical significance, which means unlikely to be chance, from practical significance, which means big enough to matter.

23:04

Lecturer: Always report the size of the effect and its confidence interval, not just the p-value. And misreading number three, a p-value above zero point zero five does not show there is no effect. It may just mean your sample was too small to see it.

Slide 10Two kinds of error, and many tests
23:30

Lecturer: Which brings us to the two ways a test can go wrong. A type one error is rejecting a null hypothesis that is actually true. A false alarm, a false positive. And the lovely thing is that you choose how often that happens. It is alpha. Set alpha at zero point zero five, and when the null is true you will raise a false alarm five percent of the time.

24:07

Lecturer: A type two error is the opposite, failing to reject a null that is false. A miss. Its probability is called beta, and one minus beta is the power of the test, the chance of detecting an effect that is really there. Studies usually aim for a power of eighty percent. And the main thing you can do to get more power is, you have guessed it, a bigger sample.

24:43

Lecturer: Now, one consequence of that five percent that catches out professionals. Suppose you do not run one test, you run twenty. Twenty different outcomes, sleep and grades, sleep and mood, sleep and coffee, and suppose in truth nothing is going on in any of them. Each test has a five percent chance of a false alarm. Twenty times zero point zero five is one. So you expect one significant result from pure noise.

25:20

Lecturer: And the chance of getting at least one is one minus zero point nine five to the power of twenty, which is about sixty-four percent. Nearly two in three. So if somebody tests twenty things and shows you the one that worked, you should not be impressed.

25:45

Lecturer: The simplest protection is called the Bonferroni correction. You divide alpha by the number of tests. Twenty tests, zero point zero five over twenty, so each one has to beat zero point zero zero two five instead. It is strict, some would say too strict, but it is honest, and it is the one I expect you to know.

Slide 11Summary
26:18

Lecturer: Let me pull it together.

  1. One, a statistic varies from sample to sample, and the sampling distribution describes how.
  2. Two, its spread is the standard error, s over root n, and you need four times the data to halve it.
  3. Three, a ninety-five percent confidence interval is the mean plus or minus about two standard errors, and the ninety-five percent describes the method, not this one interval.
  4. Four, small samples use t instead of z.
  5. Five, a p-value is the probability of data this extreme if the null is true, and nothing else.
  6. And six, significant does not mean important, and twenty tests will hand you a false positive most of the time.
27:16

Lecturer: Next time we take all of this and compare two groups, students with morning lectures against students without, which is the two-sample t test. Read chapter nine before then. And remember, quiz on Wednesday, bring the calculator. Thanks, everyone.