Chapter 14 Β· Statistics and data analysis

Quartiles and Interquartile Range

Learn to find the first and third quartiles as the medians of the lower and upper halves of ordered data, then subtract them to get the interquartile range.

12 min read

You already know the median: the middle of a data set once its values are in order from least to greatest. The median does a second job too. It cuts the ordered data into a lower half (the values at the low end of the list) and an upper half (the values at the high end).

In this lesson you ask the same question about each half: where is its middle? The two answers are called quartiles. One marks the middle of the lower half, and the other marks the middle of the upper half.

The distance between those two quartiles is the interquartile range. It tells you how spread out the middle part of the data is. When that distance is small, the values in the middle of the ordered list are close together.

Before you can find a quartile, you need a clear rule for which values go in each half.

There is more than one accepted way to find quartiles, so this lesson uses one agreed method every time. It is called the median-of-halves convention.

Put the data in order from least to greatest. Then form the halves using the count, which is the number of values in the data set:

  • Even count: the middle of the list falls between two values, so no value is left out. The lower half is the first half of the list, and the upper half is the second half.
  • Odd count: the middle of the list is a data value, the overall median. It is the dividing point between the halves, so leave it out of both. The lower half is every value before it, and the upper half is every value after it.

Either way, the two halves have the same number of values.

Now you can name the quartiles. Use ordered data and the halves from the median-of-halves convention, with the overall median left out of both halves when the count is odd:

  • The first quartile, written Q1Q_1, is the median of the lower half.
  • The third quartile, written Q3Q_3, is the median of the upper half.
  • The interquartile range, written IQR, is the distance from Q1Q_1 up to Q3Q_3, so IQR=Q3βˆ’Q1\text{IQR} = Q_3 - Q_1.

The overall median is the second quartile, which is why the other two are numbered first and third.

The table works through two small data sets, one with an even count and one with an odd count.

The median-of-halves convention on two ordered data sets
What you findEven count: 10, 13, 15, 18, 21, 22Odd count: 10, 13, 15, 18, 21, 22, 26
Count of values
66
77
Overall median
(15+18)Γ·2=33Γ·2=16.5(15 + 18) \div 2 = 33 \div 2 = 16.5, between the 3rd and 4th values
1818, the 4th value
Left out of the halves
No value
The median, 1818
Lower half
10,13,1510, 13, 15
10,13,1510, 13, 15
Upper half
18,21,2218, 21, 22
21,22,2621, 22, 26
Q1Q_1, the median of the lower half
1313
1313
Q3Q_3, the median of the upper half
2121
2222
IQR=Q3βˆ’Q1\text{IQR} = Q_3 - Q_1
21βˆ’13=821 - 13 = 8
22βˆ’13=922 - 13 = 9

Key concept

The median-of-halves convention for quartiles

In the median-of-halves convention, the first and third quartiles are the medians of the two halves of an ordered data set. The data set needs at least two numbers, so that each half has at least one value.

  1. Order the data from least to greatest. Keep every repeated value.
  2. Split the ordered list into a lower half and an upper half. If the count is odd, leave the overall median out of both halves. If the count is even, leave no value out.
  3. Find the median of each half. Q1Q_1 is the median of the lower half, and Q3Q_3 is the median of the upper half.
  4. Subtract Q1Q_1 from Q3Q_3 to get the interquartile range (IQR).

Q1Q_1, Q3Q_3 and the IQR all have the same unit as the data.

IQR=Q3βˆ’Q1\text{IQR} = Q_3 - Q_1

Worked example

Example 1: An even count

The data, already in order from least to greatest, are 12,15,16,19,21,24,27,3012, 15, 16, 19, 21, 24, 27, 30. Use the median-of-halves convention to find Q1Q_1, Q3Q_3 and the IQR.

  1. Check the order and count the values. The list goes from least to greatest and has 8 values. Because 8 is even, the middle of the list falls between the 4th and 5th values, 19 and 21. The overall median is their mean, and no value is left out of the halves.

    median=(19+21)Γ·2=40Γ·2=20\text{median} = (19 + 21) \div 2 = 40 \div 2 = 20
  2. Split the ordered list at that middle point. The lower half is the first 4 values and the upper half is the last 4 values, so both halves have the same number of values.

    lowerΒ half:Β 12,15,16,19upperΒ half:Β 21,24,27,30\text{lower half: } 12, 15, 16, 19 \qquad \text{upper half: } 21, 24, 27, 30
  3. Find the first quartile, which is the median of the lower half. That half has 4 values, an even count, so its median is the mean of its two middle values, 15 and 16. The result is exact, not rounded, and it does not have to be one of the data values.

    Q1=(15+16)Γ·2=31Γ·2=15.5Q_1 = (15 + 16) \div 2 = 31 \div 2 = 15.5
  4. Find the third quartile, which is the median of the upper half, in the same way. That half also has 4 values, and its two middle values are 24 and 27.

    Q3=(24+27)Γ·2=51Γ·2=25.5Q_3 = (24 + 27) \div 2 = 51 \div 2 = 25.5
  5. Find the interquartile range. It is the distance from the first quartile up to the third quartile, so subtract the first quartile from the third quartile.

    IQR=Q3βˆ’Q1=25.5βˆ’15.5=10\text{IQR} = Q_3 - Q_1 = 25.5 - 15.5 = 10

Answer

For the data 12,15,16,19,21,24,27,3012, 15, 16, 19, 21, 24, 27, 30, the median-of-halves convention gives Q1=15.5Q_1 = 15.5, Q3=25.5Q_3 = 25.5 and an interquartile range of 1010.

Worked example

Example 2: An odd count

The data, already in order from least to greatest, are 10,12,15,16,22,23,26,29,3310, 12, 15, 16, 22, 23, 26, 29, 33. Use the median-of-halves convention to find Q1Q_1, Q3Q_3 and the IQR.

  1. Check the order and count the values. The list goes from least to greatest and has 9 values. Because 9 is odd, the middle of the list is a data value: the 5th one, with 4 values before it and 4 values after it. That value, 22, is the overall median.

    median=22\text{median} = 22
  2. Form the halves. In the median-of-halves convention, the median of an odd count is the dividing point between the halves, so leave the 22 out of both. The lower half is the 4 values before it, and the upper half is the 4 values after it.

    lowerΒ half:Β 10,12,15,16upperΒ half:Β 23,26,29,33\text{lower half: } 10, 12, 15, 16 \qquad \text{upper half: } 23, 26, 29, 33
  3. Find the first quartile, the median of the lower half. That half has 4 values, so its median is the mean of its two middle values, 12 and 15.

    Q1=(12+15)Γ·2=27Γ·2=13.5Q_1 = (12 + 15) \div 2 = 27 \div 2 = 13.5
  4. Find the third quartile, the median of the upper half. That half also has 4 values, so take the mean of its two middle values, 26 and 29.

    Q3=(26+29)Γ·2=55Γ·2=27.5Q_3 = (26 + 29) \div 2 = 55 \div 2 = 27.5
  5. Subtract the first quartile from the third quartile to get the interquartile range, the distance between them.

    IQR=Q3βˆ’Q1=27.5βˆ’13.5=14\text{IQR} = Q_3 - Q_1 = 27.5 - 13.5 = 14

Answer

For the data 10,12,15,16,22,23,26,29,3310, 12, 15, 16, 22, 23, 26, 29, 33, the median-of-halves convention gives Q1=13.5Q_1 = 13.5, Q3=27.5Q_3 = 27.5 and an interquartile range of 1414.

Worked example

Example 3: Unordered data with repeated values

Eleven students timed how long a puzzle took them. Their times, in minutes, were 24,17,21,30,15,21,26,17,28,15,1924, 17, 21, 30, 15, 21, 26, 17, 28, 15, 19. Use the median-of-halves convention to find Q1Q_1, Q3Q_3 and the IQR of these times.

  1. Order the times from least to greatest, because the median and the halves depend on position in the ordered list. Ordering rearranges the values without changing them, so keep both 15s, both 17s and both 21s.

    15,15,17,17,19,21,21,24,26,28,3015, 15, 17, 17, 19, 21, 21, 24, 26, 28, 30
  2. Count the values and find the overall median. There are 11 values, an odd count, so the median is the 6th value, with 5 values before it and 5 values after it.

    median=21Β minutes\text{median} = 21 \text{ minutes}
  3. Form the halves. Because the count is odd, the median-of-halves convention leaves the overall median out of both halves, but only the one value in the 6th position. The other 21 is a separate data value in the 7th position, so it stays in the upper half.

    lowerΒ half:Β 15,15,17,17,19upperΒ half:Β 21,24,26,28,30\text{lower half: } 15, 15, 17, 17, 19 \qquad \text{upper half: } 21, 24, 26, 28, 30
  4. Find the median of each half. Each half has 5 values, an odd count, so its median is its 3rd value, with 2 values before it and 2 values after it. That is 17 in the lower half and 26 in the upper half.

    Q1=17Β minutesQ3=26Β minutesQ_1 = 17 \text{ minutes} \qquad Q_3 = 26 \text{ minutes}
  5. Subtract the first quartile from the third quartile. The times are in minutes, so the interquartile range is in minutes too.

    IQR=Q3βˆ’Q1=26βˆ’17=9Β minutes\text{IQR} = Q_3 - Q_1 = 26 - 17 = 9 \text{ minutes}

Answer

Under the median-of-halves convention, the eleven puzzle times have Q1=17Q_1 = 17 minutes, Q3=26Q_3 = 26 minutes and an interquartile range of 99 minutes.

Takeaway. The first and third quartiles are medians of halves. Under the median-of-halves convention, you put the data in order, split it into a lower half and an upper half (leaving the overall median out of both when the count is odd), and take the median of each half to get Q1Q_1 and Q3Q_3. Then IQR=Q3βˆ’Q1\text{IQR} = Q_3 - Q_1 tells you how spread out the middle part of the data is, in the same unit as the data.

Next, you will create and interpret box plots.