If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Interquartile range (IQR)

AP.STATS:
UNC‑1 (EU)
,
UNC‑1.J (LO)
,
UNC‑1.J.1 (EK)
,
UNC‑1.J.2 (EK)
CCSS.Math: ,
The IQR describes the middle 50% of values when ordered from lowest to highest. To find the interquartile range (IQR), ​first find the median (middle value) of the lower and upper half of the data. These values are quartile 1 (Q1) and quartile 3 (Q3). The IQR is the difference between Q3 and Q1.  

Want to join the conversation?

  • starky sapling style avatar for user Niketh Annareddy
    Where is IQR used in math? Is this for only box and whisker plots?
    (43 votes)
    Default Khan Academy avatar avatar for user
  • winston baby style avatar for user Gage DuMoulinga
    I have a doubt and I didn't know where else to ask because there isn't any video on Quartile Deviation.

    What exactly is Quartile Deviation? From where are we calculating the deviation? For eg. In Mean Absolute Deviation we subtract Mean from each data point, add them all up and divide by the number of data points i.e we're basically calculating the average deviation of data points from the MEAN! but in Quartile Deviation we do not use that formula instead the formula is (Q3-Q1)/2. My question is why is this *(Q3-Q1)/2* the formula?

    Can someone help, please?
    Thanks in advance!:)
    (16 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user wal0022
      The Quartile Deviation (QD) is the product of half of the difference between the upper and. lower quartiles. Mathematically we can define as: Quartile Deviation = (Q3 – Q1) / 2. Quartile Deviation defines the absolute measure of dispersion
      (3 votes)
  • aqualine ultimate style avatar for user benjaminchapman
    Greetings and salutations to those reading my comment I benjamin chapman require assistance to understand in what situation would one might use Interquartile range I fully grasp the concept of how to calculate with Interquartile range
    but can't seem to think how where it would be appropriate to use it,if you are capable of helping me and do so I would very much appreciate you contributing the my knowledge in the subject matter,if you are unable to do so because you are in a similar position as I then I wish you the best of days in searching for the answer to your question,but for now fare well.
    benjamin chapman
    (3 votes)
    Default Khan Academy avatar avatar for user
    • primosaur tree style avatar for user Bradley Reynolds
      As Sal said, the interquartile range gives you an idea of how far apart the data is spread out. For example if we had the data sets: (1, 1, 1, 5, 9, 9, 9) and (2, 3, 4, 5, 6, 7, 8) the median is 5 and the mean is 5 for both of them but if you find the IQR of them you see it is 8 and 4, respectively.
      A more practical example of this could be the grades of a math class. The class could have an average of 75%, but that does not tell you what the spread of grades is. An IQR of 10 would mean the data isn't spread out as much as if it were 20.
      Hope that answered your question, sorry for the long response.
      (8 votes)
  • piceratops ultimate style avatar for user James Blagg✝
    How would negative numbers or irrational numbers affect your Interquartile range (IQR)?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user spectare4o
    So, in this video Sal writes out the number each dot represents. However, Sal does not simply by multiplying if he has multiple number. For example at in the video, Sal had 2 9s and did not write 18, 9x2. Could you do this. Just curious. :)
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leafers sapling style avatar for user green_ninja
      You should not add repeated numbers together; this would change the value of the median, quartiles, and the IQR. Using the example from the video,

      The median of 7, 9, 9, 10, 10, 10, 11, 12, 12, 14 is 10. Q1 = 9, and Q3 = 12, making the IQR = 3.

      Now, adding all the multiple numbers together would get us 7, 9 + 9, 10 + 10 + 10, 11, 12 + 12, 14; or 7, 18, 30, 11, 24, 14.

      Before we can find the median, we need to arrange the numbers from smallest to largest: 7, 11, 14, 18, 24, 30

      The median of this set is 16. Q1 = 11 and Q3 = 24, making the IQR = 13.

      Hope this clears things up!😄
      (6 votes)
  • blobby green style avatar for user smaranraialt
    why do we need Interquartile range? I mean where do we use them?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user BeatboxBoy
    also what are median mean? dose some one have a song or a riddle etc. to help remeber it maby?
    (0 votes)
    Default Khan Academy avatar avatar for user
  • leafers seed style avatar for user Serge
    I have a feeling, that many people who use the IQR or guantiles in general don't really know how to get them or what they are. I learned that a p-quantile for any number 0<p<1 is
    for n*p is a whole number: x_p =1/2*[ x_(n*p) - x_(n*p+1) ]
    and for n*p is not a whole number: x_p=x_[n*p+1] with [n*p+1]=the next whole number to n*p!

    So with that definition would be for the first example: 4,4,6,7,10,11,12,14,15 where n=9 and Q_1=x_0.25= x_[0.25*9+1]=x_3=6 since n*p=9*0.25=2.25 not a whole number and for p=0.75: p*n=0.75*9=6.75 also not a whole number:
    Q_3=x_0.75=x_[0.75*9+1]=x_7=12
    With that I would get a IQR=Q_3 - Q_1= 12-6=6
    which is not 8 as in the video.

    Now I know that the IQR is defined differently from field to field, but as far as I know the quantile function x_p is defined the same for all fields of science or at least in statistical mathematics, so how come you are using it so inconsistently?
    And as far as I experienced it "my" method and the method in the video will get the same results more often than not but here it's inconsistent.

    Also just as a sidenote: The algorithm at wolframalpha.com gets another IQR of 7 for that data set. which I am absolutely baffled about! http://www.wolframalpha.com/input/?i=iqr+%7B4,+4,+6,+7,+10,+11,+12,+14,+15%7D

    So please please plaese make a new video in which you at least aknowledge that there are different definitions of the IQR and in your case even the Quantiles(Or here Quartiles which are the 0.25- , 0.50- and 0.75-Quantiles particularly)

    PS: I know you are not the only ones that are making this mistake. But it doesn't mean you should repeat it.
    PPS: I really don't get why the IQR is tought in the 6th grade since even bachelor-graduates don't use it that much in most cases. ANd since there seem to be many misunderstandings with the mathematical theory behind it I think the time and sweat to learn it is better spend elsewhere. There seem to be enough problems in understanding statistical methods as it is. But keep up the good work! Everyone makes mistakes and only from them we learn and better ourselves! ;D

    My sources:
    https://en.wikipedia.org/wiki/Quantile (my definition)
    https://en.wikipedia.org/wiki/Interquartile_range (your definiton)
    https://de.wikipedia.org/wiki/Interquartilsabstand_(Deskriptive_Statistik) (my definition used)

    Edit1:
    So did I missunderstand that Q_1 =/=Q_0.25 and Q_3=/=Q_0.75 ?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • aqualine tree style avatar for user Acp!!
    why did he add a star on the top- Is it just for fun or something.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby blue style avatar for user Victoria Lerma
    What do we do if it has a decimal.
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- [Instructor] Let's get some practice calculating interquartile ranges and I've taken some exercises from the Khan Academy exercises here. I'm just gonna solve it on my scratch pad. The following data points represent the number of animal crackers in each kid's lunch box. Sort the data from least to greatest and then find the interquartile range of the data set and I encourage you to do this before I take a shot at it. Alright, so let's first sort it and if we were actually doing this on the Khan Academy exercise, you could just drag these, you could just click and drag these numbers around to sort 'em but I'll just do it by hand. So let's see, the lowest number here looks like it's a four. So I have that four then I have another four and then I have another four and let's see, are there any fives? No fives but there is a six. So then there is a six and then there's a seven. There doesn't seem to be an eight or a nine but then we get to a 10 and then we get to 11, 12. No 13 but then we got 14 and then finally we have a 15. So the first thing we wanna do is figure out the median here. So the median's the middle number. I have one, two, three, four, five, six, seven, eight, nine numbers so there's going to be just one middle number. I have an odd number of numbers here and it's going to be the number that has four to the left and four to the right and that middle number, the median is going to be 10. Notice I have four to the left and four to the right and the interquartile range is all about figuring out the difference between the middle of the first half and the middle of the second half. It's a measure of spread, how far apart all of these data points are and so let's figure out the middle of the first half. So we're gonna ignore the median here and just look at these first four numbers and so out of these first four numbers, since I have an even number of numbers, I'm gonna calculate the median using the middle two numbers so I'm gonna look at the middle two numbers here and I'm gonna take their average. So the average of four and six, halfway between four and six is five or you could say four plus six is, four plus six is equal to 10 but then I wanna divide that by two so this is going to be equal to five. So the middle of the first half is five. You can imagine it right over there and then the middle of the second half I'm gonna have to do the same thing. I have four numbers. I'm gonna look at the middle two numbers. The middle two numbers are 12 and 14. The average of 12 and 14 is going to be 13, is going to be 13. If you took 12 plus 14 over two, that's going to be 26 over two which is equal to 13 but an easier way for numbers like this, you say hey, 13 is right exactly halfway between 12 and 14. So there you have it. I have the middle of the first half is five. I have the middle of the second half, 13. To calculate the interquartile range, I just have to find the difference between these two things. So the interquartile range for this first example is going to be 13 minus five. The middle of the second half minus the middle of the first half which is going to be equal to eight. Let's do some more of these. This is strangely fun. Find the interquartile range of the data in the dot plot below. Songs on each album in Shane's collection and so let's see what's going on here and like always, I encourage you to take a shot at it. So this is just representing the data in a different way but we could write this again as an ordered list so let's do that. We have one song or we have one album with seven songs I guess you could say. So we have a seven. We have two albums with nine songs so we have two nines. Let me write those, we have two nines then we have three 10s. Cross those out. So 10, 10, 10 then we have an 11. We have an 11. We have two 12s, two 12s and then finally, we have, I used those already and then we have an album with 14 songs. 14. So all I did here is I wrote this data like this so we could see, okay, this album has seven songs, this album has nine, this album has nine and the way I wrote it, it's already in order so I could immediately get, I can immediately start calculating the median. Let's see, I have one, two, three, four, five, six, seven, eight, nine, 10 numbers. I have an even number of numbers so to calculate the median, I'm gonna have to look at the middle two numbers. So the middle two numbers look like it's these two 10s here because I have four to the left of them and then four to the right of them and so since I'm calculating the median using two numbers, it's going to be halfway between them. It's going to be the average of these two numbers. Well, the average of 10 and 10 is just going to be 10. So the median is going to be 10. Median is going to be 10 and in a case like this where I calculated the median using the middle two numbers, I can now include this left 10 in the first half and I can include this right 10 in the second half. So let's do that. So the first half is going to be those five numbers and then the second half is going to be these five numbers and it makes sense 'cause I'm literally just looking at first half it's gonna be five numbers, second half is gonna be five numbers. If I had a true middle number like the previous example then we ignore that when we look at the first and second half or at least that's the way that we're doing it in these examples but what's the median of this first half if we look at these five numbers? Well, if you have five numbers, if you have an odd number of numbers, you're gonna have one middle number and it's going to be the one that has two on either sides. This has two to the left and it has two to the right. So the median of the first half, the middle of the first half is nine right over here and the middle of the second half, I have one, two, three, four, five numbers and this 12 is right in the middle. You have two to the left and two to the right so the median of the second half is 12. Interquartile range is just going to be the median of the second half, 12 minus the median of the first half, nine which is going to be equal to three. So if I was doing this on the actual exercise, I would fill out a three right over there.