hanegreefs.com/ statistics II
Home / Chapters / 10
Chapter 10 · Course ch. 17

Understanding residuals

Outliers, leverage, influence, autocorrelation and transformations.

About 15 min read · Lecture material: HOC 10

Priority labels: ImportantNeutralLess important show where to spend revision time.

Where this chapter fitsNeutral

Chapter 8 described a line, chapter 9 made inference on it, and this chapter asks what if the conditions are not true? The answer lives in the residuals. Skepticism is the point: plot the residuals, look for the story they tell, and decide whether to refine, split or transform before reporting anything.

Subgroups hiding in the residualsImportant

A residual plot can reveal clusters that behave differently — two product lines, two regions, before and after a policy. When the data are really several populations pooled together, one common line misleads. Look for subgroups, and consider fitting separate models when it makes substantive sense. Identifying the groups often explains the data better than the model does.

ExtrapolationNeutral

Prediction outside the observed x range assumes the straight-line story continues. The further x_v is from x̄, the less certain ŷ is; with time as x, forecasting far ahead is especially risky. In the sales example, a 10 k€ budget (the data stop at 8) gives ŷ ≈ 30.6, but nothing in the data says returns do not flatten out beyond 8.

Unusual points: outlier, leverage, influenceImportant

TermMeaning (as defined in this course)Typical diagnostic
OutlierLarge residual: far from the line verticallyResidual plot
High-leverage pointExtreme x: far from x̄ horizontallyScatterplot
Influential pointRemoving it changes the line, mainly the slope b₁, noticeablyRefit with and without it
  • An outlier or a leverage point may or may not be influential.
  • A point that is both high-leverage and off the trend is typically influential.
  • Influential points can hide: because they pull the line towards themselves, their residuals may look small. Use the scatterplot, not just the residual plot, to find leverage.
  • Even a non-influential outlier or leverage point can alter r and R².
  • Cook's distance combines leverage and residual size into one flag (values above 1, or above 4/n as a stricter rule, deserve a look).
Location of the pointLeverageResidualInfluential?
Off the line, x near x̄LowLargeRarely
On the line, x far from x̄HighSmallRarely (it may even improve the fit)
Off the line, x far from x̄HighLarge (or deceptively moderate)Yes, strongly

What to do: never delete silently. Report the model with and without the point, investigate whether it is an error, and note when a leverage point is a sign that the relationship is really non-linear. The regression lab lets you drag an extra point around and watch b₁, r and R² respond.

Working with summary valuesNeutral

Averages (monthly means, city means) vary less than the raw observations they summarise. A regression on summaries therefore shows less scatter, a higher r and R² and apparent certainty that the individual-level data would not support. Be suspicious of such results; where possible work with the underlying cases.

Autocorrelation and the Durbin–Watson testImportant

In time-ordered data, neighbouring errors are often related (first-order autocorrelation: adjacent values; second-order: every other one). That breaks the independence condition and makes standard errors and p-values unreliable. Plot the residuals in time order, then quantify the problem with the Durbin–Watson statistic:

Formula
D = Σₜ₌₂ⁿ (eₜ − eₜ₋₁)² / Σₜ₌₁ⁿ eₜ², 0 ≤ D ≤ 4
D close toMeaning
2No autocorrelation
Below 2Positive autocorrelation (neighbours move together)
Above 2Negative autocorrelation (neighbours alternate)

Compare D with the table values d_L and d_U, which depend on n and the number of predictors k (here always 1). Positive autocorrelation: D < d_L → evidence; d_L ≤ D ≤ d_U → inconclusive; D > d_U → no evidence. For negative autocorrelation use 4 − D (equivalently D > 4 − d_L → evidence).

Worked example

Computing D by hand

Eight residuals in time order: 1.2, 0.9, 0.5, −0.2, −0.8, −1.1, −0.6, 0.1.

1

Numerator: squared successive changes

0.09 + 0.16 + 0.49 + 0.36 + 0.09 + 0.25 + 0.49 = 1.93
2

Denominator: squared residuals

1.44 + 0.81 + 0.25 + 0.04 + 0.64 + 1.21 + 0.36 + 0.01 = 4.76
3

Statistic

D = 1.93 / 4.76 ≈ 0.41
Answer

D is far below 2, which signals strong positive autocorrelation: the residuals drift in long runs rather than jumping randomly. Slope tests from this model would not be trustworthy.

Remedies: model the errors with time-series methods, find a predictor that explains the time pattern, or sample the series at wider intervals so values are further apart in time (this helps first-order dependence but not necessarily higher orders).

Re-expressing the dataImportant

No rule says x and y must be used in their raw units. A transformation can reach four goals: make a skewed variable more symmetric, make the spread of several groups alike, straighten a curved scatterplot, and make the scatter even across x instead of fanning out. After transforming, recheck the conditions on the new scale.

Model on the transformed scaleTypical situation
log(y) against xy grows by a roughly constant percentage per unit of x; fan-shaped residuals
y against log(x)y keeps growing but with diminishing returns
log(y) against log(x)power-law relation; both variables right-skewed
−1/y against xan upward bend in negatively correlated data

The ladder of powers

A convenient ordered menu: x², x (no change), √x, log x, −1/√x, −1/x. Moving down the ladder pulls in a long right tail and bends upward-curving scatterplots towards straight; moving up does the opposite. Try a step, recheck the plot, and repeat. In the lab, load the "curved" data set and watch the residual pattern disappear after taking logs.

Regression sanity routineImportant

  1. Scatterplot: form, outliers, groups, equal spread.
  2. Fit the line and save residuals.
  3. Residuals against order (time) → independence.
  4. Residuals against fitted values → linearity and equal variance.
  5. Histogram or Normal plot of residuals → Normality (only after 1–4 pass).
  6. Re-fit without influential points; compare slopes.
  7. Transform if needed and repeat; state the final model with its limits.
fit <- lm(y ~ x, data = d) plot(fitted(fit), resid(fit)); abline(h = 0) # linearity, equal spread plot(resid(fit), type = "b") # order / autocorrelation qqnorm(resid(fit)); qqline(resid(fit)) # Normality cooks.distance(fit) # influence fit2 <- lm(log(y) ~ x, data = d) # after a log transform

On the TI-84 LinRegTTest stores the residuals in the list RESID; plot them against L1 (or a 1,2,3… index list) with STAT PLOT. There is no Durbin–Watson or Cook's-distance command, so compute D by hand and judge influence by refitting.

Key takeaways

  • Outlier = large residual; leverage = extreme x; influential = changes the slope when removed. Leverage points can hide in residual plots.
  • Autocorrelation violates independence; D ≈ 2 is fine, D well below 2 means positive autocorrelation.
  • Transform (log, roots, reciprocals) to straighten, equalise spread or symmetrise — then recheck everything.
Question
Tap or press space to reveal
Answer
Did you know it?

Multiple choice

Ch 10 · Question 1

A high-leverage point has…

Why: Far from x̄.
Ch 10 · Question 2

Which point is most likely influential?

Why: Both leverage and residual.
Ch 10 · Question 3

A Durbin–Watson D of 0.4 suggests…

Why: D well below 2.
Ch 10 · Question 4

Residuals fanning out as fitted values grow suggest…

Why: Unequal variance often fixed by a log.
Ch 10 · Question 5

Regression on monthly averages tends to…

Why: Averages vary less.
Ch 10 · Question 6

The ladder of powers: moving down from x to log x…

Why: Down the ladder reduces right skew.
Ch 10 · Question 7

Best response to a suspicious influential point?

Why: Transparent sensitivity analysis.
Ch 10 · Question 8

Extrapolating a time trend far into the future is risky because…

Why: Trends change.

Exam-style questions

Exam-style · Ch 10

A regression of monthly sales on time gives residuals that stay positive for several months and then negative for several months. Diagnose and propose remedies.

Show outline of a full answer
  1. Pattern → positive autocorrelation (D < 2).
  2. Violates independence; SEs too small; p-values over-optimistic.
  3. Test with Durbin–Watson vs d_L, d_U.
  4. Remedies: time-series model, add explanatory predictors, longer intervals.
Exam-style · Ch 10

Distinguish outlier, leverage point and influential point, and explain how to treat each in practice.

Show outline of a full answer
  1. Outlier: large residual. Leverage: extreme x. Influential: changes b₁ when removed.
  2. Leverage and outlier together → influential.
  3. Refit with/without; report both.
  4. Investigate cause (error vs real) before deciding.

Influence and transformation labInteractive

Add a far-away point to see leverage and influence; load curved data and try a log transform.