What are Quartiles and IQR?
Quartiles in statistics are points that divide the given data-set into 4 equal parts.
While variance and standard deviation are the measurements of dispersion around the mean, quartiles measure the variability around the median. The advantage of quartiles is that it takes every data point into account. Let’s understand this by an example. In the following diagram, a data-set is given and whose quartiles are marked as Q1, Q2, and Q3.
The first quartile Q1 (also called the lower quartile) is the number below which the bottom-most 25% of the data lie. The second quartile Q2 (also called the median) divides the data into two equal parts and has 50% of the data below it. The third quartile Q3 ( also called the upper quartile) has 75% of the data below it and topmost 25% data above it.
Interquartile Range(IQR) – Inter Quartile Range is the range of values where 50% of the data points lie. Technically it is difference between 3rd and 1st quartile.
How to find quartiles?
There are few simple steps to find quartiles. Let’s take an example. We are given with the following data.
- 2, 5, 6, 7, 10, 17, 13, 14, 16, 20, 18, 12
Before starting, it is needed to sort the data in ascending order.
- 2, 5, 6, 7, 10, 12 13, 14, 16, 17, 18, 20
In the first step, the data are divided into two equal parts, that is the median (which is same as Q2) is calculated. In this way, we get two halves of data, which are further divided into two equal parts. This means that the median of each half is calculated. The median of the first half become Q1 and the median of the second half become Q3. In this example,
- 1st quartile =6.5
- 2nd quartile or median = 12.5
- 3rd quartile =16.5
- IQR = Q3-Q1 = 16.5-6.5 = 10
Visualization of quartiles and boxplots
- First Quartile
- Median (Second Quartile)
- Third Quartile
In last section, we took an example, let’s see the spread of the data using a boxplot which includes five-point summary as well. Please note that 50% of the data-points (6 points in this case) lie within IQR.
Boxplot and Outliers
What is an Outlier?
How to find outlier in a box plot?
- 2, 5, 6, 7, 10, 12 13, 14, 16, 17, 18, 33
How is sex-ratio of Indian states distributed?
- minimum value of sex ratio among Indian States/UTs is 820
- first quartile is 900
- second quartile (median) is 946
- third quartile is around 975
- 50% of the states have sex ratio between 900 and 975( that is IQR is 900-975)
- maximum value of sex ratio is 1084
- There are two outliers
You may refer to the following video as a supplement to this post. It explains these concepts briefly.