Prices, location and spread
Prices, location and spread

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Free course

Prices, location and spread

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: wedge wedge. For a batch of size 15, it looks like Figure 12.

Described image
Figure 12 Median and quartiles

The points at the side hinges, in this case x subscript open bracket 4 close bracket end and x subscript open bracket 12 close bracket end, 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 uppercase Q sub 1 and uppercase Q sub 3 respectively. (Sometimes they are referred to as the first quartile and the third quartile.)

You might be wondering, if these are uppercase Q sub 1 and uppercase Q sub 3, what happened to uppercase Q sub 2? Well, have a think about that for a moment.

uppercase Q sub 1 separates the bottom quarter of the data (from the top three quarters), and uppercase Q sub 3 separates the bottom three quarters (from the top quarter). So it would make sense to say that uppercase Q sub 2 separates the bottom two quarters (from the top two quarters). But two quarters make a half, so uppercase Q sub 2 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 wedge wedge 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 open bracket n+1 close bracket by 4, where n 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 n+1 is exactly divisible by 4.

The quartiles

The lower quartile uppercase Q sub 1 is at position fraction open bracket n +1 close bracket over 4 end in the ordered batch.

The upper quartile uppercase Q sub 3 is at position fraction 3 open bracket n +1 close bracket over 4 end in the ordered batch.

If open bracket n+1 close bracket is exactly divisible by 4, these positions correspond to a single value in the batch.

If open bracket n+1 close bracket is not exactly divisible by 4, then the positions are to be interpreted as follows.

  • A position which is a whole number followed by fraction 1 over 2 end 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 fraction 1 over 4 end means ‘one quarter of the way from the position below to the position above’. So for instance if a position is 5 fraction 1 over 4 end, the quartile is the number one quarter of the way from x subscript open bracket 5 close bracket end to x subscript open bracket 6 close bracket end.

  • A position which is a whole number followed by fraction 3 over 4 end means ‘three quarters of the way from the position below to the position above’. So for instance if a position is 4 fraction 3 over 4 end, the quartile is the number three quarters of the way from x subscript open bracket 4 close bracket end to x subscript open bracket 5 close bracket end.

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

For n = 17, fraction 1 over 4 end open bracket n+1 close bracket = 4 fraction 1 over 2 end and fraction 3 over 4 end open bracket n+1 close bracket = 13 fraction 1 over 2 end. So uppercase Q sub 1 is halfway between x subscript open bracket 4 close bracket end and x subscript open bracket 5 close bracket end, and uppercase Q sub 3 is halfway between x subscript open bracket 13 close bracket end and x subscript open bracket 14 close bracket end.

Described image
Figure 13 Quartiles for sample size n=17

For n = 18, fraction 1 over 4 end open bracket n+1 close bracket = 4 fraction 3 over 4 end and fraction 3 over 4 end open bracket n+1 close bracket = 14 fraction 1 over 4 end. So uppercase Q sub 1 is three quarters of the way from x subscript open bracket 4 close bracket end to x subscript open bracket 5 close bracket end, and uppercase Q sub 3 is one quarter of the way from x subscript open bracket 14 close bracket end to x subscript open bracket 15 close bracket end.

Described image
Figure 14 Quartiles for sample size n=18

For n = 20, fraction 1 over 4 end open bracket n+1 close bracket = 5 fraction 1 over 4 end and fraction 3 over 4 end open bracket n+1 close bracket = 15 fraction 3 over 4 end. So uppercase Q sub 1 is one quarter of the way from x subscript open bracket 5 close bracket end to x subscript open bracket 6 close bracket end, and uppercase Q sub 3 is three quarters of the way from x subscript open bracket 15 close bracket end to x subscript open bracket 16 close bracket end.

Described image
Figure 15 Quartiles for sample size n=20

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, uppercase Q sub 1 and uppercase Q sub 3, of this batch.

Described image
Figure 16 Prices of flat-screen televisions with a screen size of 24 inches or less

To calculate the lower quartile uppercase Q sub 1 you need to find the number that is one quarter of the way from x subscript open bracket 5 close bracket end to x subscript open bracket 6 close bracket end. These values are both 130, so uppercase Q sub 1 is 130. To calculate the upper quartile uppercase Q sub 3 you need to find the number three quarters of the way from x subscript open bracket 15 close bracket end to x subscript open bracket 16 close bracket end. These values are both 180, so uppercase Q sub 3 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.

53 60 65 70 70 74 79 81 85 90

To find the lower and upper quartiles, uppercase Q sub 1 and uppercase Q sub 3, of this batch, first find fraction 1 over 4 end open bracket n+1 close bracket = 2 fraction 3 over 4 end and fraction 3 over 4 end open bracket n+1 close bracket = 8 fraction 1 over 4 end.

The lower quartile uppercase Q sub 1 is the number three quarters of the way from x subscript open bracket 2 close bracket end to x subscript open bracket 3 close bracket end. These values are 60 and 65. The difference between them is 65 minus 60=5, and three quarters of that difference is fraction 3 over 4 end times 5 = 3.75. Therefore uppercase Q sub 1 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, uppercase Q sub 1 = 60 + fraction 3 over 4 end open bracket 65 minus 60 close bracket = 63.75 simeq 64.

The upper quartile uppercase Q sub 3 is the number one quarter of the way from x subscript open bracket 8 close bracket end to x subscript open bracket 9 close bracket end. These values are 81 and 85. The difference between them is 85 minus 81=4, and one quarter of that difference is fraction 1 over 4 end times 4 = 1. Therefore uppercase Q sub 3 is 1 larger than 81, so it is 82. (No rounding necessary this time.) In symbols, uppercase Q sub 3 = 81 + fraction 1 over 4 end open bracket 85 minus 81 close bracket = 82.

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.]

Download this video clip.Video player: Calculating quartiles
Skip transcript: Screencast 3 Calculating quartiles

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.

End transcript: Screencast 3 Calculating quartiles
Screencast 3 Calculating quartiles
Interactive feature not available in single page view (see it in standard view).

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.)

Described image
Figure 17 Stemplot of 15 coffee prices

Discussion

Here, because n=15, an appropriate picture of the data would be Figure 12 (Subsection 3.2). To find the lower and upper quartiles, uppercase Q sub 1 and uppercase Q sub 3, of this batch, first find fraction 1 over 4 end open bracket n+1 close bracket = 4 and fraction 3 over 4 end open bracket n+1 close bracket = 12. Therefore uppercase Q sub 1 =268 p and uppercase Q sub 3 =299 p.

(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.)

Described image
Figure 18 Stemplot of 14 gas prices

Discussion

For this batch, n=14 so fraction 1 over 4 end open bracket n+1 close bracket = 3 fraction 3 over 4 end and fraction 3 over 4 end open bracket n+1 close bracket = 11 fraction 1 over 4 end.

uppercase Q sub 1 = 3.743 + fraction 3 over 4 end open bracket 3.760 minus 3.743 close bracket = 3.75575 simeq 3.756

and

uppercase Q sub 3 = 3.801 + fraction 1 over 4 end open bracket 3.804 minus 3.801 close bracket = 3.80175 simeq 3.802.

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

M140_1

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to University-level study, we offer two introductory routes to our qualifications. You could either choose to start with an Access module, or a module which allows you to count your previous learning towards an Open University qualification. Read our guide on Where to take your learning next for more information.

Not ready for formal University study? Then browse over 1000 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus371