A1.1 Data Distributions
A2 – Recursion and Financial Modelling
OA1 – Matrices
OA2 – Networks and Decision Mathematics
OA3 – Geometry and Measurement
1 of 2

1.1.6 Interquartile Range (IQR) and Upper/Lower Fence

Interquartile Range (IQR)

  • When splitting a dataset into quarters, the value of the data points, or averages, splitting up the distribution are known as the quartiles.
  • The quartiles are numbered 1-3, with quartile 2 representing the median.
  • The method for finding the quartiles is equivalent to finding the median, splitting the dataset into two subsets (one containing all data points less than the median, one containing all data points greater than the median), and then finding the median of each of those subsets.
  • The interquartile range (IQR) is the difference between quartiles 3 and 1:

I Q R=Q_{3}-Q_{1}

Note: as with the median, if there is no single point corresponding to either quartile, the quartile is instead equal to the average of the two points at the centre of each half of the dataset.

Example

For the dataset: 1 3 4 5 6 9 10

The median is 5. Using this to split, the dataset, we get:

1 3 4 and 6 9 10

The middle datapoint of the first set; Q_{1}=3

The middle datapoint of the second set; Q_{3}=9

The interquartile range is therefore: I Q R=9-3=6

Upper Fence/Lower Fence

  • The upper and lower fences of a numerical distribution provide a way of checking for outliers (i.e. data points which don’t match the overall trend or are the result of random error). Any datapoint with a value less than the lower fence, or higher than the upper fence is considered an outlier.
  • Removing outliers often allows for more accurate statistical analysis.
  • The fences are found using the values of the quartiles and IQR using the formula:

\text { Upper Fence }=Q_{3}+1.5 \text { IQR }

\text { Lower Fence }=Q_{1}-1.5 \text { IQR }

Example

Dataset: 1 3 5 6 8 9 11 40

The median is: \frac{6+8}{2}=7

So, our subsets are: 1 3 5 6 and 8 9 11 40

The quartiles are: Q_{1}=\frac{3+5}{2}=4,\ \quad Q_{3}=\frac{9+11}{2}=10

So, the IQR is: I Q R=10-4=6

The fences are: \text { Upper fence }=10+1.5 * 6=19,\ \text { Lower fence }=4-1.5 * 6=-5

As 40>19, i.e. 40 is greater than the upper fence, we can say this datapoint is an outlier.