FAQ: Interquartile Range - Quartiles

This community-built FAQ covers the “Quartiles” exercise from the lesson “Interquartile Range”.

Paths and Courses
This exercise can be found in the following Codecademy content:

FAQs on the exercise Quartiles

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I wonder why interquartile is determined by the difference between 1st and 3rd quartile instead of the median of q1 and q3?

Appreciate any reply.

1 Like

Hi @stronghead,

The interquartile range is a measure of the spread of a set of data, while the median is a measure of its central tendency. So they are considering different aspects of the data.

With the interquartile range, we are reducing the influence of outliers on our measure of the spread, as compared to using the full range as the measure of the spread. In that regard, the interquartile range is more robust. In a similar regard, the median can be more robust as a measure of central tendency than the mean.

If desired, we could look at the median of the values within the interquartile range as a measure of central tendency, but that does not usually gain us much in terms of robustness in comparison to the median of the entire dataset.

Edited on June 21, 2019 to add the following:

Regarding robustness of measures, we should consider the nature of our data carefully when choosing how to measure such characteristics as central tendency and spread. For example, if the data is multimodal with relatively large distances between the modes, the median might not be very robust if it falls between modes. That is because adding or removing a small number of data points could radically change the median. If the data is expressed as real numbers rather than as integers, the mode might not be very helpful to us unless we group the data into bins before taking the mode. So, we need to think carefully about the data as we choose our measures.

2 Likes

Hi, thank you so much for the reply!

But in NumPy, I wonder what makes “q1-q3” more representative than (q1+q3)/2, within the interquartile range.

1 Like

You could look at both q3-q1 and (q1+q3)/2. However the first one would measure spread, while the second would measure central tendency.

1 Like

Got it! Thank you so much!

1 Like

By the way, the measure that you suggested, (q1+q3)/2, is known as the midhinge.

EDIT: The following was added on June 23, 2019:

Revisiting that statement, it must be noted that the median of the values within the interquartile range is actually identical to the median of the entire dataset.