By the end of this lesson, you should be able to
- Interpret percentiles and quartiles in an ordered dataset.
- Calculate an interquartile range and interpret the common 1.5 IQR fence.
- Recognize that valid quantile algorithms may produce different answers for small samples.
The mean and standard deviation are useful, but they can be dramatically affected by unusual values. Sometimes it is more useful to summarize where the middle of the observations sits.
To do that, we sort the data.
Percentiles and quartiles
The th percentile roughly describes the point at or below which percent of the data lie. The median is the 50th percentile.
The first quartile, , is the 25th percentile; the third quartile, , is the 75th percentile. The interquartile range is
It describes the spread of the central portion of the data. We commonly report a median and IQR together for distributions that are skewed or contain extreme observations.
There is a subtlety: for a finite sample, software packages use several different rules for determining percentiles. They can disagree, particularly for small datasets. This is not necessarily a software bug. It is a choice of definition.
One explicitly stated convention
For the laboratories on this site, we use a common linear interpolation rule (sometimes called type 7). For sorted values , estimate a quantile at probability by interpolating at zero-based position
If falls between two integers, interpolate between the corresponding adjacent observations.
For example, take
For , we have , so . Similarly, , the median is 6, and .
This definition is easy to calculate consistently. Other perfectly legitimate textbook conventions may give different quartiles.
Is it an outlier?
A common exploratory rule calls observations outside the inner fences potential outliers:
For our five observations, the fences are and . No value lies beyond them.
Importantly, this is a screening convention, not a scientific definition of an error. A high observation might be completely legitimate. Deleting it automatically can introduce bias and remove the very phenomenon we hope to understand.
A boxplot often shows the median, quartiles, whiskers, and observations outside the chosen fence. Different plotting packages can also use different rules for whiskers.
What not to infer
The interquartile range does not describe every observation. A small IQR does not rule out extreme tails. And quartiles alone cannot tell us whether a distribution has one peak or two.
No single statistic describes everything about a dataset. That is why we use several summaries together.
Check your understanding
- For the sorted data , what are the median, IQR, and upper 1.5-IQR fence using this lesson’s rule?
- Does an observation beyond the upper fence have to be a measurement error?
- Why should we state which method produced the sample quartiles when reporting small datasets?
Suggested responses
- Median 6, IQR 4, upper fence 14. 2. No: it is an observation worth investigating, not automatically a mistake. 3. Multiple accepted algorithms can yield different sample percentiles.
Interpolation and boxplot conventions
For sorted , the type-7 first-quartile position is in zero-based indexing. Interpolate 75% of the way from 1 to 2, giving . The third-quartile position is 2.25, yielding . Thus IQR is , with fences and . The maximum 8 is not flagged.
A boxplot’s whiskers commonly end at the most extreme observed values within the fences, rather than at the numerical fences themselves. In this example whiskers end at 1 and 8. R’s boxplot hinges can differ from type-7 quartiles, so an independently calculated quantile table and a package boxplot can legitimately disagree unless conventions are aligned.
Quantiles are resistant to changing one extreme value because they depend mainly on order positions, but they are not immune to contamination. The median’s resistance is often summarized by an approximately 50% breakdown point in suitable large-sample settings: enough altered observations can move the center arbitrarily far. The phrase “robust” names a specific behavior under perturbation, not a guarantee that the statistic answers the right scientific question.
Additional practice
- Calculate type-7 quartiles for .
- If the largest observation 12 becomes 120, which quartile changes under this interpolation rule?
- Why should an outlier analysis preserve an audit of any exclusion?
Worked additional solutions
- Positions and yield , , IQR 6.
- stays 3; . Small-sample interpolated quartiles can still depend on an extreme endpoint. Resistance is not complete invariance.
- Exclusion changes the evidence and possibly the estimand. Record the rule, reason, timing, and sensitivity of conclusions with and without the observation.
Keep your place
Mark this lesson complete after you've read it, attempted its exercises, and explained its central idea in your own words.
Progress is not saved unless you choose to mark the lesson complete.
Saved only in this browser's local storage. No required account, server transmission, or analytics. You can reset your saved progress on the course page. Clearing browser data also clears the record.