# 3.2 Quartiles and the interquartile range

Finding the quartiles of a batch is very similar to finding the median.

In Subsection 1.2, we represented a batch as a V-shaped formation, with the median at the ‘hinge’ where the two arms of the V meet. The median splits the batch into two equal parts. Similarly, we can put another hinge in each side of the V and get four roughly equal parts, shaped like this: . For a batch of size 15, it looks like Figure 12.

The points at the side hinges, in this case and , are the quartiles. There are two quartiles which, as with the extremes, we call the **lower quartile** and the **upper quartile**. The lower quartile separates off the bottom quarter, or lowest 25%. The upper quartile separates off the top quarter, or highest 25%. They are denoted and respectively. (Sometimes they are referred to as the *first quartile* and the *third quartile*.)

You might be wondering, if these are and , what happened to ? Well, have a think about that for a moment.

separates the bottom quarter of the data (from the top three quarters), and separates the bottom three quarters (from the top quarter). So it would make sense to say that separates the bottom two quarters (from the top two quarters). But two quarters make a half, so would denote the median, and since there is already a separate word for that, it’s not usual to call it the second quartile.

Usually we cannot divide the batch exactly into quarters. Indeed, this is illustrated in Figure 12 where the two central parts of the are larger than the outer ones. As with calculating the median for an even-sized batch, some rule is needed to tell us how many places we need to count along from the smallest value to find the quartiles. However, there are several alternatives that we could adopt and the particular rule described below is somewhat arbitrary. Different authors and different software may use slightly different rules. If your calculator can find quartiles, note that it may use a different rule.

As you might have expected, the rule involves dividing by 4, where is the batch size (as opposed to dividing by 2 to find the median). However, the rule is slightly more complicated for the quartiles and it depends on whether is exactly divisible by 4.

## The quartiles

The lower quartile is at position in the ordered batch.

The upper quartile is at position in the ordered batch.

If is exactly divisible by 4, these positions correspond to a single value in the batch.

If is *not* exactly divisible by 4, then the positions are to be interpreted as follows.

A position which is a whole number followed by means ‘halfway between the two positions either side’ (as was the case for finding the median).

A position which is a whole number followed by means ‘one quarter of the way from the position below to the position above’. So for instance if a position is , the quartile is the number one quarter of the way from to .

A position which is a whole number followed by means ‘three quarters of the way from the position below to the position above’. So for instance if a position is , the quartile is the number three quarters of the way from to .

Before we actually use these rules to find quartiles, let us look at some more examples of -shaped diagrams for different batch sizes . The case where is exactly divisible by 4, so that is a whole number, was shown in Figure 12. The following three figures show the three other possible scenarios, where is not exactly divisible by 4.

For , and . So is halfway between and , and is halfway between and .

For , and . So is three quarters of the way from to , and is one quarter of the way from to .

For , and . So is one quarter of the way from to , and is three quarters of the way from to .

## Example 14 Quartiles for the prices of small televisions

Figure 15 showed you where the quartiles are for a batch of size 20. Let us now use the stemplot of the 20 television prices in Figure 16, which you first met in Figure 5 (Subsection 1.2), to find the lower and upper quartiles, and , of this batch.

To calculate the lower quartile you need to find the number that is one quarter of the way from to . These values are both 130, so is 130. To calculate the upper quartile you need to find the number three quarters of the way from to . These values are both 180, so is 180.

That example was easier than it might have been, because for each quartile the two numbers we had to consider turned out to be equal!

## Example 15 Quartiles for the camera prices

Table 2 (Subsection 1.2) gave ten prices for a particular model of digital camera (in pounds). In order, the prices are as follows.

To find the lower and upper quartiles, and , of this batch, first find and .

The lower quartile is the number three quarters of the way from to . These values are 60 and 65. The difference between them is , and three quarters of that difference is . Therefore is 3.75 larger than 60, so it is 63.75. As with the median, in this course we will generally round the quartiles to the accuracy of the original data, so in this case we round to the nearest whole number, 64. In symbols, .

The upper quartile is the number one quarter of the way from to . These values are 81 and 85. The difference between them is , and one quarter of that difference is . Therefore is 1 larger than 81, so it is 82. (No rounding necessary this time.) In symbols, .

Example 15 is the subject of the following screencast. [Note that references to ‘the unit’ should be interpreted as ‘this course’. The original wording refers to the Open University course from which this material is adapted.]

#### Transcript: Screencast 3 Calculating quartiles

INSTRUCTOR: Here’s another batch of data from the unit. This time, it’s the prices of a particular model of digital camera. And there are the prices along the top in pounds. And what we’re asked to do is to find the lower and upper quartiles of this batch of data.

So usually the first thing you have to do when you’re finding the median or the lower and upper quartiles is to put the prices in order. But if you have a look up at the top there, luckily, somebody’s already done that for us. They’re in order.

So we can bash straight on with the next step, which is actually finding the quartiles. Now, what I’m going to do to begin with is to use the notation that we use in defining what the quartiles are, just so you can relate what I’m doing to what’s in the unit on that. Remember how that works. We take the first number, the smallest number in the batch, which in this case is 53, right over the left there.

And we write that as x, within brackets, 1. The 1 in brackets means it’s the smallest value in the batch. And the next one, which is 60, that’s x, brackets, 2. And then you just carry on like that.

And the last one is x10. That means there’s 10 values in this bunch. We need to know that.

And in fact, that’s the next thing we need to worry about. There are 10 observations, 10 camera prices. So in the notation, we call that n. n’s 10.

Now, remember what you’ve got to do to work out this. We want for the quartiles a number that’s 1/4 of the way along the batch when we’ve arranged it in order and another number that’s 3/4 of the way along the batch. But of course, it’s a bit more complicated than that. You don’t look at 1/4 of n. You look at n plus 1 divided by 4.

And that gives you the position of the lower quartiles. n plus 1 divided by 4 is 11/4, which is 2 and 3/4. And that defines where the position of the lower quartile is in a way that I’ll come to.

And to get the upper quartile – well, this time, you’ve got to take 3/4 of n plus 1. That is 3 times n plus 1, over 4. And that comes to n plus 1 is 11.

So it’s 33 – 3 times 11 – over 4. And if you work that out, that’s 8 and 1/4. And that defines the position of the upper quartile.

OK, so moving on, then, Q1 is the lower quartile. And it’s defined by this number here, this 2 and 3/4 number. And what that tells us is it’s between the second number in order and the third number. And it’s 3/4 of the way between them.

So I’ll just write down what that is. Q1 is 3/4 of the way from x2 to x3. And you can work that out just in arithmetic – but it’s probably easier if we have a look and see what it looks like graphically.

Here is a bit of a number line. x2 is going to be there. And x2 is 60.

And x3’s going to be up here somewhere. And x3, if we look up here, is 65. So that one’s 65.

And what we want is a number that’s 3/4 of the way from 60 to 65. Well, that’s halfway there. That’s going to be 62 and 1/2. And 3/4 of the way is about here somewhere. And that’s going to be 63.75.

OK, but how do we write that down in algebra? The way to do it is like this. We say you start at x2, which is 60. And then you go 3/4 of the way from x2 to x3.

Well, how far is it from x2 to x3? Well, again, if you look on this, it’s 65 to 60. That is 5.

And you can calculate that as 65 minus 60. So it’s 3/4 of 65 minus 60. So that’s 60 plus – we’ve got 3 times 5 over 4. That is 15/4. And if you work that out on your calculator or something, it comes to 63.75.

So we’ve worked out the lower quartile. It’s 63.75. And luckily, that’s the same as I showed you over here.

So now we’ve got to go and find the upper quartile. Remember, we denote that as Q3. And if you look at the thing over here, that says it’s at position 8 and 1/4, which means it’s 1/4 of the way from the eighth one to the ninth one. That is, it is 1/4 of the way from x8 to x9.

And again, it’s helpful to draw what’s going on here. So here is a number line. And here we’ve got x8, which is 81. And here we’ve got x9, which is 85.

And again, we want the number that’s 1/4 of the way along, bit different. So here’s halfway. That’s going to be 83. And here is 1/4 of the way, halfway between 81 and 83. That’s 82.

So it’s going to be 82. Let’s just see how we can write that down as a bit of algebra. So again, you start from x8, which is 81. And then you go 1/4 of the way up to x9.

Now this time, the distance between x8 and x9 is 85 – that’s x9 – minus 81, which is x8. So the arithmetic’s actually a lot easier in this case. That’s 81 plus 1/4 of 4. And that just comes to 81 plus 1, which is 82. Again, it’s the same.

So just one final step to do here. We’ve got to write down the answers in an appropriate way. Now, what we have to do is round them to an appropriate accuracy. That’s all we haven’t done.

And what we’ve got is that Q1 – what accuracy do we use? Well, the usual thing we do is to round quartiles to the accuracy of the original data that we had. And the original data we had up at the top there is in whole pounds. It’s rounded to whole pounds. So we need the quartiles in whole pounds, as well.

And if you look at this one, it’s not in whole pounds. It’s 63.75. So we’ve got to round it to the nearest pound. The bit in pence, essentially, here that we’re going to get rid of in the rounding is bigger than 1/2.

So we’ve got to round up. That is, this one is– let’s write in the pound sign. It’s £64 to the nearest pound.

And what about Q3? Well, you’ve got to think about rounding that, as well. But actually, you needn’t bother. It’s already a whole number of pounds, so no rounding involved. We can just write down it’s 82. And that’s that.

## Activity 10 Finding more quartiles

(a) Find the lower and upper quartiles of the batch of 15 coffee prices in Figure 17. (This batch of coffee prices was first introduced in Table 1 of Subsection 1.1.)

### Discussion

Here, because , an appropriate picture of the data would be Figure 12 (Subsection 3.2). To find the lower and upper quartiles, and , of this batch, first find and . Therefore and .

(b) Find the lower and upper quartiles of the batch of 14 gas prices in Figure 18. (This batch of gas prices was first introduced in Table 3 of Subsection 1.2.)

### Discussion

For this batch, so and .

and

So the lower quartile is 3.756 p per kWh and the upper quartile is 3.802p per kWh.