STATISTICAL WORKSHEETS

Checking a value exactly on an outlier fence

Compute the fences of the interquartile range rule for a short list and compare a value that sits on the upper fence with one just beyond it.

The fence rule used by the tool

The Outlier Calculator flags a value as an outlier when it is below Q1 minus 1.5 times the interquartile range, or above Q3 plus 1.5 times that range. Here Q1 and Q3 are the first and third quartiles computed with linear interpolation, the type 7 method, and the interquartile range is Q3 minus Q1. The multiplier 1.5 is the convention John Tukey introduced for box plots. The two limits are called the lower and upper fences. A value strictly outside a fence is flagged. A value equal to a fence is not, which is the boundary behavior this guide examines.

Quartiles of 0, 1, 2, 3, 6

With five sorted values, n minus 1 is 4. The first quartile position is 4 times 0.25, which is 1, so Q1 is the second value, 1. The third quartile position is 3, so Q3 is the fourth value, 3. The interquartile range is 3 minus 1, which is 2, and 1.5 times 2 is 3. The lower fence is 1 minus 3, which is minus 2, and the upper fence is 3 plus 3, which is 6. The tool reports lower fence minus 2 and upper fence 6.

The value that sits on the fence

The largest value in the list is 6, exactly the upper fence. The rule asks whether a value exceeds the fence, and 6 does not exceed 6. The tool therefore reports no outliers, shown as None. The flag fires only on a strict inequality. A different tool that used greater than or equal to would flag the same data, so equality cases are a place where programs can legitimately differ. The tool's own behavior is the one described here. The same holds on the lower side: with the lower fence at minus 2, a value of minus 2 would be retained and minus 2.1 would be flagged. In both directions the fence belongs to the inside of the allowed range, a detail worth recording whenever someone asks why a borderline value was or was not listed.

Moving the value just past the fence

Replace 6 with 6.1. The list becomes 0, 1, 2, 3, 6.1. The quartile positions are unchanged, so Q1 is still 1 and Q3 is still 3, because the interpolation only touches the second and fourth values. The fences stay at minus 2 and 6. Now 6.1 is greater than 6, and the tool reports it as an outlier. A change of one tenth turned a retained value into a flagged one, which shows how a fixed threshold creates a sharp boundary even though the data change only slightly. In a real data set the sharpness is arbitrary. Nothing physical separates 6.0 from 6.1, and an analyst reading a list of flagged values should treat those near the fence as borderline and those far beyond it, like the 40 in the next list, as the strong candidates for review.

A second list with a clear outlier

Take 10, 12, 13, 14, 15, 16, 40, with n equal to 7. The first quartile position is 6 times 0.25, which is 1.5, between 12 and 13, so Q1 is 12.5. The third quartile position is 4.5, between 15 and 16, so Q3 is 15.5. The interquartile range is 3, and 1.5 times 3 is 4.5. The fences are 12.5 minus 4.5, which is 8, and 15.5 plus 4.5, which is 20. The value 40 is above 20 and is flagged. The value 10 is above 8 and is not. The flagged value also inflates the mean, which is 120 divided by 7, about 17.1, against about 13.3 without it, though the quartiles barely move because they depend on ranks. That is the practical reason the fence rule is built on quartiles and not on the mean and standard deviation: a single extreme value cannot hide itself by stretching the thresholds.

Why a flag is only a prompt

A fence result is a rule-based flag. It shows that a value is far from the middle half of the data relative to its spread, and it says nothing about whether the value is wrong. A flagged value might be a typing error, a measurement fault, or a legitimate extreme observation that is the most interesting part of the data. The tool does not delete or adjust anything, and deletion should follow an investigation, not a threshold. Keep the original data and record the rule used. Domain knowledge decides what to do next. In a log of delivery times, a value of 40 among values near 14 might be a delayed shipment that matters to the business. In a sensor series, the same pattern might be a glitch. The calculator cannot tell these apart, and neither can the fence rule.

Sensitivity to the quantile method

The fences depend on the quartiles, and quartiles depend on the method. For 0, 1, 2, 3, 6 a method that takes medians of the halves, excluding the middle value, gives Q1 of 0.5 and Q3 of 4.5. Then the interquartile range is 4, the upper fence is 10.5, and 6 is far inside it. Because results can change with the convention, state the quantile method alongside any outlier list. When reconciling against another package, check the method first and the equality rule second.

Small samples and repeated checks

With very few observations, quartiles are unstable and the rule can flag values that would look ordinary in a larger sample. Removing a flagged value and recomputing can flag new ones, because the quartiles and the interquartile range change after each removal. Applying the rule repeatedly until nothing is flagged can remove far more data than intended. A single pass on the original data, with the flagged values examined individually, is easier to explain. For the five-value list on this page, dropping a flagged 6.1 would leave 0, 1, 2, 3, whose quartiles are 0.75 and 2.25 and whose fences are minus 1.5 and 4.5. Nothing else would be flagged then, but the thresholds have moved, which is why the order of operations needs to be written down.

What the controls cover

The two cases fix the quartiles and move one value across the upper fence by a tenth of a unit. They demonstrate the strict comparison and nothing about the meaning of the data. The rule is a screening device. Preserve the data and the quantile convention when comparing reports or investigating a boundary discrepancy, and describe flagged values as flagged, not as errors.

Reproduce the checks

At the upper fence

Open the Outlier Calculator and enter:

Numbers
0,1,2,3,6

Expected output:

Lower fence

-2

Upper fence

6

Outliers

None

Equality is retained inside the fences.

Beyond the upper fence

Open the Outlier Calculator and enter:

Numbers
0,1,2,3,6.1

Expected output:

Lower fence

-2

Upper fence

6

Outliers

6.1

The strict comparison now flags the final value.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks