- Reading cumulative frequency — median and quartiles
- Range and interquartile range · coming soon
- Mean, median, mode · coming soon
- Comparing distributions using box plots
- Estimating median and quartiles from a histogram · coming soon
- The normal distribution · coming soon
Five numbers instead of eighty
Over the last two lectures, the heights of 80 students became a table, then a curve, then a handful of numbers.
- Every height is at least 150 cm and less than 180 cm.
- Q₁ ≈ 160.8 cm, the median ≈ 164.8 cm and Q₃ ≈ 169.4 cm.
That is five numbers. The original data had 80. It seems obvious that we have lost almost everything. A picture of the data should need all 80 values, one bar or one dot for each.
That idea is wrong, and this lecture shows why. Five well-chosen numbers can be drawn as one simple picture: the box plot. From it you can read the centre of the data, its spread, its shape, and any values that do not fit. The last lecture promised this picture. Here it is.
The drawing is easy. The difficulty is in reading it. Almost everyone first reads the long part of a box plot as "more data". That is not what the picture means. Spend your time there.
Drawing a box plot, one piece at a time
A box plot is built from the five-number summary: the smallest value, the lower quartile Q₁, the median, the upper quartile Q₃ and the largest value. Draw it in four steps.
- Step 1. A scaled number line. Draw it first, with equal steps and a label with units. Every part of the box plot is read from this line, so a careless scale ruins the picture.
- Step 2. The box. Draw a rectangle from Q₁ to Q₃. Its height does not matter. Its width is the interquartile range, the width of the middle half of the data.
- Step 3. The median. Draw a vertical line across the box at the median.
- Step 4. The whiskers. Draw a line from Q₁ out to the smallest value, and from Q₃ out to the largest. A short end mark on each whisker helps the eye.
The figure below draws the heights this way, directly under the curve they came from. Each quartile drops straight down onto the box.
One detail needs care. The grouped table never told us the shortest or tallest height. It only said that every height is at least 150 cm and less than 180 cm. So the whiskers end at 150 and 180, the limits of the classes. They are limits, not measured heights. When a question gives the true smallest and largest values, use those instead.
Five-number summary: smallest value, Q₁, median, Q₃, largest value.
Box from Q₁ to Q₃, with a line at the median. Whiskers from the box out to the smallest and largest values that are not outliers.
Each of the four parts, two whiskers and two halves of the box, holds about a quarter of the data.
Long does not mean more
Look again at the heights. The left whisker, from 150 to about 160.8, is long. The left half of the box, from about 160.8 to 164.8, is short. Which part holds more students?
Neither. Each part holds 20 students, a quarter of 80. That is how the quartiles were chosen. You saw the same fact in the last lecture: equal counts take up unequal widths. A box plot simply draws those widths. A long part means its quarter of the data is spread out. A short part means its quarter is crowded together.
Test yourself on a new data set before reading on.
This box plot shows how long 19 customers spent in a small shop (invented data). Which part of the box plot holds the most customers? Choose before you look at the data.
The 19 times as a dot plot, drawn above their box plot. The dashed lines mark Q₁ = 5, the median = 8 and Q₃ = 15 minutes.
That is it. That is the whole idea. A box plot cuts the data into four groups of equal size and shows how much room each group takes up. Long means spread out. Short means crowded. Every other reading of a box plot grows from this one.
A box plot of 19 shopping times and a box plot of 19 000 shopping times can look exactly the same. Is that a weakness of the box plot?
Show the answer
It is a limit, and it is worth knowing. A box plot shows proportions, "a quarter of the data lies here", not counts. You cannot read the number of values from it. If the size of the group matters, it must be written beside the plot, as in "n = 19".
The same limit is also a strength. Groups of very different sizes can be compared fairly, because each box plot speaks in quarters. The next lecture uses exactly this.
Quartiles from a list
Often you will have a short list instead of a curve. Put the values in order. For n values, the median is the th value.
For the quartiles, this course uses the same idea. Q₁ is the th value and Q₃ is the th value. For the 19 shopping times, , so Q₁ is the 5th value, 5 minutes. Q₃ is the 15th value, 15 minutes.
There is a second way to see this. The median, the 10th value, splits the list into a lower 9 and an upper 9. Q₁ is the middle of the lower 9, which is the 5th value. Both ways agree. When is not a whole number, textbooks use slightly different rules, so follow the one your course uses. The differences are small, and the meaning of a quartile never changes.
Values that do not fit: outliers
Sometimes one value sits far away from all the others. A whisker drawn all the way out to it would hide the real spread of the rest. So we first test whether the value is an outlier, a value unusually far from the middle half of the data.
The test uses the interquartile range, IQR = Q₃ − Q₁. We build two boundaries, called fences, one and a half box-widths outside the box.
Lower fence = Q₁ − 1.5 × IQR
Upper fence = Q₃ + 1.5 × IQR
A value below the lower fence or above the upper fence is an outlier. A value exactly on a fence is not.
When there are outliers, the drawing changes in two ways. Each whisker stops at the last value inside the fences. Each outlier is marked on its own with a small cross. Some courses draw the whiskers to the smallest and largest values and test for outliers only when a question asks. Read the question to see which is wanted.
Why 1.5, and not 1 or 2? It is a practical choice, made by the statistician John Tukey. For data with the common bell shape, which you will meet as the normal distribution, only about 7 values in 1000 fall outside the fences. So a value outside is rare enough to deserve a second look, but the rule does not shout at every slightly large value.
The fences use the IQR, never the range. The range contains the extreme values themselves, so a test built on it would be pulled by the very values it is judging.
Now watch what one extreme value does to a box plot, and what it does not do.
These are the minutes of exercise 19 students did on one day (invented). Eighteen values are fixed. Move the largest one, shown in colour, from 55 up to 150 minutes. Watch the box, the median and the mean.
Presets:
The 19 exercise times are 10, 15, 15, 20, 20, 25, 25, 30, 30, 30, 35, 35, 40, 40, 45, 45, 50, 55 and one largest value. Q₁ = 20, the median = 30 and Q₃ = 45 minutes, whatever the largest value is. The upper fence is 45 + 1.5 × 25 = 82.5 minutes.
| Largest value (min) | Outlier? | Right whisker ends at (min) | Median (min) | Mean (min) |
|---|---|---|---|---|
| 55 | No | 55 | 30 | ≈ 32.6 |
| 80 | No | 80 | 30 | ≈ 33.9 |
| 85 | Yes | 55 | 30 | ≈ 34.2 |
| 150 | Yes | 55 | 30 | ≈ 37.6 |
Two things should stand out. First, the box never moved. Q₁, the median and Q₃ depend only on the order of the values, and the largest value stays largest wherever it goes. Second, the mean crept upwards the whole time. One strange value cannot drag a box plot around. When the value crossed 82.5, the whisker jumped back to 55 and a cross appeared. The picture now shows the 18 typical students, plus one who needs a closer look.
Reading the shape
A box plot also shows the shape of the data. Look at two things: where the median sits inside the box, and which whisker is longer.
- Symmetric. The median is near the middle of the box, and the whiskers have about the same length.
- Positive skew (also called skewed to the right). The right side is stretched. The median is nearer to Q₁, and the right whisker is longer. Many values are bunched at the low end, with a long tail of large values.
- Negative skew (skewed to the left). The left side is stretched. The median is nearer to Q₃, and the left whisker is longer.
The name of the skew follows the tail, not the bunch. "Positive" means the long tail points towards the large, positive end of the scale. The two signs, median position and whisker length, usually agree. When they do not, say what each one shows.
Worked examples
The race times of 40 runners, in seconds, have smallest value 58, Q₁ = 64, median = 69, Q₃ = 75 and largest value 91. Check for outliers, draw the box plot and describe it.
IQR. 75 − 64 = 11 seconds.
Fences. 1.5 × 11 = 16.5. Lower fence = 64 − 16.5 = 47.5. Upper fence = 75 + 16.5 = 91.5.
Test. 58 is above 47.5, so it is not an outlier. 91 is below 91.5, so it is not an outlier either, but only just.
Describe. A typical runner took about 69 seconds. The middle half finished within 11 seconds of each other, between 64 and 75. Inside the box the median is almost central: 5 seconds above Q₁ and 6 below Q₃. But the right whisker (16 seconds) is much longer than the left (6 seconds). So the data show positive skew: a tail of slower runners.
Check. Every part should hold about 10 runners, a quarter of 40. The slowest 10 are spread over 16 seconds. The fastest 10 are packed into 6. ✓
A data set has smallest value 20, Q₁ = 45, median = 52, Q₃ = 58 and largest value 84. Apart from those two, the smallest value is 28 and the largest is 73.
IQR. 58 − 45 = 13. 1.5 × 13 = 19.5.
Fences. Lower fence = 45 − 19.5 = 25.5. Upper fence = 58 + 19.5 = 77.5.
Test. 20 is below 25.5, so it is an outlier. 84 is above 77.5, so it is an outlier too. The values 28 and 73 are inside the fences.
Draw. The box runs from 45 to 58, with the median at 52. The left whisker stops at 28 and the right whisker at 73. Crosses mark 20 and 84.
Describe. The median is close to the middle of the box (7 above Q₁, 6 below Q₃), and the whiskers are similar (17 and 15). So most of the data are roughly symmetric, with one unusual value at each end.
Fifteen students recorded their travel time to school, in minutes: 4, 7, 8, 10, 12, 12, 14, 15, 17, 18, 20, 22, 25, 28, 55.
Positions. The list is already in order, and n = 15. The median is the th value, 15. Q₁ is the th value, 10. Q₃ is the 12th value, 22.
Fences. IQR = 22 − 10 = 12, and 1.5 × 12 = 18. Lower fence = 10 − 18 = −8. Upper fence = 22 + 18 = 40.
Test. Nothing is below −8. But 55 is above 40, so 55 is an outlier. The right whisker stops at 28.
Mean against median. The mean is 267 ÷ 15 = 17.8 minutes, higher than the median of 15. The single value 55 pulls the mean up. The median does not move.
Check. Three values lie below Q₁ (4, 7, 8) and three above Q₃ (25, 28, 55). ✓
A box plot of 120 exam marks shows smallest 12, Q₁ = 38, median = 52, Q₃ = 61, largest 94.
(a) About how many students scored 61 or more? Q₃ has three quarters of the students below it. So about a quarter, 30 students, scored 61 or more.
(b) "More than half the students scored over 50." True or false? True. Half the students scored at or above the median, 52, and 52 is over 50.
(c) Which is more crowded, the marks from 38 to 52 or from 52 to 61? Each part holds about 30 students. The first spreads them over 14 marks and the second over 9. So the marks from 52 to 61 are more crowded.
(d) Is 94 an outlier? IQR = 23, and 1.5 × 23 = 34.5. Upper fence = 61 + 34.5 = 95.5. 94 is below it, so it is not an outlier.
(e) What is the mean? It cannot be found. A box plot does not keep the individual values, so their total is lost.
A longer whisker or a wider half of the box does not hold more data. Every part holds about a quarter. Length tells you how spread out that quarter is.
A whisker always ends at a real data value: the last one inside the fences. The fence itself is a test line, not part of the picture. And remember that the fences are measured from Q₁ and Q₃, not from the median.
An outlier is a value that deserves a closer look. It may be a recording error. It may also be the most interesting value in the data: the student who really does exercise for two hours a day. Mark it, investigate it, and remove it only if you find that it is wrong.
Work each one on paper first. Open a hint only when you are stuck.
-
The masses of 11 eggs, in grams, are 52, 55, 56, 58, 58, 60, 61, 61, 63, 64, 75. Find the five-number summary, test for outliers, and describe how the box plot would look.
Hint 1
With n = 11, Q₁ is the th value and the median is the th.
Hint 2
Q₁ = 56 and Q₃ = 63. Now find 1.5 × IQR.
Full answer
Q₁ is the 3rd value, 56 g. The median is the 6th, 60 g. Q₃ is the 9th, 63 g.
IQR = 63 − 56 = 7, and 1.5 × 7 = 10.5. Lower fence = 45.5, upper fence = 73.5.
52 is inside the fences. 75 is above 73.5, so 75 is an outlier. The right whisker stops at 64, the last value inside, and 75 is marked with a cross.
Five-number summary: 52, 56, 60, 63, 75 (with 75 an outlier). The box runs from 56 to 63 with the median at 60. The whiskers reach 52 and 64.
Check: two values lie below Q₁ (52, 55) and two above Q₃ (64, 75). ✓
-
In the last lecture's Try it yourself, 200 runners had Q₁ = 52, median = 58 and Q₃ = 75 minutes. Suppose the fastest time was 41 minutes, the slowest 118 minutes, and the second slowest 104 minutes. (a) Is anyone an outlier? (b) Describe the shape. (c) About how many runners finished in under 58 minutes?
Hint 1
IQR = 75 − 52. Build both fences.
Hint 2
The upper fence is 75 + 34.5. Compare 104 and 118 with it.
Full answer
(a) IQR = 23, and 1.5 × 23 = 34.5. Lower fence = 52 − 34.5 = 17.5, upper fence = 75 + 34.5 = 109.5. 118 is an outlier. 104 is inside, so the right whisker stops at 104. 41 is not an outlier.
(b) The median is 6 above Q₁ and 17 below Q₃, so it sits near Q₁. The right whisker (104 − 75 = 29) is much longer than the left (52 − 41 = 11). Both signs say positive skew: a long tail of slower runners.
(c) Half of 200: about 100 runners.
Check: the last lecture found the second quarter (52 to 58) much more crowded than the third (58 to 75). The box plot shows the same fact. ✓
-
A data set has smallest value 3, Q₁ = 12, median = 15, Q₃ = 18 and largest value 40. The three largest values are 26, 31 and 40. Kemal says, "3 is an outlier, because it is so far below the box." Priya says, "The right whisker should end at the upper fence." Who is right?
Hint 1
Work out both fences before judging either claim.
Hint 2
The lower fence is 12 − 9. A value exactly on a fence is not an outlier.
Full answer
IQR = 6, and 1.5 × 6 = 9. Lower fence = 3, upper fence = 27.
Kemal is wrong. 3 is exactly on the lower fence, not below it, so it is not an outlier. "Far" is decided by the rule, not by the eye.
Priya is wrong too. 31 and 40 are above 27, so both are outliers. But the whisker ends at a data value, the last one inside: 26. It never ends at the fence, 27.
Check: the left whisker runs 3 to 12 and the right whisker 18 to 26. ✓
-
The heights of adults in a large population follow the bell shape, with Q₁ ≈ 165.3 cm and Q₃ ≈ 174.7 cm. In such a population, about 0.35% of people are below the lower fence and about 0.35% are above the upper fence. (a) Find the fences. (b) A health survey measures 10 000 of these adults. About how many outliers should it expect? (c) The survey team wants to delete every outlier as "a measuring error". What would you tell them?
Hint 1
IQR ≈ 174.7 − 165.3. Then 1.5 × IQR.
Hint 2
0.35% + 0.35% = 0.7% of 10 000.
Full answer
(a) IQR ≈ 9.4 cm, and 1.5 × 9.4 = 14.1. Lower fence ≈ 165.3 − 14.1 = 151.2 cm. Upper fence ≈ 174.7 + 14.1 = 188.8 cm.
(b) 0.7% of 10 000 is 70. So about 70 outliers are expected, even if every measurement is perfect.
(c) Outliers are not automatically errors. In a large group, a few genuinely tall and short people are certain to appear. Deleting all 70 would make the population look less varied than it really is. Check each outlier against the record, and remove only the ones that are shown to be wrong.
Check: in a class of 20, the same rate gives 0.7% × 20 = 0.14 outliers, so most classes have none. Large data sets have more outliers simply because they have more people. ✓
The box plot was made famous by the American statistician John Tukey. He introduced it in 1970 and published it in his book Exploratory Data Analysis in 1977. Tukey chose the name, and the rule for which points to show beyond the whiskers. The basic shape is older. Mary Eleanor Spear drew "range bars" with the middle half of the data marked in her 1952 book Charting Statistics.
Tukey's big idea was in the title: explore the data before you calculate with it. A box plot shows the centre, the spread, the shape and the strange values at once. Scientists now place box plots side by side to compare groups of patients, crops or machines. The next lecture does exactly that. Because every box plot speaks in quarters, two groups of very different sizes can stand next to each other and be compared fairly.
- A box plot draws the five-number summary: the smallest value, Q₁, the median, Q₃ and the largest value, on a scaled number line.
- Each of the four parts of a box plot holds about a quarter of the data, so a long part means spread-out values, not more values.
- A value is an outlier if it lies below Q₁ − 1.5 × IQR or above Q₃ + 1.5 × IQR. The whiskers then stop at the last values inside these fences.
- The median and quartiles are not pulled by one extreme value, while the mean is.
- A median near Q₁ with a long right whisker shows positive skew, and a median near Q₃ with a long left whisker shows negative skew.
- A box plot shows proportions, not counts, so the number of values must be stated beside it.