Tutorials › Introduction to Statistics › Finding Outlying and Influential ANOVA Residuals

Multiple Comparisons and ANOVA Assumptions · Tutorial 887 of 996

Finding Outlying and Influential ANOVA Residuals

Use residuals to spot unusual observations, measure their influence on ANOVA group means, and assess how a flagged observation changes the analysis.

Intermediate 10 min read

What You'll Learn

  • Define one-way ANOVA residuals and distinguish unusual residuals from influential observations.
  • Calculate internally and externally studentized residuals and interpret their limits.
  • Measure exactly how deleting an observation changes its group mean.
  • Refit an ANOVA after deletion and compare the results transparently.
  • Recognize why small groups and multiple diagnostic checks require care.

Why Look Beyond the ANOVA F Statistic?

An ANOVA result summarizes differences among group means relative to variation within groups. But a single observation can be unusual compared with the other observations in its group, or can have a disproportionate effect on that group's mean. Those are related but distinct concerns: an observation may have a large residual without substantially changing a mean, or may affect a mean enough to alter the analysis. Diagnostics help identify these cases; they do not, by themselves, justify removing data.

The one-way ANOVA model assumes independent errors, normally distributed errors within each group, and a common error variance across groups. In symbols, an observation in group \(i\) is modeled as \(Y_{ij}=\mu_i+\varepsilon_{ij}\), where the errors have mean 0 and variance \(\sigma^2\). These assumptions are about the errors around the group means, so residuals are the relevant quantities to inspect. Independence must be judged from the study design, not established by a residual plot.

Definition: In one-way ANOVA, the residual for observation \(j\) in group \(i\) is \(e_{ij}=y_{ij}-\bar{x}_i\), where \(y_{ij}\) is the observed response and \(\bar{x}_i\) is the sample mean of group \(i\). A residual describes how far an observation lies from its fitted group mean. An outlying residual is unusually large relative to the within-group error variation. An influential observation is one whose inclusion or removal substantially changes a fitted quantity or analysis, such as a group mean or the ANOVA result.

Residuals and Studentized Diagnostics

Let \(n_i\) be the number of observations in group \(i\), \(N\) the total number of observations, and \(k\) the number of groups. The within-group sum of squares is \(SSE=\sum_i\sum_j e_{ij}^2\), and the pooled estimate of error variance is \(MSE=SSE/(N-k)\). The standard deviation of a raw residual is not simply \(\sqrt{MSE}\): fitting the group mean constrains the residuals within each group to sum to zero. In fact, the residual variance for an observation in group \(i\) is \(\sigma^2(1-1/n_i)\).

Dividing a residual by an estimated standard deviation puts it on a scale that is easier to compare across observations. An internally studentized residual uses the full-data \(MSE\). An externally studentized, or deleted, residual uses an error variance estimate from a refit that omits the observation. The latter can be especially useful because an extreme observation can inflate the full-data \(MSE\), making its own internally studentized residual look less unusual.

Definition: The internally studentized residual is \(r_{ij}=e_{ij}/\sqrt{MSE(1-1/n_i)}\). When \(n_i\ge 2\), deleting observation \(j\) leaves all \(k\) groups represented. Let \(MSE_{(-ij)}\) be the pooled error mean square after that deletion. The externally studentized residual is \(t_{ij}=e_{ij}/\sqrt{MSE_{(-ij)}(1-1/n_i)}\). Under the normal, equal-variance one-way ANOVA model, this deleted residual has a \(t\) distribution with \(N-k-1\) degrees of freedom when the model is refitted without that observation.

A studentized residual is a diagnostic, not a verdict. Values with large absolute magnitude merit investigation, but there is no universal cutoff that makes an observation an outlier in every setting. When many observations are checked, some large residuals can occur by chance. Consider the plot, the data-collection process, units, and possible recording errors; do not use a numerical flag as an automatic deletion rule.

Worked Example: Calculating a Deleted Residual

Suppose a hypothetical experiment records responses in three groups: A has 8, 9, and 15; B has 12, 13, and 14; C has 15, 16, and 17. Examine the observation 15 in group A. All groups have at least two observations, so deleting it leaves all three groups represented.

The group means are \(\bar{x}_A=32/3=10.667\), \(\bar{x}_B=13\), and \(\bar{x}_C=16\). The residual for the selected observation is \(e=15-10.667=4.333\). The sum of squared residuals in A is \((8-10.667)^2+(9-10.667)^2+(15-10.667)^2=28.667\). Groups B and C each have a sum of squared residuals of 2. Thus \(SSE=32.667\), and with \(N=9\) and \(k=3\), \(MSE=32.667/(9-3)=5.444\).

The internally studentized residual is

$$ r=\frac{4.333}{\sqrt{5.444(1-1/3)}}=2.275. $$

To calculate the deleted diagnostic, omit 15 and refit A's mean using 8 and 9. The new mean is 8.5; the remaining within-group sum of squares for A is \(0.5\). The B and C sums of squares remain 2 each, giving \(SSE_{(-ij)}=4.5\). There are \(8-3=5\) error degrees of freedom, so \(MSE_{(-ij)}=4.5/5=0.9000\). Therefore

$$ t_{ij}=\frac{4.333}{\sqrt{0.9000(1-1/3)}}=5.594. $$

Under the stated normal, equal-variance model, this is compared with a \(t\) distribution with 5 degrees of freedom. It is a conspicuous residual in this hypothetical data set, but the value alone does not tell us whether the observation is an error or whether it should be excluded.

How Deletion Changes a Group Mean

The effect of deleting an observation on its own group's mean has an exact, simple formula. Write \(\bar{x}_i\) for the original mean and \(\bar{x}_{i(-j)}\) for the mean after deleting \(y_{ij}\). Provided \(n_i\ge 2\), the deleted mean is the average of the other \(n_i-1\) observations:

$$ \bar{x}_{i(-j)}=\frac{n_i\bar{x}_i-y_{ij}}{n_i-1}. $$

Subtracting this from the original mean gives the change. Since \(e_{ij}=y_{ij}-\bar{x}_i\), the size and direction of that change are determined by the residual and group size.

$$ \bar{x}_i-\bar{x}_{i(-j)} =\bar{x}_i-\frac{n_i\bar{x}_i-y_{ij}}{n_i-1} =\frac{y_{ij}-\bar{x}_i}{n_i-1} =\frac{e_{ij}}{n_i-1}. $$

The deleted mean moves away from the observation: if \(e_{ij}\) is positive, removing the observation lowers the group mean. For the same residual, a smaller group has a larger change in its mean. This explains why residual size and influence should not be treated as interchangeable: the mean's sensitivity also depends on \(n_i\).

Worked Example: Comparing Mean Influence Across Group Sizes

Consider two hypothetical groups. In the first, \(n_i=3\) and an observation has residual \(e_{ij}=4\). In the second, \(n_i=9\) and an observation also has residual \(e_{ij}=4\). For both groups, suppose the observation lies above its group mean.

For the group of three, the original mean exceeds the mean after deletion by

$$ \bar{x}_i-\bar{x}_{i(-j)}=\frac{4}{3-1}=2. $$

For the group of nine, the corresponding change is

$$ \bar{x}_i-\bar{x}_{i(-j)}=\frac{4}{9-1}=0.5000. $$

The residual is equally large in the two cases, but the observation shifts the smaller group's mean by more. This calculation measures the direct effect on the group mean; a full refit is still needed to determine the effect on the ANOVA test or on comparisons between groups.

Refitting the ANOVA After a Flag

A useful influence check is to calculate the ANOVA using all valid observations, then refit it after temporarily omitting a flagged observation. Compare group means, \(SSE\), \(MSE\), degrees of freedom, and the F statistic. If the analysis includes post hoc comparisons, those too may change and must be recalculated under the chosen procedure. A changed result is evidence that the observation matters to the analysis; it is not, on its own, a reason to discard it.

The deletion formula for \(SSE\) can also be derived directly. Within group \(i\), the residuals sum to zero. After deleting \(y_{ij}\), each remaining residual from the new group mean is \(e_{i\ell}+e_{ij}/(n_i-1)\). Squaring and summing over the other observations, using \(\sum_{\ell\ne j}e_{i\ell}=-e_{ij}\), gives

$$ SSE_{i(-j)} =\sum_{\ell\ne j}\left(e_{i\ell}+\frac{e_{ij}}{n_i-1}\right)^2 =SSE_i-\frac{n_i}{n_i-1}e_{ij}^2. $$

The other groups' sums of squares do not change. Thus, for a deletion that leaves every group represented, \(SSE_{(-ij)}=SSE-\frac{n_i}{n_i-1}e_{ij}^2\). The refitted model has \(N-1\) observations and still estimates \(k\) group means, so its error degrees of freedom are \(N-k-1\). This derivation, and the deleted-mean formulas above, require \(n_i\ge2\). If the observation is the only one in its group, deleting it removes that group, and these formulas and degrees of freedom do not apply.

Worked Example: Assessing an Observation's Effect on the F Statistic

Use a second hypothetical data set: A has 4, 5, and 6; B has 7, 8, and 9; C has 10, 11, and 18. The unusually high observation 18 is in a group with three observations, so deleting it leaves all three groups represented.

With all observations, the means are 5, 8, and 13, and the grand mean is \(78/9=8.667\). The between-group sum of squares is \(SSB=3[(5-8.667)^2+(8-8.667)^2+(13-8.667)^2]=98\). The within-group sum of squares is \(SSE=2+2+38=42\). Therefore \(df_{\text{between}}=k-1=2\), \(df_{\text{error}}=N-k=6\), and \(MSE=42/6=7\). The F statistic is

$$ F=\frac{SSB/(k-1)}{MSE}=\frac{98/2}{7}=7.000. $$

Now omit 18 and refit. The group means are 5, 8, and 10.5; the grand mean is \(60/8=7.5\). The refitted between-group sum of squares is \(SSB_{(-ij)}=3[(5-7.5)^2+(8-7.5)^2]+2(10.5-7.5)^2=37.5\). The within-group sum of squares is \(2+2+0.5=4.5\), so \(MSE_{(-ij)}=4.5/(8-3)=0.9000\). The refitted statistic is

$$ F_{(-ij)}=\frac{37.5/2}{0.9000}=20.83. $$

Here deleting 18 makes the F statistic larger, even though it reduces the group C mean substantially. The observation inflates within-group variation and changes the between-group calculation as well. The direction and size of an observation's effect on F are not determined by its residual alone; they require the actual refit.

Interpreting and Reporting Flags

A careful diagnostic workflow separates three questions: Is the observation unusual relative to its fitted group mean? Does removing it materially change the fitted means or inferential results? Is there a defensible, documented reason to correct or exclude it? Possible reasons include a verified recording or measurement error, but an inconvenient result or a large residual is not sufficient justification. If a value is valid, the primary analysis should ordinarily retain it, with a clearly described sensitivity analysis when its influence is important.

When reporting a sensitivity analysis, state the reason the observation was flagged, how it was handled, and how the conclusions differed with and without it. Do not present only the version that supports a preferred conclusion. If an observation is removed because a value was verified to be erroneous, describe the correction or exclusion and report the analysis based on the corrected data. If it remains a valid observation, make clear which analysis is primary and which is the sensitivity check.

Common mistake: “The studentized residual is large, so the observation must be deleted.” A large residual signals a case to investigate; it does not establish that the measurement is wrong or that deletion is appropriate. Check the source data and study context, quantify the effect of deletion, and report sensitivity transparently. Also remember that a singleton group has no within-group residual information: removing its sole observation eliminates that group, rather than producing the usual deleted-mean diagnostic.
Key takeaway: Residual size measures how unusual an observation is relative to its group; influence measures how much it changes the fitted analysis. Use both ideas, respect the conditions for deletion calculations, and never turn a diagnostic flag into an automatic data-removal rule.

Check Your Understanding

Try these questions without looking back.

  1. In one-way ANOVA, what does the residual \(e_{ij}\) measure, and why is a residual different from the raw observation?
  2. An observation has residual 3 in a group of size 4. By how much does the original group mean exceed the mean after deleting that observation?
  3. Why can a deleted residual be more revealing than an internally studentized residual when an observation inflates the full-data \(MSE\)?
  4. What changes about the refitted model if the observation being deleted is the only observation in its group?
  5. If removing a valid observation changes the ANOVA conclusion, what should be reported about the full-data and deletion analyses?