Tutorials › Introduction to Statistics › Applying the 1.5-IQR Outlier Rule

Comparing Groups and Handling Outliers · Tutorial 187 of 996

Applying the 1.5-IQR Outlier Rule

Calculate the 1.5-IQR fences from sample data and apply the strict beyond-the-fence rule to identify flagged observations.

Beginner 9 min read

What You'll Learn

  • Sort sample values before calculating quartiles.
  • Find quartiles using the stated interpolation convention.
  • Calculate the interquartile range and both 1.5-IQR fences.
  • Check individual observations against the lower and upper fences.
  • Distinguish values beyond a fence from values equal to it.
  • Avoid common errors involving quartile conventions, arithmetic, and endpoints.

From a Sample to an Outlier Flag

The 1.5-IQR rule turns a sample's middle spread into two numerical boundaries. To apply it, calculate the first and third quartiles, find the interquartile range, construct a lower and an upper fence, and compare each observation with those fences. The calculation is descriptive: the rule identifies which values lie beyond the boundaries it defines.

Quartiles can be calculated in more than one way, especially for small samples. To make the calculations reproducible, this tutorial uses the linear-interpolation convention for percentiles: for a sample of size \(n\), the position for percentile \(p\) is \(h=1+(n-1)p\). Thus \(Q_1\) is the 25th percentile and \(Q_3\) is the 75th percentile under this convention. When reporting results, state or follow the quartile convention being used; another convention can give different quartiles and therefore different fences.

Definition: Sort the sample values from smallest to largest and write them \(x_{(1)},x_{(2)},\ldots,x_{(n)}\), where \(x_{(i)}\) is the value in position \(i\). For percentile \(p\), calculate \(h=1+(n-1)p\). If \(h\) is an integer, the percentile is the value in that position. If \(h=j+\gamma\), where \(j\) is an integer and \(0<\gamma<1\), interpolate between adjacent values: \(x_{(j)}+\gamma\bigl(x_{(j+1)}-x_{(j)}\bigr)\). Use \(p=0.25\) for \(Q_1\) and \(p=0.75\) for \(Q_3\). The interquartile range is \(IQR=Q_3-Q_1\). The lower and upper 1.5-IQR fences are \(Q_1-1.5(IQR)\) and \(Q_3+1.5(IQR)\), respectively. An observation is flagged by this rule if it is strictly less than the lower fence or strictly greater than the upper fence.

These calculations require a quantitative sample whose observations are expressed in comparable units. There is no probability model or inferential assumption required to calculate the fences: they are summaries of the supplied data. If the sample is not already sorted, sort it before locating percentile positions. Keep the original observations as well as the sorted list, so that after the fences are calculated you can check each actual sample value.

Why Interpolation and Fence Comparisons Work

When a percentile position falls between two ranks, the interpolation rule takes the corresponding fraction of the gap between those ordered values. For example, a position of \(3.25\) is one-quarter of the way from the third value to the fourth value. The result is not a new observed value; it is the percentile estimate specified by this convention.

Once the quartiles are available, the interquartile range gives the width of the middle half of the distribution. Multiplying it by 1.5 gives the distance used to extend the fences outward from the quartiles. In particular, the upper fence is \(Q_3+1.5(Q_3-Q_1)\), not \(Q_3+1.5Q_3-Q_1\). Parentheses matter because the multiplier applies to the entire interquartile range.

$$ \begin{aligned} \text{Lower fence} &= Q_1-1.5(Q_3-Q_1),\\ \text{Upper fence} &= Q_3+1.5(Q_3-Q_1). \end{aligned} $$

Both fences have the same units as the observations: subtracting or adding a multiple of an IQR preserves the measurement units. The comparison rule is also exact: a value equal to a fence is not beyond it. A value outside either boundary is flagged, and a value between the fences, including one exactly on a fence, is not flagged by this rule.

Worked Applications

Worked Example: Finding a Single High Flag

A hypothetical set of ten completion times, measured in minutes, is already sorted: \(2,3,4,5,6,7,8,9,10,24\). Calculate the quartiles and fences, then identify any observations beyond them.

Here \(n=10\). For \(Q_1\), the percentile position is \(h=1+(10-1)(0.25)=3.25\). This lies one-quarter of the way from \(x_{(3)}=4\) to \(x_{(4)}=5\), so \(Q_1=4+0.25(5-4)=4.25\) minutes.

For \(Q_3\), the position is \(h=1+(10-1)(0.75)=7.75\). This lies three-quarters of the way from \(x_{(7)}=8\) to \(x_{(8)}=9\), so \(Q_3=8+0.75(9-8)=8.75\) minutes.

The interquartile range is \(IQR=8.75-4.25=4.50\) minutes. The fences are

$$ \begin{aligned} \text{Lower fence} &=4.25-1.5(4.50)=4.25-6.75=-2.50\text{ minutes},\\ \text{Upper fence} &=8.75+1.5(4.50)=8.75+6.75=15.50\text{ minutes}. \end{aligned} $$

The smallest observation, 2 minutes, is greater than \(-2.50\), so it is not below the lower fence. Every observation except 24 minutes is at most 10 minutes and therefore below the upper fence. Since \(24>15.50\), the 24-minute observation is the only value flagged by the rule.

Worked Example: An Observation Exactly on a Fence

A hypothetical set of five waiting times, in minutes, is \(10,12,14,16,22\). Find both fences and decide whether the largest observation is flagged.

The values are sorted and \(n=5\). The position for \(Q_1\) is \(1+(5-1)(0.25)=2\), so \(Q_1=x_{(2)}=12\) minutes. The position for \(Q_3\) is \(1+(5-1)(0.75)=4\), so \(Q_3=x_{(4)}=16\) minutes. Therefore \(IQR=16-12=4\) minutes.

The lower fence is \(12-1.5(4)=12-6=6\) minutes, and the upper fence is \(16+1.5(4)=16+6=22\) minutes. The largest observation is 22 minutes, exactly equal to the upper fence. Because the rule flags values strictly greater than the upper fence—not values equal to it—22 minutes is not flagged. None of the other observations is below 6 or above 22, so no observation in this sample is flagged.

Worked Example: Sorting Before Checking Every Observation

A hypothetical group of seven plant heights is recorded in centimeters as \(22,12,40,15,17,14,20\). Apply the rule to the complete sample; do not assume the observations are already in order.

First sort the values: \(12,14,15,17,20,22,40\). Here \(n=7\). The position for \(Q_1\) is \(1+(7-1)(0.25)=2.5\), halfway between \(x_{(2)}=14\) and \(x_{(3)}=15\). Thus \(Q_1=14+0.5(15-14)=14.5\) cm. The position for \(Q_3\) is \(1+(7-1)(0.75)=5.5\), halfway between \(x_{(5)}=20\) and \(x_{(6)}=22\). Thus \(Q_3=20+0.5(22-20)=21\) cm.

Then \(IQR=21-14.5=6.5\) cm. The lower fence is \(14.5-1.5(6.5)=14.5-9.75=4.75\) cm. The upper fence is \(21+1.5(6.5)=21+9.75=30.75\) cm. Checking the sorted observations, each value from 12 through 22 is between the fences. The remaining value, 40 cm, is greater than 30.75 cm. Therefore 40 cm is the only observation flagged.

A Reliable Calculation Sequence

For a new sample, separate the work into steps so that an error in ordering, interpolation, or comparison is easier to catch. Keep enough precision during the calculations to avoid changing a decision through premature rounding.

1
Sort the observations.
Write the sample in increasing order and count the observations to obtain \(n\). Use ordered positions to find quartiles; do not calculate quartiles from the order in which values happened to be recorded.
2
Locate and calculate the quartiles.
Use \(h=1+(n-1)p\) for \(p=0.25\) and \(p=0.75\). If a position is fractional, interpolate between the two adjacent ordered values using the fractional part of \(h\).
3
Find the spread and fences.
Calculate \(IQR=Q_3-Q_1\), then calculate \(Q_1-1.5(IQR)\) and \(Q_3+1.5(IQR)\). Keep units attached to the results.
4
Compare each observation with both fences.
Flag a value only if it is less than the lower fence or greater than the upper fence. Equality with either fence does not meet the strict comparison.

Common Mistakes

The most frequent mistakes are small calculation or interpretation slips rather than difficult arithmetic. A final check against the definitions often reveals them.

  • Using a different quartile convention without saying so. Quartiles may differ when samples are small. Apply one stated convention consistently rather than switching methods partway through the calculation.
  • Applying 1.5 to the wrong quantity. The fences use \(1.5(IQR)\), where \(IQR=Q_3-Q_1\). Do not multiply just one quartile by 1.5.
  • Flagging an observation equal to a fence. “Beyond” means strictly less than the lower fence or strictly greater than the upper fence. Equality does not qualify.
  • Checking only the largest observation. A small observation can fall below the lower fence, so check every value against both boundaries.
  • Rounding too early. Carry sufficient precision through the quartile and fence calculations, then round the reported results. If an observation is close to a fence, premature rounding can change the comparison.

A useful reporting sentence names the rule and the value: “Using the stated quartile convention, the 40 cm height is above the upper fence of 30.75 cm and is flagged by the 1.5-IQR rule.” That sentence gives the reader enough information to see what comparison was made without confusing a calculated fence with an observed value.

Key takeaway: The application of the 1.5-IQR rule is a sequence: calculate \(Q_1\) and \(Q_3\) consistently, find \(IQR\), construct both fences, and compare every observation using strict inequalities. Report the quartile convention and retain the measurement units.

Check Your Understanding

For each question, show enough calculation to make your method and comparison clear.

  1. For the sorted sample \(3,5,6,8,9,11,14,20\), calculate \(Q_1\), \(Q_3\), the IQR, and both fences using the interpolation convention in this tutorial. Which observations are flagged?
  2. A sample has fences of 4 and 18. Which of the values 3.9, 4, 12, 18, and 18.1 are flagged? Explain how equality is treated.
  3. Why must the observations be sorted before using percentile positions?
  4. If the IQR is 6 units and \(Q_3=25\) units, calculate the upper fence and state its units.
  5. What calculation error is made by writing the upper fence as \(Q_3+1.5Q_3-Q_1\) instead of \(Q_3+1.5(Q_3-Q_1)\)?