Tutorials › Introduction to Statistics › How Outliers Change Group Summaries

Comparing Groups and Handling Outliers · Tutorial 191 of 996

How Outliers Change Group Summaries

Use worked data to compare how extreme observations affect means, standard deviations, medians, interquartile ranges, and conclusions about group differences.

Beginner 12 min read

What You'll Learn

  • Calculate how replacing an observation changes a group’s mean.
  • Compare sample standard deviations before and after an extreme value appears.
  • Check whether the median and interquartile range change in the same data.
  • Explain how an outlier can reverse an apparent group difference based on means.
  • Describe group comparisons using more than one measure of center and spread.
  • Avoid treating an unusual value as an automatic reason to discard data.

Why the Choice of Summary Matters

A group summary compresses many observations into a few numbers. That is useful when comparing groups, but no single summary tells the whole story. In particular, an extreme observation can pull a mean toward itself and greatly increase a standard deviation, while the median and interquartile range may change little or, for some data sets, not change at all.

This difference matters when a comparison seems to depend on a particular summary. Two groups may have similar medians but quite different means, or a mean difference may even point in the opposite direction from a median difference. Those results are not necessarily contradictory: the summaries respond differently to the data. A careful comparison reports enough information to show how the distributions differ rather than letting one number stand for the entire group.

Definition: The mean is the sum of the observations divided by their number. The median is the middle observation after ordering the data, or the average of the two middle observations when there are an even number. The interquartile range is \(IQR=Q_3-Q_1\), the difference between the third and first quartiles. For a sample, the sample standard deviation \(s\) measures the typical distance of observations from the sample mean, with the squared deviations divided by \(n-1\) before taking the square root.

For the examples here, quartiles are found by splitting an ordered set of seven observations into the three values below the median and the three values above it; \(Q_1\) and \(Q_3\) are the medians of those halves. Using one stated quartile convention consistently makes comparisons easier to follow. Software may use a different convention, especially with small samples, so reported quartiles should be interpreted according to the method used.

An extreme observation is a value unusually far from most of the observations in its group. The word describes its position in the data, not whether it is wrong. A value can be extreme and still be a genuine measurement. The calculations below are descriptive: they summarize the stated observations and do not require a probability model or an assumption that the data are normally distributed.

Why Means and Standard Deviations Respond Strongly

The mean uses every value directly. If one value is replaced while the sample size stays fixed, the change in the mean can be calculated exactly. Let \(x\) be the original value and \(M\) the replacement. The original total includes \(x\); the new total includes \(M\). The difference between the totals is \(M-x\), so dividing by the unchanged sample size gives the change in the mean.

$$ \bar{x}_{\text{new}}-\bar{x}_{\text{old}}=\frac{M-x}{n} $$

Thus, the farther the replacement is from the original value, the greater its effect on the mean. The standard deviation is also sensitive because it is based on squared distances from the mean: a distance twice as large contributes four times as much squared distance. The mean itself shifts as the data change, but squaring makes a very distant observation particularly influential.

1
Express the squared deviations.
For observations \(x_1,\ldots,x_n\), their sum of squared deviations from the mean is \(\sum (x_i-\bar{x})^2\).
2
Expand the squares.
\(\sum (x_i-\bar{x})^2=\sum x_i^2-2\bar{x}\sum x_i+n\bar{x}^2\).
3
Use the definition of the mean.
Since \(\sum x_i=n\bar{x}\), the middle term is \(-2n\bar{x}^2\). Combining terms gives \(\sum (x_i-\bar{x})^2=\sum x_i^2-n\bar{x}^2\).
4
Calculate the sample variance.
By definition, \(s^2=\sum (x_i-\bar{x})^2/(n-1)\). Therefore, \(s^2=(\sum x_i^2-n\bar{x}^2)/(n-1)\). A very large observation can substantially increase \(\sum x_i^2\), and hence the sample variance and standard deviation.

The median and quartiles depend on ordered positions, rather than on how far apart the values are. If one value changes but remains at an end of the ordered data, it may leave the central positions used for the median and quartiles untouched. That is one reason these summaries can be more resistant to extreme observations. It is not a guarantee that they will always stay fixed: a sufficiently large change in the ordering, or a different position in a small data set, can change them.

Worked Example: One Extreme Value Changes the Mean and Standard Deviation

Suppose a hypothetical group has seven measurements, in units: \(9, 10, 11, 12, 13, 14, 15\). Consider what happens if the largest measurement, 15, is replaced by 40. Compare the mean, sample standard deviation, median, and interquartile range before and after.

Before the replacement. The sum is 84, so \(\bar{x}=84/7=12\). The sum of squared observations is \(81+100+121+144+169+196+225=1036\). Using the derived formula, \[ s^2=\frac{1036-7(12^2)}{6}=\frac{28}{6}=4.667, \qquad s=\sqrt{4.667}=2.160. \] The median is 12. The lower half is \(9,10,11\), so \(Q_1=10\); the upper half is \(13,14,15\), so \(Q_3=14\). Hence \(IQR=14-10=4\) units.

After the replacement. The new data are \(9,10,11,12,13,14,40\), with sum 109. Thus \(\bar{x}=109/7=15.57\) units. The sum of squared observations is \(81+100+121+144+169+196+1600=2411\). Therefore, \[ s^2=\frac{2411-7(15.5714^2)}{6} =\frac{4996/7}{6}=118.95, \qquad s=\sqrt{118.95}=10.91\text{ units}. \] The median remains 12. The lower half is still \(9,10,11\), and the upper half is now \(13,14,40\), so \(Q_1=10\), \(Q_3=14\), and \(IQR=4\) units.

In this example, replacing one value increases the mean from 12 to 15.57 units and the sample standard deviation from 2.160 to 10.91 units. The median and interquartile range are unchanged. That stability comes from the unchanged middle positions in these particular data; it does not mean that medians and quartiles are immune to every unusual value.

How an Extreme Value Can Change a Group Comparison

Summaries are often used to compare two groups. A clear comparison identifies which summaries are being compared and gives their values in context. If an extreme observation changes one group’s mean much more than its median, the apparent group difference can depend on which measure of center is used. Neither calculation should be hidden: each describes a different feature of the data.

Worked Example: A Mean Difference Reverses Direction

Imagine two hypothetical groups with measurements in units. Group A initially has \(9,10,11,12,13,14,15\), and Group B has \(11,12,13,14,15,16,17\). Compare the groups, then replace Group A’s 15 with 40.

Before the replacement. Group A has mean 12, median 12, and \(IQR=14-10=4\) units. Group B’s sum is 98, so its mean is \(98/7=14\) units. Its median is 14; its quartiles are \(Q_1=12\) and \(Q_3=16\), giving an IQR of 4 units. The mean difference, A minus B, is \(12-14=-2\) units, and the median difference is also \(12-14=-2\) units. By either measure of center, Group A is lower by 2 units.

After the replacement in Group A. Its data are \(9,10,11,12,13,14,40\), so its mean is \(109/7=15.57\) units. Its median remains 12 and its IQR remains 4 units. Group B is unchanged, with mean 14 and median 14. The mean difference is now \(15.57-14=1.57\) units: by the means, Group A is higher. But the median difference remains \(12-14=-2\) units: by the medians, Group A is lower.

The change in direction is not an arithmetic contradiction. It shows that Group A’s high extreme observation pulls its mean above Group B’s mean even though its middle observation remains lower. A careful description would report both results and note that the group comparison depends strongly on the choice of center summary. Reporting just the means would conceal the difference between the groups’ central positions; reporting just the medians would conceal how far Group A’s high value extends.

Direction Matters, Too

An extreme observation can be high or low relative to the rest of its group. A low extreme pulls the mean downward, just as a high extreme pulls it upward. This is a consequence of the mean-change formula: the sign of the change is the sign of \(M-x\). The next comparison illustrates how a low extreme can enlarge a mean difference without changing the medians in the same data.

Worked Example: A Low Extreme Value Widens a Group Gap

Suppose two hypothetical groups record net changes in units, so both positive and negative values are possible. Group A records \(20,21,22,23,24,25,26\), and Group B records \(22,23,24,25,26,27,28\). In a second version of Group A, its 20 is replaced by \(-10\).

Before the replacement. Group A has mean 23 and median 23. Its quartiles are 21 and 25, so its IQR is 4 units. Group B has mean 25 and median 25; its quartiles are 23 and 27, so its IQR is also 4 units. The mean and median differences, A minus B, are both \(23-25=-2\) units.

After the replacement. Group A’s new sum is \(-10+21+22+23+24+25+26=131\), giving a mean of \(131/7=18.71\) units. Its median remains 23, and its quartiles remain 21 and 25, so its IQR remains 4 units. The mean difference from Group B is now \(18.71-25=-6.29\) units, whereas the median difference remains \(23-25=-2\) units.

The low value pulls Group A’s mean away from Group B’s mean, making the gap based on means much larger. The medians and IQRs still describe the unchanged middle positions in this data set. This comparison is descriptive; by itself, it does not establish why the groups differ or whether the unusual observation reflects an error.

Making a Balanced Comparison

The examples suggest a practical way to describe groups when an extreme value is present. State the summaries and units, then describe what the summaries show together. A concise comparison might say that one group has a higher mean, while its median is lower, and that its standard deviation is much larger. This is more informative than selecting whichever measure supports a preferred conclusion.

The sample standard deviation and IQR also describe different aspects of spread. Standard deviation responds to the size of distances from the mean, so a distant observation can make it large. The IQR describes the width of the middle half of the ordered data and may remain stable when an extreme value lies outside that middle half. If the standard deviation is large but the IQR is modest, that contrast can signal that the overall spread is being influenced by values away from the center. It does not, by itself, explain why those values occurred.

SummaryWhat it describesTypical response to a distant observation
MeanBalance point of all observed valuesCan be pulled toward the value
Sample standard deviationSpread around the sample meanCan increase substantially because distances are squared
MedianMiddle position in ordered dataMay remain unchanged if central positions are unchanged
Interquartile rangeSpread of the middle half of the dataMay remain unchanged if the quartile positions are unchanged

A summary is not a judgment about whether an observation belongs in the data. An unusual value should not automatically be deleted just because it changes the mean or standard deviation. Doing so would alter the description of the recorded group and might hide a genuine feature. Conversely, a median that barely changes is not evidence that the unusual value is unimportant: the value may still matter to the overall range, standard deviation, or substantive interpretation. A good comparison makes the sensitivity of the summaries visible.

Common Mistakes

  • Claiming that the mean and median tell the same story. A mean includes every value and can be pulled by an extreme observation; the median is based on ordered position. Check both when an unusual value may affect the comparison.
  • Assuming the IQR can never change. It was unchanged in the worked data because the quartile positions stayed the same. In a different data set, changing a value can change its ordering or the quartiles.
  • Describing a large standard deviation as a change in the center. Standard deviation summarizes spread around the mean; it is not itself a measure of center. Report center and spread separately.
  • Deleting a value because it changes a summary. A change in the result does not show that the observation is erroneous. Summarize the data as recorded and distinguish an unusual value from a confirmed data problem.
  • Reporting a group difference without naming the summary. “Group A is higher” is incomplete if the means and medians point in different directions. State which measure is higher and include the contrasting summary when it matters.
Key takeaway: Extreme observations can strongly affect means and standard deviations because these summaries use values and distances directly. Medians and interquartile ranges often resist such changes when the middle ordered positions are unaffected. Comparing both kinds of summaries shows whether an apparent group difference is driven by the center of the data, values far from the center, or both.

Check Your Understanding

Use the examples and definitions to explain your reasoning.

  1. A value in a group is replaced by a much larger value, with the group size unchanged. What does the mean-change formula predict about the direction of the mean’s change?
  2. Why can a single distant observation have a particularly strong effect on sample standard deviation?
  3. In the first worked example, why did the median and IQR stay fixed when 15 was replaced by 40? Does that show they must always stay fixed?
  4. Two groups have different mean differences and median differences, with opposite directions. What should a clear comparison report?
  5. Why is it not justified to discard an unusual observation solely because it changes a group summary?