Sub topic 6
The Five-Number Summary
Prerequisites
This chapter assumes that you can order numbers from least to greatest and find the median of a list. You should also be comfortable with arithmetic involving fractions, decimals, and percents.
A five-number summary describes the location and spread of an ordered data set using five values:
- Minimum
- First quartile, or Q1
- Median, or Q2
- Third quartile, or Q3
- Maximum
The minimum and maximum show the full extent of the data. The median shows the center. Q1 and Q3 show the centers of the lower and upper halves.
Finding the Five Values
Consider the ordered data set:
3, 5, 7, 8, 12, 13, 14, 18, 21
The median is the middle value, 12. Since there are nine values, four values are below the median and four are above it.
- Lower half:
3, 5, 7, 8 - Upper half:
13, 14, 18, 21
Q1 is the median of the lower half:
Q1 = (5 + 7) / 2 = 6
Q3 is the median of the upper half:
Q3 = (14 + 18) / 2 = 16
Therefore, the five-number summary is:
| Value | Result |
|---|---|
| Minimum | 3 |
| Q1 | 6 |
| Median | 12 |
| Q3 | 16 |
| Maximum | 21 |
When the original data set has an odd number of values, leave the overall median out when finding Q1 and Q3. When it has an even number of values, split the data into two equal halves and find each half's median.
def median(values):
n = len(values)
middle = n // 2
if n % 2:
return values[middle]
return (values[middle - 1] + values[middle]) / 2
def five_number_summary(data):
values = sorted(data)
n = len(values)
middle = n // 2
if n % 2:
lower = values[:middle]
upper = values[middle + 1:]
else:
lower = values[:middle]
upper = values[middle:]
return values[0], median(lower), median(values), median(upper), values[-1]
print(five_number_summary([13, 3, 21, 8, 5, 18, 12, 7, 14]))
# (3, 6.0, 12, 16.0, 21)What the Summary Measures
The five-number summary separates a data set into four sections, but the sections do not necessarily have equal numerical widths.
The range measures the total spread:
range = maximum - minimum = 21 - 3 = 18
The interquartile range, or IQR, measures the spread of the middle half:
IQR = Q3 - Q1 = 16 - 6 = 10
The IQR usually gives a better picture of typical spread when an extreme value affects the minimum or maximum. For example, changing the maximum from 21 to 100 greatly increases the range, but it does not change Q1, the median, or Q3 if the middle values remain the same.
Connection to a Boxplot
A boxplot displays the five-number summary on a number line. The box extends from Q1 to Q3, and a line inside the box marks the median. The whiskers extend toward the minimum and maximum, unless a problem uses a separate outlier rule.
To read a boxplot, identify the values on the labeled axis directly below the five features. Then compare medians, box lengths, and whisker lengths. A longer distance means greater numerical spread in that part of the data.
GRE Strategies and Common Errors
- Do not confuse Q1 with 25 percent of the numerical value. Q1 is a data value marking the lower quartile.
- Always order the data before finding any median or quartile.
- Do not assume that the median is the average of all values. It is the middle position.
- Do not assume that each quarter contains the same numerical range. Each section represents a portion of the ordered data, not an equal distance on the number line.
- If a boxplot has an unusual scale, read the tick marks carefully before comparing values.
Exercise
A data set has five-number summary 4, 9, 15, 22, 30. What are its range and IQR, and which measures the spread of the middle half?
Show answer
The range is 30 - 4 = 26. The IQR is 22 - 9 = 13. The IQR measures the spread of the middle half.