The middle half and the 1.5·IQR rule
◈ 10 cardsQ1 241.25, Q3 670, IQR 428.75 on the amounts; fences at −401.88 and 1313.13 flag the $1,320 order for investigation. QUARTILE.INC and R's quantile() (type 7) agree to the cent.
Cutting the sorted data into quarters
Sort the twelve amounts and cut them into four equal-count pieces. The cut points are the quartiles: Q1 has a quarter of the values below it, Q2 is the median, Q3 has three quarters below it. The interquartile range, IQR = Q3 − Q1, is the width of the middle half of the data — the rank-based spread that pairs with the median. A percentile generalises the idea: the 90th percentile has 90 % of the values at or below it.
Worked example — the amounts
With 2:13 as the range:
=QUARTILE.INC(2:13, 1)→ 241.25=QUARTILE.INC(2:13, 3)→ 670- IQR = 670 − 241.25 = 428.75
=PERCENTILE.INC(2:13, 0.9)→ 958
The fractional Q1 is not a mistake: with twelve values the quarter mark falls between the 3rd (215) and 4th (250) sorted values, and the function interpolates. R's quantile() does the same by default:
> quantile(orders$amount, c(0.25, 0.5, 0.75))
25% 50% 75%
241.25 445.00 670.00
> IQR(orders$amount)
[1] 428.75
The five-number summary — minimum, Q1, median, Q3, maximum — is 90 · 241.25 · 445 · 670 · 1320, and it is what a box plot draws: the box spans Q1 to Q3, the line inside is the median, the whiskers reach to the last values inside the fences. R's summary(orders$amount) prints the same five plus the mean, rounded to four significant digits (1st Qu. 241.2). One R habit to unlearn: range(orders$amount) returns two numbers, [1] 90 1320, the minimum and maximum — not their difference. For the single-number range use diff(range(x)) or MAX − MIN.
The 1.5·IQR fences
An outlier is a value that sits far outside the middle half. The standard rule fences it:
Here 241.25 − 643.125 = −401.88 and 670 + 643.125 = 1313.13. No amount can be negative, so the lower fence is moot; the upper fence catches exactly one order — 1005, at $1,320. What a fenced point means is a judgement, not a verdict: it is flagged for investigation. Is the $1,320 a typo for $132? A genuine bulk purchase? A different kind of customer? The analyst finds out. A fenced value is never deleted automatically and never replaced by the median; both moves destroy information and, in a twelve-row dataset, would erase Alberta's largest sale.
Type four calls, then fill the worksheet
Type the two spreadsheet functions and the two R calls. The worksheet asks for Q1, Q3, the IQR and the upper fence.
CRISP-DM: quartiles and fences are data understanding → explore data; investigating the flagged order is verify data quality.