Comparing box plots
Two groups were measured the same way. How can one picture show which group runs higher, which is more spread out, and whether the difference is real?
Where you are 3 in Box plots
When you reach for it
You have measured the same thing in two groups, such as the reaction times of two classes, and want to say how the groups differ. Two box plots drawn one above the other on one number line show at a glance where each group sits, how spread out it is, and which way it leans.
As a reminder, a box plot draws a data set’s five-number summary: a box from the lower quartile Q_1 to the upper quartile Q_3 with a line at the median, and whiskers out to the minimum and maximum. Each of the four pieces holds about a quarter of the values, and the box’s width is the interquartile range, \text{IQR} = Q_3 - Q_1. Quartiles here are the medians of the lower and upper halves of the ordered data, with the median left out of both halves when the count is odd.
The procedure
Day 1: two box plots on one scale
In the ruler-drop test one person lets go of a ruler and the other catches it; how far it fell gives the reaction time. Two classes of 12 took the test, in milliseconds (ms), so smaller is quicker.
Morning class: 165, 172, 180, 188, 194, 198, 204, 210, 218, 226, 248, 270.
Afternoon class: 172, 196, 208, 216, 222, 226, 230, 234, 238, 244, 250, 256.
With 12 ordered values, the median is the mean of the 6th and 7th, and each quartile the mean of the 3rd and 4th values of its half.
| Morning | Afternoon | |
|---|---|---|
| Minimum | 165 | 172 |
| Q_1 | 184 | 212 |
| Median | 201 | 228 |
| Q_3 | 222 | 241 |
| Maximum | 270 | 256 |
One scale. Both plots hang from the same number line, so a given time sits at the same place in both. Position is the whole comparison; plots on separate scales can look alike when the data are not.
Center: compare the medians. The medians are 201 ms and 228 ms. Said in context, with units: the afternoon class was typically slower, by about 228 - 201 = 27 ms.
Spread: compare the boxes, then the whole plots. The box’s width is the spread of the middle half:
The ranges are 270 - 165 = 105 ms and 256 - 172 = 84 ms. By both measures the morning class is more spread out. The IQR is usually the fairer measure, because it ignores the outer quarter at each end: the morning range is stretched by one student at 270 ms, whom the box does not notice.
Shape: compare the two halves of each plot. The lower half of a group lies between the minimum and the median, the upper half between the median and the maximum. The halves hold about the same number of values, so a longer half does not hold more values; its values are spread more thinly. In the morning class the lower half covers 201 - 165 = 36 ms and the upper half 270 - 201 = 69 ms; the times crowd at the quick end and trail off toward slow ones. A distribution whose long tail points toward larger values is skewed right. The afternoon class is the mirror image, 228 - 172 = 56 ms below the median and 256 - 228 = 28 ms above, so it is skewed left. Halves of about equal length mean a roughly symmetric distribution.
Shares: place a value among the quarter marks. About a quarter of a group lies above its Q_3, about half above its median and about three quarters above its Q_1. To say what share lies above a value, find which piece of the group’s plot it falls in.
What share of the afternoon class was slower than the morning median, 201 ms? That value is below the afternoon Q_1 = 212, so at least about three quarters took longer; the data give 10 of the 12. What share of the morning class was slower than the afternoon median, 228 ms? That value lies in the morning right whisker, beyond Q_3 = 222, so fewer than about a quarter; in fact 2 of the 12. Because box plots compare shares, not counts, groups of different sizes can be compared.
Day 2: drawing two box plots and judging the difference
Drawing two on one scale. Find each group’s five-number summary from its own ordered data, then choose one evenly ticked number line running from at least the smaller minimum to the larger maximum, and draw both labeled plots above it. Example 4 draws a pair.
Is the difference real? Two groups almost never have exactly the same median, even when nothing separates them. Florentin grew two trays of seedlings in exactly the same way and measured ten from each: the medians were 9.3 cm and 9.0 cm, with boxes 1.8 cm and 2.3 cm wide. The 0.3 cm between the medians came only from which seedlings happened to be measured (Sampling variability and simulating it), and it is small next to the boxes.
So, as in comparing two distributions, compare the shift between the centers with the spread within each group. On box plots the centers are the medians and the spread is the IQR, the width of each box, which shows how much members of one group already differ. A gap of 5 ms is large when each box is 2 ms wide and tiny when each is 100 ms wide. A rough guide, not a law:
- A shift small compared with the boxes, each median inside the other group’s box: another pair of samples could shrink or reverse the gap, so no conclusion is justified.
- A shift about as wide as the boxes or wider, each median outside the other group’s box: the bulk of one group sits above the bulk of the other, which luck seldom does, so it is reasonable to say the groups differ in center.
Between the two lies a gray zone, and more values in each group make a gap of a given size more convincing. A real difference says that the groups differ, not why: the seedlings given plant food in Example 4 grew taller because of the food only if chance decided which ones got it, as in Random assignment and confounding.
Worked examples
Day 1: two brands of light bulb
A shop ran 40 bulbs of each of two brands until they failed. The lifetimes, in hours:
| Brand A | Brand B | |
|---|---|---|
| Minimum | 820 | 600 |
| Q_1 | 980 | 900 |
| Median | 1040 | 1120 |
| Q_3 | 1100 | 1300 |
| Maximum | 1180 | 1560 |
Compare (a) the centers, (b) the spreads and (c) the shapes. (d) Which brand would you buy?
Solution(a) A typical Brand B bulb lasted about 1120 - 1040 = 80 hours longer.
(b) The IQRs are 1100 - 980 = 120 hours and 1300 - 900 = 400 hours, and the ranges 1180 - 820 = 360 and 1560 - 600 = 960 hours. Brand A’s lifetimes are bunched; Brand B’s vary a great deal.
(c) Brand A’s halves cover 1040 - 820 = 220 and 1180 - 1040 = 140 hours: slightly skewed left, a tail of early failures. Brand B’s halves, 520 and 440 hours, are close: roughly symmetric.
(d) Brand B wins on center, slightly, but every Brand A bulb lasted at least 820 hours, while about a quarter of Brand B bulbs failed by 900. For a light that is hard to reach, Brand A is the better buy, which the medians alone hide.
Day 1: rainfall in two towns, counting days
The rainfall each day, in millimeters, was recorded in two towns on the same 30 days.
| Coastal | Hill | |
|---|---|---|
| Minimum | 0 | 0 |
| Q_1 | 0 | 3 |
| Median | 2 | 7 |
| Q_3 | 6 | 12 |
| Maximum | 14 | 30 |
(a) The coastal plot has no left whisker. On at least how many days was the coastal town dry? (b) Compare the towns. (c) On at least how many days did the hill town get more rain than the coastal median?
Solution(a) The left whisker runs from the minimum to Q_1, both 0 here. With 30 values the lower half is the smallest 15, and Q_1 is its middle, the 8th value. So the 8th smallest rainfall was 0 mm, and the 7 below it, which cannot be less than 0, are 0 too. The town was dry on at least 8 days; the plot cannot say whether the 9th was also 0.
(b) The hill town’s typical day was 7 - 2 = 5 mm wetter. Its IQR is 12 - 3 = 9 mm against 6 - 0 = 6 mm, and its range 30 mm against 14, so it also varied more. Both are skewed right: the coastal halves cover 2 and 12 mm, the hill halves 7 and 23 mm. Rainfall cannot go below 0 but one storm can go far above the usual, so a right tail is natural here.
(c) The hill town’s Q_1 = 3 is its 8th value, so its 8th to 30th values, 30 - 8 + 1 = 23 days, were all at least 3 mm, more than the coastal median of 2. That is at least 23 days.
Day 1: the same median, different journeys
Jareth can take Route 1 or Route 2. Twenty trips on each took these times, in minutes.
| Route 1 | Route 2 | |
|---|---|---|
| Minimum | 22 | 24 |
| Q_1 | 26 | 27 |
| Median | 29 | 29 |
| Q_3 | 33 | 31 |
| Maximum | 48 | 35 |
Compare the routes. Jareth must arrive within 32 minutes; which route should he take?
SolutionBoth medians are 29 minutes. Route 1’s IQR is 33 - 26 = 7 minutes against 31 - 27 = 4, and its range 48 - 22 = 26 against 35 - 24 = 11: Route 1 is far more spread out. Its upper half covers 48 - 29 = 19 minutes against 7 for its lower half, so it is skewed right, a tail of slow trips. Route 2’s halves, 5 and 6 minutes, make it roughly symmetric.
On Route 2, 32 is above Q_3 = 31, so at most about a quarter of trips took longer than 32 minutes, and none more than 35. On Route 1, 32 lies between the median and Q_3 = 33, so between about a quarter and about half of its trips were too slow, the worst by 48 - 32 = 16 minutes. Jareth should take Route 2: the centers are the same, and spread and shape decide it.
Day 2: drawing two box plots for seedlings
Iona grew bean seedlings, some watered with plant food and some without, and measured their heights in centimeters after three weeks.
No food: 6.2, 7.0, 7.4, 7.8, 8.1, 8.5, 8.8, 9.0, 9.6, 10.4.
With food: 7.6, 8.8, 9.4, 9.9, 10.3, 10.6, 11.0, 11.2, 11.5, 12.1, 12.4.
Draw both box plots on one scale and compare the groups.
SolutionBoth lists are in order. The no-food list has 10 values, so its median is the mean of the 5th and 6th, \displaystyle \frac{8.1 + 8.5}{2} = 8.3. Its lower half 6.2, 7.0, 7.4, 7.8, 8.1 gives Q_1 = 7.4, and its upper half 8.5, 8.8, 9.0, 9.6, 10.4 gives Q_3 = 9.0.
The with-food list has 11 values, so its median is the 6th, 10.6, which is left out of both halves: 7.6, 8.8, 9.4, 9.9, 10.3 gives Q_1 = 9.4, and 11.0, 11.2, 11.5, 12.1, 12.4 gives Q_3 = 11.5.
| With food | No food | |
|---|---|---|
| Minimum | 7.6 | 6.2 |
| Q_1 | 9.4 | 7.4 |
| Median | 10.6 | 8.3 |
| Q_3 | 11.5 | 9.0 |
| Maximum | 12.4 | 10.4 |
The values run from 6.2 to 12.4, so one line from 6 to 13 cm serves both.
The fed seedlings were typically 10.6 - 8.3 = 2.3 cm taller. Their IQR is 11.5 - 9.4 = 2.1 cm against 9.0 - 7.4 = 1.6 cm, and their range 4.8 cm against 4.2, so they are a little more spread out. Their halves cover 3.0 and 1.8 cm, skewed left with a tail toward short seedlings, while the unfed halves are both 2.1 cm, symmetric. Most striking, the fed median lies beyond the tallest unfed seedling, 10.4: at least half of the fed seedlings, in fact 6 of the 11, were taller than every unfed one.
Day 2: is the difference real?
Decide whether the box plots give good reason to think the groups differ in center: (a) the two classes’ reaction times in the procedure; (b) the two brands of bulb in Example 1.
Solution(a) The gap is 228 - 201 = 27 ms and the boxes are 38 and 29 ms wide, so the gap is close to a box’s width. The morning median, 201, is below the afternoon Q_1 of 212, and the afternoon median, 228, is above the morning Q_3 of 222: each median lies outside the other box. It is reasonable to say the afternoon class was slower, though with 12 students a class, repeating the test would be worth doing.
(b) The gap is 1120 - 1040 = 80 hours against boxes 120 and 400 hours wide, a fifth of Brand B’s box. Brand A’s median sits well inside Brand B’s box; Brand B’s median lies just outside Brand A’s only because that box is so narrow. The shift is small compared with the boxes, so no conclusion about typical lifetime is justified. The clear difference is in spread.
Day 2: two different data sets, one box plot
Route 3 crosses a railway at a level crossing and Route 4 does not. Eight trips on each took these times, in minutes.
Route 3: 20, 21, 22, 23, 33, 34, 35, 36.
Route 4: 20, 21, 22, 27, 29, 34, 35, 36.
Find both five-number summaries, and explain what the box plots hide.
SolutionWith 8 values the median is the mean of the 4th and 5th, and each quartile the mean of its half’s 2nd and 3rd values. For Route 3,
For Route 4 the median is \displaystyle \frac{27 + 29}{2} = 28. Its halves differ from Route 3’s, but their 2nd and 3rd values are the same, 21, 22 and 34, 35, so Q_1 and Q_3 match too, as do the minimum, 20, and maximum, 36. The box plots are identical.
The dots tell a different story. Route 3’s trips form two clusters, 20 to 23 minutes when the crossing is open and 33 to 36 when the bus waits, and no trip came near its median of 28. Route 4’s trips spread across the range. A median marks the middle of an ordered list, not necessarily a typical trip. When the shape inside the box matters, use dot plots or histograms.
Boundaries
Same quantity, same units, one scale. Plots in milliseconds and in seconds, or on two number lines, cannot be read against each other.
Shares are approximate. The pieces hold exactly a quarter each only when the count divides evenly and no values tie. Exact counts need the number of values and the quartile rule, and rules differ: some calculators keep the median in both halves when the count is odd. Compare box plots made by the same rule.
Five numbers, nothing else. No single values, gaps, clusters or counts, and different data sets can share a box plot.
One extreme value stretches a whisker, making a group look more spread out than most of it is. Box plots that show outliers draw such a value on its own.
Deciding is a judgment, not a proof. The guide is rough, small groups mislead, and a difference says nothing about cause unless chance decided who went into which group.
Numbers only. Categories, such as favorite color, have no order, so no median and no box plot.
Where this goes next
Comparing two distributions widens this to dot plots and histograms, which keep the gaps and clusters a box plot hides. Comparing populations with the MAD turns “shift against spread” into a number, measuring the gap between two means in mean absolute deviations.
Exercises
Day 1: reading two box plots
The box plots show ruler-drop reaction times, in milliseconds, for Kirsi’s class and Jareth’s class.
- Find each class’s median. Which class was typically quicker, and by how much?
- Find each class’s interquartile range and range. Which class is more spread out, and does the answer depend on the measure?
- Describe the shape of each plot, using the lengths of its two halves.
- About what share of Kirsi’s class took longer than 200 ms?
- About what share of Jareth’s class took longer than 200 ms?
- About what share of Jareth’s class was quicker than the median of Kirsi’s class?
Day 1: reading five-number summaries
- Twenty trips on each of two bus routes took these times in minutes. Route 5: 18, 21, 24, 26, 30. Route 6: 15, 22, 24, 31, 44. Compare their centers and spreads. Which route is more predictable?
- Describe the shape of Route 6’s times, and say what it means for a passenger.
- Route 6 has a lower quartile of 22 minutes over 20 trips. At least how many of its trips took 22 minutes or longer?
- Rainfall in millimeters on the same 30 days in two towns. East: 0, 1, 4, 9, 22. West: 0, 0, 1, 3, 25. True or false, with a reason: (a) West had the single wettest day. (b) West was wetter on a typical day. (c) West was dry on at least 8 days. (d) The middle half of East’s days was more spread out than West’s.
Day 2: drawing and comparing
- Lifetimes in hours of 10 Brand C bulbs: 1150, 1210, 1240, 1260, 1300, 1320, 1350, 1380, 1420, 1500. Of 9 Brand D bulbs: 980, 1100, 1180, 1260, 1330, 1350, 1410, 1480, 1620. Find both five-number summaries.
- Choose one scale for both brands in Exercise 11, and describe both box plots drawn on it.
- Do the brands in Exercise 11 differ in typical lifetime? In spread?
- Hugo-James’s class had these ruler-drop times in milliseconds: 188, 204, 176, 230, 196, 212, 184. Find the five-number summary and the IQR.
- Gwenllian’s class had these times in milliseconds: 214, 236, 198, 252, 228, 240, 222, 206, 246. Find the five-number summary and the IQR.
- Using Exercises 14 and 15, decide whether the classes differ in typical reaction time, and say what share of Hugo-James’s class was quicker than every student in Gwenllian’s.
Day 2: judging and the limits
- Write two different sets of six journey times, in minutes, that both have the five-number summary 10, 12, 15, 20, 24.
- Iona’s box plot of rainfall on 30 days shows a median of 5 mm. Must some day have had exactly 5 mm?
- A swimming coach timed two squads over 50 m, in seconds. Squad P, old warm-up: Q_1 = 38.6, median 40.2, Q_3 = 41.4. Squad Q, new warm-up: Q_1 = 38.2, median 39.8, Q_3 = 41.0. She says the new warm-up made swimmers faster. Do the box plots support her?
Reasoning
- Explain why two box plots have to share one number line to be compared.
- One class has 30 students and another 20. Explain why their box plots can still be compared.
- In a box plot, the right part of the box is three times as long as the left part. Explain why that does not mean more values lie in the right part.
- Explain why a gap between two medians is judged against the widths of the boxes, not on its own.
- Name two things a pair of dot plots shows that a pair of box plots cannot, and say why the box plots lose them.
Answers
- Kirsi’s class 182 ms, Jareth’s class 214 ms. Kirsi’s class was typically quicker, by 214 - 182 = 32 ms.
- Kirsi’s class: IQR 200 - 172 = 28 ms, range 250 - 150 = 100 ms. Jareth’s class: IQR 222 - 196 = 26 ms, range 232 - 160 = 72 ms. Kirsi’s class is more spread out by both measures, but the IQRs are close while the ranges differ by 28 ms, mostly from Kirsi’s long right whisker.
- Kirsi’s class is skewed right: its halves cover 182 - 150 = 32 ms and 250 - 182 = 68 ms. Jareth’s class is skewed left: its halves cover 214 - 160 = 54 ms and 232 - 214 = 18 ms.
- About a quarter. 200 ms is the upper quartile of Kirsi’s class.
- Between about a half and about three quarters. 200 lies between Jareth’s Q_1 = 196 and his median 214, so everyone above the median took longer, and some below it too.
- Fewer than about a quarter. Kirsi’s median, 182, is below Jareth’s Q_1 = 196.
- Both medians are 24 minutes. Route 5 has IQR 26 - 21 = 5 and range 30 - 18 = 12 minutes; Route 6 has IQR 31 - 22 = 9 and range 44 - 15 = 29 minutes. Route 5 is more predictable.
- Skewed right: the halves cover 24 - 15 = 9 and 44 - 24 = 20 minutes. Most trips are close to typical, but now and then a passenger faces a much longer one.
- At least 15. Q_1 is the mean of the 5th and 6th of 20 ordered times, so the 6th is at least 22, and the 6th to 20th, 20 - 6 + 1 = 15 trips, all took 22 minutes or longer.
- (a) True: 25 > 22. (b) False: West’s median, 1 mm, is below East’s, 4 mm. (c) True: Q_1 is the 8th of 30 values and is 0, so the 8 smallest are all 0. (d) True: East’s IQR is 9 - 1 = 8 mm and West’s 3 - 0 = 3 mm.
- Brand C: 1150, 1240, 1310, 1380, 1500. Brand D: 980, 1140, 1330, 1445, 1620. For D, with 9 values, the median is the 5th and each quartile the mean of its half’s 2nd and 3rd values.
- The line must cover 980 to 1620, say 900 to 1700 hours in steps of 100. Brand C: box from 1240 to 1380, median at 1310, whiskers to 1150 and 1500. Brand D: box from 1140 to 1445, median at 1330, whiskers to 980 and 1620.
- Not in typical lifetime: the gap is 1330 - 1310 = 20 hours against boxes 140 and 305 hours wide, and each median lies inside the other box. Clearly in spread: Brand D’s IQR is more than twice Brand C’s, and its range 640 hours against 350.
- In order: 176, 184, 188, 196, 204, 212, 230. Summary 176, 184, 196, 212, 230; IQR 212 - 184 = 28 ms.
- In order: 198, 206, 214, 222, 228, 236, 240, 246, 252. Summary 198, 210, 228, 243, 252; IQR 243 - 210 = 33 ms.
- Probably, yes, though with 7 and 9 students it is tentative. The gap, 228 - 196 = 32 ms, is about a box’s width (28 and 33 ms), and each median lies outside the other box. Gwenllian’s minimum, 198, is above Hugo-James’s median, so at least half his class was quicker than all of hers: in fact 4 of the 7.
- For example 10, 12, 13, 17, 20, 24 and 10, 12, 15, 15, 20, 24. With six values, Q_1 is the 2nd, Q_3 the 5th and the median the mean of the 3rd and 4th, so any 3rd and 4th values between 12 and 20 that add to 30 work.
- No. With 30 values the median is the mean of the 15th and 16th, which could be 4 and 6 mm.
- No. The gap is 40.2 - 39.8 = 0.4 s, a seventh of either box (both 2.8 s wide), and each median lies inside the other box: the kind of gap two squads trained alike can show.
- A box plot shows values as positions. Only on a shared line does one position mean one value, so that further right means larger; on different scales unlike data can look alike.
- Each piece of a box plot holds about a quarter of its own group, whatever the size, so the plots compare shares, not counts.
- Each part of the box holds about a quarter of the values. A longer part holds the same number of values over a wider stretch, so they are further apart, not more numerous.
- The boxes show how much members of one group already differ, and so how far two medians could differ by chance. The same gap is large next to narrow boxes and tiny next to wide ones.
- For example: individual values, gaps and clusters, and how many values there are. A box plot keeps only five numbers, so where values fall inside each piece, and how many there are, is gone.