Upper and Lower Fence Calculator (2024)

Created by Rijk de Wet

Reviewed by

Wojciech Sas, PhD and Steven Wooding

Last updated:

Jan 18, 2024

Table of contents:
  • What is the upper and lower fence?
  • The use of fences in statistics
  • How to calculate the upper and lower fence
  • An example of how to calculate the upper and lower fence
  • How to find the upper and lower fence with our calculator
  • FAQ

Welcome to the upper and lower fence calculator, where we'll discuss the use of fences in statistics and show you how to find the lower fence and the upper fence of a dataset. These fences are vital to finding that pesky outlier in your dataset.

What is the upper and lower fence?

Before we can make sense of our upper and lower fence calculator, we must define what fences in statistics mean. The upper and lower fences of a dataset are the thresholds, outside of which values can be considered outliers. Outliers, therefore, are any values that fall below the lower fence or above the upper fence.

The use of fences in statistics

Besides helping us find outliers, fences can be a suitable replacement for the minimum and maximum in descriptive statistics. In most cases, box plots (a helpful tool to visualize a dataset) use the minimum and maximum as the box's whiskers. It's much more insightful, though, to use the upper and lower fences for the whiskers and then indicate outlying values with distinct points. Take a look at the figures below:

Upper and Lower Fence Calculator (1)

How to calculate the upper and lower fence

Now that we know what the fences are, we'd love to know exactly how to find the upper and lower fence. There are a few steps involved, so let's get started!

Before we can get to the upper and lower fence formulas, we need two basic but important values: the dataset's quartiles. We denote the first quartile with Q1Q_1Q1 and the third quartile with Q3Q_3Q3. We can then calculate the interquartile range (IQR) as IQR=Q3Q1\text{IQR} = Q_3 - Q_1IQR=Q3Q1.

Now that we have the building blocks, how do we find the lower fence, and how do we find the upper fence?

  • The formula for the upper fence is Upperfence=Q3+1.5×IQR\text{Upper fence} = Q_3 + 1.5\times\text{IQR}Upperfence=Q3+1.5×IQR.

  • The formula for the lower fence is Lowerfence=Q11.5×IQR\text{Lower fence} = Q_1 - 1.5\times\text{IQR}Lowerfence=Q11.5×IQR.

Some select sources replace the 1.51.51.5 in our formulas with other values, like 222 or sometimes even 333. The choice of the multiplier is problem-specific and depends on the dataset distribution. An outlier in a dataset of children's heights would still be close to the rest of the dataset, so we'd choose a smaller multiplier like 1.51.51.5. A millionaire's salary in a dataset of salaries would be much more outlying, so we'd pick a bigger multiplier, like 333 or more. If you'd like to use a different multiplier for your dataset, you can enter the Advanced mode and change it from the default of 1.51.51.5.

So, there you have it! We've found the formula for the upper fence and the lower fence, and now we can find outliers in any dataset we want.

An example of how to calculate the upper and lower fence

Let's use our upper and lower fence formula in a practical example. Suppose we have a dataset of each year's rainfall volumes for January from 2010 to 2021 in New York, and it looks like this:

1.331.331.33, 1.961.961.96, 3.123.123.12, 2.202.202.20, 1.581.581.58, 2.042.042.04, 1.801.801.80, 6.326.326.32, 1.901.901.90, 3.843.843.84, 2.932.932.93, 2.342.342.34.

Can you already guess which value is going to be an outlier?
Let's back up that guess with some math.

  1. We first have to sort the dataset in increasing order:

    1.331.331.33, 1.581.581.58, 1.801.801.80, 1.901.901.90, 1.961.961.96, 2.042.042.04, 2.202.202.20, 2.342.342.34, 2.932.932.93, 3.123.123.12, 3.843.843.84, 6.326.326.32.

  2. We can determine that the dataset's first and third quartiles are Q1=1.85Q_1= 1.85Q1=1.85 and Q3=3.025Q_3 = 3.025Q3=3.025.

  3. Using Q1Q_1Q1 and Q3Q_3Q3, we can calculate the interquartile range with

    IQR=Q3Q1=3.0251.85=1.175\text{IQR} = Q_3 - Q_1 = 3.025 - 1.85 = 1.175IQR=Q3Q1=3.0251.85=1.175

  4. Finally, we can use the upper fence formula to get

    Upperfence=Q3+1.5×IQR=3.025+1.5×1.175=4.7875\text{Upper fence} = Q_3 + 1.5 \times \text{IQR} = 3.025 + 1.5 \times 1.175 = 4.7875Upperfence=Q3+1.5×IQR=3.025+1.5×1.175=4.7875

  5. …and we can use the lower fence formula to get

    Lowerfence=Q11.5×IQR=1.851.5×1.175=0.0875\text{Lower fence} = Q_1 - 1.5 \times \text{IQR} = 1.85 - 1.5 \times 1.175 = 0.0875Lowerfence=Q11.5×IQR=1.851.5×1.175=0.0875

We can look at our data with these upper and lower fences and see that 2017's rainfall of 6.326.326.32 is an outlier. Was your initial guess correct?

How to find the upper and lower fence with our calculator

Our upper and lower fence calculator takes all these steps for you and gives you the fences in the blink of an eye so that you can get to find outliers in your dataset.

  1. Enter your dataset's individual values in the rows. You can input up to 50 values.

  2. Optionally, change the multiplier used in the fence formulas in the Advanced mode.

  3. The calculator will determine the fences and display them at the bottom of the list of values, along with your dataset's outliers and the steps taken to calculate them. Happy outlier hunting!

FAQ

What is an outlier?

Outliers are values in a dataset that differ significantly from other values. The presence of outliers can be a problem, although it depends on what task you're using the data for. Outliers can be legitimate data, like a CEO's salary in a salary dataset. Outliers can also be invalid or due to mistakes; this could be a poorly calibrated sensor, or a typing error made when copying handwritten data over to a spreadsheet.

How do I find outliers?

To find outliers in your dataset, you need to calculate the upper and lower fences of the dataset. You'd then see which of the dataset's values fall outside of the fences — those values are all outliers.

How do I calculate the upper and lower fences?

Multiply your dataset's interquartile range with 1.5, then add and subtract that from your dataset's first and third quartiles, respectively. Those are your upper and lower fences.

What is the upper fence formula?

You can calculate the upper fence with Q₃ + 1.5 × IQR, where Q₃ is your third quartile and IQR is your interquartile range. Any value in your dataset above the upper fence is an outlier.

What is the lower fence formula?

You can calculate the lower fence with Q₁ − 1.5 × IQR, where Q₁ is your first quartile, and IQR is your interquartile range. Any value in your dataset below the lower fence is an outlier.

Rijk de Wet

Upper and Lower Fence Calculator (2024)

References

Top Articles
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 5533

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.