If you're searching for how to calculate the upper fence, the lower fence, and the outliers of your data set, this is the perfect tool.
Input your numbers, and the calculator will provide the following:
- The lower and the upper fence;
- The outliers; and
- The calculation procedure
In the rest of this article, we explain how to find the upper and lower fences using their formulas.
In our lower and upper fence calculator, we get into a more comprehensive explanation.
How to calculate the upper fence and lower fence?
To calculate the upper and lower fences, you need three parameters:
- The first quartile (Q₁);
- The third quartile (Q₃); and
- The interquartile range (IQR)
🙋 The interquartile range is the difference between the third and the first quartile: IQR = Q₃ - Q₁
🙋 In our quartile calculator, we explain how to find Q₁ and Q₃
Once you know those parameters, the problem of how to find the upper fence and lower fence boils down to using two formulas:
Upper fence = Q₃ + 1.5 × IQR
The lower fence calculation is similar:
Lower fence = Q₁ − 1.5 × IQR
🙋 Using the 1.5 coefficient before IQR is the most common practice, but we can use other values (e.g., 2 or 3), depending on how dispersed we expect data to be. You can modify it in the calculator's advanced mode.
Now that we know how to find the upper fence and the lower fence let's look at the tricky part: obtaining Q₁ and Q₃.
How to calculate the first and third quartiles
The tricky part about calculating the upper fence is finding the quartiles (Q₁ and Q₃). The procedure is as follows:
- Order your numbers in ascending order (our order from least to greatest calculator explains some algorithms for large data sets).
- Divide the ordered data set into two halves;
- The first quartile is the median of the first half, and the third quartile is that of the second (our median calculator explains how to obtain it).
If the number of elements is odd, the middle number marks the end of the first and the beginning of the second half (although there are various ways to deal with uneven amounts. Wikipedia lists).
Let's use the following ordered set:
0, 7, 11, 12, 13, 14, 15, 16, 22, 30, 39, 49, 51, 56, 62, 74, 92, 97 98, 99
First, divide the data set into two halves:
- First half: 0, 7, 11, 12, 13, 14, 15, 16, 22, 30.
- Second half: 39, 49, 51, 56, 62, 74, 92, 97, 98, 99.
The medians of the first and second halves are 13.5 and 68, respectively. Therefore:
- Q₁ = 13.5; and
- Q₃ = 68.
How to find the upper fence and lower fence?
To find the lower and upper fence of a dataset:
Obtain the first and third quartiles (Q1 and Q3, respectively).
Find the interquartile range (IQR):
IQR = Q3 − Q1
Finally, calculate the upper and lower fences with the following formulas:
Upper fence = Q3 + 1.5 × IQR
Lower fence = Q1 − 1.5 × IQR
What is the relationship between quartiles and percentiles?
The relationship between the quartiles and percentiles is described by the following:
- The first quartile (Q1) is the 25th percentile;
- The third quartile (Q3) is the 75th percentile; and
- The second quartile (Q2) is the 50th percentile (the median).