The last eight trips on a bus route arrived , , , , , , and minutes late. The mean delay is minutes, even though the two middle delays are and minutes, because one long delay pulls the mean upward. To compare routes fairly we want summaries that show where the bulk of the trips lies and how wide the middle half is, without letting a single trip dominate. This lesson builds such summaries from positions in the ordered data, draws them as a box plot, and adds two resistant measures, the median absolute deviation and the trimmed mean.
Key terms
Percentile
Definition For , a th percentile is a value that splits a distribution so that percent of it lies below the value and percent lies above it. A quantile is the same idea with the fraction written between and , so the 25th percentile is the quantile, and the median is the 50th percentile. For a finite set of values, such as a sample, an exact split may be impossible, or a whole interval of values may give it. A sample percentile is therefore computed with a stated rule, and the rules in common use, which differ in how they interpolate between neighboring ordered values, can give different answers in small samples.
In plain words A percentile marks a position in the ordered data. About percent of the observations lie below it and the rest above it. In a large dataset the different rules usually agree closely, but in a small one they can disagree, so a reported percentile should come with the rule that produced it, especially when results from different software are compared.
Example In the eight delays, every value strictly between and minutes has two delays below it and six above it, an exact split of 25 percent and 75 percent. A rule that takes the midpoint gives minutes, while the linear interpolation rule that many software packages use by default gives minutes. Both are reasonable 25th percentiles, and neither is an arithmetic mistake.
Quartiles and interquartile range
Definition The quartiles , and are the 25th, 50th and 75th percentiles, so they cut ordered data into four parts with about a quarter of the observations in each, and is the median. Like other sample percentiles they need a stated rule. This page uses the median-of-halves rule for observations. Sort the data and find the median. The lower half consists of the observations before the median position and the upper half of those after it, and when is odd the single middle observation is left out of both halves. Then is the median of the lower half and is the median of the upper half. The interquartile range is
measured in the units of the data.
In plain words The quartiles bracket the middle half of the ordered data, and the IQR is the width of that middle half. It is a measure of spread built from positions near the middle. Under the median-of-halves rule, in a dataset of at least six values, moving the largest observation farther up or the smallest farther down leaves it unchanged.
Example For the eight delays the median is halfway between the fourth and fifth values, minutes. The lower half has median , and the upper half has median , so minutes. The middle half of the delays lies between and minutes, and changing the largest delay from to minutes would leave all three quartiles and the IQR exactly as they are. The linear interpolation rule gives and instead, with minutes.
Five-number summary and box plot
Definition The five-number summary lists the minimum, , the median, and the maximum. A box plot draws these positions along a number line. A box runs from to , a line inside the box marks the median, and whiskers extend outward from the box. In the simple version the whiskers reach the minimum and the maximum. In the modified version, the default in much statistical software, each whisker stops at the most extreme observation that is not beyond its outlier fence, and any observation beyond a fence is drawn as a separate point. A box plot should state which version it shows and which quartile rule it uses.
In plain words A box plot compresses a dataset into a few positions. It shows the center, the middle half and the extent of the data at a glance, and it makes several groups easy to compare side by side. It does not show the sample size or the mean, and it can hide gaps, clusters and multiple peaks, so quite different datasets can produce the same box plot.
Example For the eight delays the five-number summary is minutes. A simple box plot has a box from to , a median line at and whiskers out to and . In the modified version the fences, found in the next card, are and minutes. The upper whisker then stops at , the delay of minutes appears as a separate point, and the lower whisker still reaches .
Outlier fence
Definition The lower and upper outlier fences are
An observation below or above is flagged as a potential outlier. The factor is a convention, and the fences move when the quartile rule changes.
In plain words The fences screen for observations that lie unusually far from the middle half of the data. A flagged value deserves a closer look, at how it was recorded and at whether it came from the same process as the rest. The flag alone does not prove that the value is an error, and it is not a reason to delete it. Even a normal distribution has about 0.7 percent of its values beyond the fences computed from its own quartiles, so a large sample of perfectly ordinary normal data can be expected to contain some flagged points.
Example For the eight delays , so and minutes. No delay lies below , and only the delay of minutes lies above , so it is the one flagged. It could be a recording mistake, or a real trip held up by a road closure, and the flag says to find out which. With the linear interpolation quartiles and , the fences would be and minutes, and the same delay would be flagged.
Median absolute deviation
Definition For observations with median , the median absolute deviation is the median of their distances from ,
This is the raw, or unscaled, MAD, and it is in the units of the data. Some software multiplies it by about by default, so that for normal data it estimates the standard deviation. A reported MAD should say whether it is raw or scaled.
In plain words The MAD measures spread with two medians, one for the center and one for the typical distance from it. A summary is called resistant when changing a few observations, even to extreme values, can move it only a limited amount. In a dataset of at least three values, moving one observation, however far, changes the MAD by only a limited amount, while it can make the standard deviation as large as you like. Resistance has limits, though. If enough observations move, the MAD moves too.
Example For the constructed values , the median is . The distances from are , , , and , which in order are , so the raw MAD is . The sample standard deviation of the same values is about , inflated by the single value .
Trimmed mean
Definition Sort observations and choose a whole number with . The trimmed mean removes the smallest and the largest observations and averages the remaining . The amount of trimming is usually described by the proportion removed from each tail. When a requested proportion does not give a whole number of observations, software rules differ in how they round, so the rule should be reported.
In plain words A trimmed mean is a compromise between the mean, which uses every value, and the median, which in effect trims everything except the middle one or two. Like the mean, it uses the actual sizes of the values it keeps, and like the median, it ignores the most extreme positions. For a skewed distribution it describes a different quantity from the ordinary mean, so it is not the mean with inconvenient values quietly removed. Choose the trimming rule before making the comparison, report it, and keep the full data on record.
Example For , trimming one observation from each end, 20 percent per tail, removes and and leaves , whose mean is . The ordinary mean is . For the eight delays, trimming one from each end, 12.5 percent per tail, removes and , and the remaining six delays average minutes, compared with the ordinary mean of minutes.
Check yourself
- Nine trips on another route took , , , , , , , and minutes. With the median-of-halves rule, find the quartiles, the IQR and the fences. Which trips are flagged, and where do the whiskers of the modified box plot end?
Show the answer
With the median is the fifth value, minutes, and it is left out of both halves. The lower half gives , and the upper half gives , so minutes. The fences are and minutes. Only the trip of minutes lies outside, above . The whiskers end at and minutes, and the trip of minutes is drawn as a separate point, a value to check rather than to discard.
- Compare the eight delays with the nine values . Show that the two datasets have the same modified box plot. What do the box plots fail to reveal?
Show the answer
For the nine values the median is the fifth value, . The lower half gives and the upper half gives . With minimum and maximum , the five-number summary is , the same as for the eight delays. The IQR is in both cases, so the fences are and , the whiskers end at and , and is flagged in both. The two box plots are identical, yet one dataset has values with mean and the other has values with mean . A box plot does not show the sample size or the mean, and it shows only a rough outline of the shape.
- In the values , change to . Recompute the mean, the median, the raw MAD and the mean trimmed by one observation at each end. Which summaries resist the change?
Show the answer
The mean rises from to . The median stays . The distances from are now , , , and , which in order are , so the raw MAD stays . Trimming removes and and leaves , so the trimmed mean stays . The median, the MAD and the trimmed mean resist the change, while the mean moves, and so does the sample standard deviation, from about to about . The resistance of this trimmed mean covers only one extreme value per tail. If were also changed to , the trimmed mean would keep and become , while the median would still be .