Lecture: Numerical Summaries: Center & Spread
Lecture script · about 15–20 minutes spoken · Week 3
Opening
Picture three friends splitting a dinner bill. One plate cost 12 dollars, one cost 15, and one cost 18. If everyone pays the same share, each friend pays 15 dollars. You've done that arithmetic many times without calling it anything. It has a name, and it's the first idea in this lecture.
One average can hide the whole story, though. A nurse comparing a week of patient wait times needs to know more than the average wait. So does a small-business owner reading a month of daily sales, and so does a field biologist weighing penguins. Each of them needs two things: a number for the middle, and a number for how much the values vary.
In Week 1, you learned to tell a sample from a population and to sort each variable by its level of measurement. In Week 2, you drew pictures of one variable and learned to name its shape by the tail. This week puts numbers on those pictures. The level of measurement tells you which middle you're allowed to use, and the shape tells you which middle tells the truth. Next week, in Week 4, Exploring Relationships Between Two Variables, we'll move from one variable to two.
We'll take five ideas in order: three ways to find the middle, which middle resists a wild value, how the middle reveals skew, how to measure spread, and how five numbers sum up a whole dataset. We'll use three datasets you already know: the six faces of a die, the 12 months of a year, and the 342 penguins with a recorded body mass.
1. Center: find the middle three ways
Go back to the dinner. Each friend paying 15 dollars is the fair share, the amount everyone would pay if the total were spread evenly. That's a mean. A mean is the sum of all the values divided by how many values there are; it uses the size of every value and needs interval or ratio data.
There are two other ways to name the middle. Line the plates up from cheapest to priciest and point at the one in the middle. That's a median. The median is the middle value once the data are put in order, or the average of the two middle values when the count is even; it needs data that are at least ordinal. And you could ask which value shows up most often. The mode is the value or category that occurs most often; it is the only measure of center that works for nominal data. Together, these three are your measures of center.
Let's try a die. Its six faces are 1, 2, 3, 4, 5, and 6. They're every face there is, so they're a whole population. Add them and you get 21. Divide by 6 and the mean is 3.5. For the median, there's no single middle face, so you average the two middle ones, 3 and 4, and get 3.5 again. Notice that you'll never roll a 3.5. A mean doesn't have to be a value the data can take.
Now the calendar. The 12 month lengths add up to 365 days, so the mean is 365 divided by 12, which is about 30.4167 days. Put the months in order and you get one 28, four 30s, and seven 31s. The two middle months are both 31, so the median is 31. And 31 shows up seven times, so the mode is 31 as well.
Here's where Week 1 comes back. Penguin species is nominal, a set of labels, so only the mode works. With 152 Adelie out of 344 penguins, the mode is Adelie. There's no average species. Even if a spreadsheet codes the islands as 1, 2, and 3, averaging those codes gives you a number that names no island. Before you average anything, ask whether the numbers are amounts or labels.
Pause and try this. A coffee shop records each drink size as small, medium, or large. Which measures of center can it use for drink size?
Take a few seconds before you read on.
Here's the answer. It can use the mode and the median, but not the mean. Drink size has an order, so it's ordinal, and you can find the middle size, but you can't add "small" to "large."
2. Resistance: one wild value, two very different reactions
Imagine a quiet street where four homes sell for similar prices. Then someone buys the fifth home, a mansion, for a huge sum. The average price on the street shoots up. But the home in the middle of the price list hasn't changed at all. One wild value dragged the mean and left the median where it was.
That's the idea of a resistant measure. A resistant measure is a summary that changes little when one extreme or mistyped value is added or changed; the median is resistant and the mean is not. The mean feels the size of every value, so one huge value pulls it hard. The median only cares about which value sits in the middle position, and a huge value at the end of the line stays at the end of the line.
Let's watch it happen. Someone types the six die faces into a spreadsheet and hits the zero key by accident, so the 6 becomes 60. Now the faces add to 75, and the mean is 75 divided by 6, which is 12.5. That's bigger than any face on a real die. The median, though, is still the average of the two middle values, 3 and 4, so it stays at 3.5.
That gives you a handy habit. If a mean lands somewhere that makes no sense, like a typical die face of 12.5, check the data for a typing error.
Resistance doesn't make the median the winner every time. A business owner who needs the month's total sales wants the mean, because the mean times the count gives the total. The median answers "what's a typical value?" The mean answers "what's the fair share?" Choose the question first.
Pause and try this. After the typo, the mean of the die faces is 12.5 and the median is 3.5. Which one still describes a typical face, and why?
Give it a moment.
Here's the answer. The median, 3.5, still describes a typical face. It depends only on the middle position, so the single wild 60 at the end of the list can't move it.
3. Skew: let the mean and the median tell you the shape
Picture a quiz where most of the class scores high and a few students who missed a lesson score low. Those few low scores drag the class average down, but the student in the middle of the list still scored high. The average lands below the middle. That gap is a clue to the shape.
Here's the rule to carry with you: the median holds its ground, and the mean follows the tail. Skew pulls the mean toward the long tail, because the mean feels the size of every value out in that tail, and the median doesn't.
Let's check it on all three datasets. The month lengths have a mean of about 30.4167 and a median of 31. The mean sits below the median, because February's lone 28 days out in the left tail pull the mean down. So the months are left-skewed, exactly as you named them by the tail last week.
The penguins go the other way. The 342 body masses have a mean of 4,201.75 grams and a median of 4,050 grams. The mean is 151.75 grams higher, because a tail of heavy birds stretches out to the right and pulls the mean up. So body mass is right-skewed.
And the die? Its mean and median are both 3.5. The faces balance evenly, and the shape is symmetric.
This is a strong habit, not a law. In a small or oddly shaped dataset, the comparison can point the wrong way. So use the mean and the median to back up the picture, never to replace it.
Pause and try this. A biologist wants one number for the mass of a typical penguin in the field log. Should the report say 4,201.75 grams or 4,050 grams?
Think it through before you read on.
Here's the answer. The median, 4,050 grams, is the safer "typical" number. Body mass is right-skewed, so the mean is pulled up toward the heavy birds in the tail.
4. Spread: measure how far the values stray
Imagine two coffee shops that each sell about the same number of cups on an average day. At one shop, every day looks a lot like every other day. At the other, some days are slow and some are slammed. The average is the same, but only the first owner can order milk with confidence. The middle is the same; the spread isn't.
The quickest measure of spread is the range, the largest value minus the smallest value; it uses only the two most extreme values, so a single unusual value can stretch it. The die has a range of 5, the months 3 days, and the penguins 3,600 grams. But the range ignores everything in between.
So we use every value. Start by asking how far each value is from the mean. A deviation is how far one value sits from the mean, found by subtracting the mean from the value; deviations above the mean are positive and those below are negative. For the die, with its mean of 3.5, the deviations run from minus 2.5 up to plus 2.5, and they add to 0. They always add to 0, because the values above the mean balance the ones below. So we square them first. The squares are 6.25, 2.25, 0.25, 0.25, 2.25, and 6.25, and they add to 17.5.
Divide that by the number of faces, 6, and you get the variance. Variance is the average size of the squared deviations from the mean; it is measured in the square of the data's units. For the die, that's about 2.9167. Now take its square root and you get back to ordinary units. The standard deviation is the square root of the variance; it describes the typical distance of a value from the mean, in the data's own units. For the die, it's about 1.71. A typical face sits about 1.71 pips from the middle.
Here's the twist. The faces are a whole population, so you divided by the population size, 6. That's the population variance, sigma squared. But suppose the same six numbers were six rolls of a die you were testing. Then they're a sample, and you divide by one less, by 5. That's Bessel's correction. You get a sample variance of 3.5 and a sample standard deviation of about 1.87. Why one less? A sample's own mean sits a little too close to its own values, so the squared deviations come out a bit too small, and the smaller divisor makes up for it.
The same choice shows up in your spreadsheet. The 12 months are every month, so the population answer is about 0.86 days. A spreadsheet's sample function divides by 11 and gives about 0.90. The 342 penguins are a sample, so you divide by 341 and get a standard deviation of about 801.95 grams.
Pause and try this. The penguin variance would be measured in grams squared. Which number should you report to a reader, the variance or the standard deviation, and why?
Take a breath and decide.
Here's the answer. Report the standard deviation, about 801.95 grams. It's back in grams, a unit a reader can picture, while square grams describe nothing anyone can imagine.
5. Five numbers: quartiles, the IQR, and the boxplot
Picture runners crossing the finish line of a charity race. Line them up by finishing time and stop at five spots: the first runner, the runner a quarter of the way along, the middle runner, the runner three quarters along, and the last. Those five people tell you a lot about the whole race.
That's a five-number summary. The five-number summary is the minimum, the first quartile, the median, the third quartile, and the maximum, listed in that order. The first quartile, Q1, is the median of the lower half of the ordered data. The third quartile, Q3, is the median of the upper half. And the interquartile range, or IQR, is the third quartile minus the first quartile; it is the spread of the middle half of the data and is resistant to extreme values.
For the 342 penguins, the five numbers are 2,700, 3,550, 4,050, 4,750, and 6,300 grams. The IQR is 4,750 minus 3,550, which is 1,200 grams. Different tools round quartiles a little differently, but the conclusions here hold under every common method.
A boxplot draws those five numbers along a number line. Picture a box stretching from 3,550 to 4,750 grams, with a line inside it at 4,050. The line sits closer to the left end of the box. A short whisker reaches left to 2,700, and a longer whisker reaches right to 6,300. That longer right whisker says "right-skewed" all over again.
When is a value far enough out to flag? The course uses the 1.5 times IQR rule. Multiply the IQR by 1.5, then build a fence that far below Q1 and another that far above Q3. For the penguins, 1.5 times 1,200 is 1,800, so the fences sit at 1,750 and 6,550 grams. The lightest bird, 2,700, and the heaviest, 6,300, are both inside. No penguin is flagged.
The months tell a different story. Their Q1 is 30 and their Q3 is 31, so the IQR is 1 day, and the fences sit at 28.5 and 32.5. February's 28 days fall below 28.5, so February is flagged as a potential outlier. And February is a real fact of the calendar, so it stays in the data. Flagged means "look closer," not "delete." Fix a value that's a mistake, and keep and report a value that's real.
Pause and try this. Suppose a penguin's mass were mistyped as 60,000 grams. Using the fences of 1,750 and 6,550 grams, would the rule flag it, and what should you do?
Pause here for a moment.
Here's the answer. Yes, 60,000 grams sits far above the upper fence of 6,550, so the rule flags it. Because no penguin in the log weighs anywhere near that, it's almost surely a typing error, so you'd fix it rather than report it.
Closing
Let's gather the week in the order we built it. The mean is the fair share, the median is the middle of the line, and the mode is the most common value, and the level of measurement decides which ones you may use. The median resists a wild value, and the mean doesn't. Skew pulls the mean toward the long tail, so comparing the mean with the median backs up the shape you see. The standard deviation measures typical distance from the mean in the data's own units, and you divide by one less for a sample. The five-number summary, its boxplot, and the 1.5 times IQR rule show the center, the spread, and any value worth a closer look.
Next in this module come the slide deck, the Readings & Resources page, the lecture tutorial, the practice set, and the quiz, where you compute these summaries yourself. Then come the discussion, the assignment, and the Data Lab, where you put them to work on the penguins. Next week, in Week 4, Exploring Relationships Between Two Variables, you'll stop looking at one variable at a time and ask whether two of them move together.
Built with The Course Maker · samples.thecoursemaker.com