Research Methods
Homoscedasticity and Residual Diagnostics
The same fictional data, twice: once as a scatterplot with a fitted line, once as residuals against fitted values. Same numbers, and they do not read the same way.
Simulated — generated data from a documented seed
Learning objective
By the end you should be able to spot non-constant residual variance and explain what it does, and does not, damage in a regression.
About 25 minutes. Nothing you do here is saved or sent anywhere.
The word for it
Homoscedasticity means the residual spread stays roughly constant across the fitted values. When the spread grows, shrinks or bulges instead, that is heteroscedasticity. Both words describe the shape of a picture.
- Answer the two prediction questions to open the laboratory.
- Fan the variance out and compare the two views of the same data.
- Read the residual spread across the low, middle and high thirds.
- Compare the classical and robust standard errors.
First, two predictions
A fictional study of a hundred and twenty people fits a straight line. The spread of the points around that line grows steadily as the predicted value rises — a classic megaphone.
The laboratory
The upper panel is the data with the fitted line. The lower panel is the same data with the line subtracted out: every point's residual against the value the model predicted for it. Nothing has been added; a systematic pattern has been made flat so that departures from it show up.
Need a hand?
Nothing here changes the controls for you, and none of it says what you are going to find.
Key terms
- Fitted value
- What the line predicts for an observation. It is the horizontal axis of the lower panel.
- Residual
- How far one observation fell from the line: observed minus fitted. One residual per person in the study.
- Residual variance
- How widely the residuals are spread out. This activity varies it deliberately, using the menu at the top of the controls.
- Homoscedasticity
- The residual spread stays roughly constant across the fitted values. It is one of the assumptions the standard errors in a regression output rest on.
- Heteroscedasticity
- The residual spread changes with the fitted value — the fan or megaphone shape. The same word covers spread that grows, shrinks, or bulges in the middle.
- Standard error
- How much the estimated slope would move about from one sample to the next. It is what turns an estimate into a confidence interval and a test.
Two views of one dataset
The true slope is fixed at 0.50. The controls change only the spread around it.
Two views
| Region of the fitted values | Residual SD |
|---|
No convention sets a ratio at which a fan becomes a problem. What matters is whether the extra spread sits where the line is most sensitive to it — which is what the two standard errors show.
What the diagnostic is saying
What it costs: intervals, tests and coverage
| Quantity | Classical | Robust |
|---|
Challenge — read four residual plots
Four fictional studies, each shown as residuals against fitted values. Say what each one shows.
What this demonstrates
Subtracting the model is what makes the pattern visible
Homoscedasticity means that the spread of the outcome around the line is roughly the same wherever you stand on the line. In the raw scatterplot that spread is competing with the slope for your attention: the cloud is tilted, so it is hard to tell whether it is also widening. Plotting residuals against fitted values removes the tilt by construction, leaving a band that should look like the same thickness all the way across. Everything that is left in that picture is something the model did not account for.
Against fitted values, not against the outcome
The horizontal axis matters. Residuals plotted against the observed outcome are correlated with it by construction — a large y tends to produce a large positive residual — so that plot shows a slope even when the model is perfect. Fitted values, by contrast, are uncorrelated with the residuals in any least-squares fit, so the flat band is the honest baseline and any departure from it is real information.
The estimate survives; the uncertainty does not
Ordinary least squares stays unbiased under non-constant variance: run the study many times and the average slope still lands on the truth, which is why the coefficient barely moves as you drag the severity. What breaks is the formula for its standard error, which assumes one common variance and quietly gets the wrong answer when there is not one. The interval and the test built on it inherit that error while looking entirely ordinary on the output.
How much it costs depends on where the extra spread sits. The classical formula goes wrong to the extent that the variance lines up with leverage, which is largest at the two extremes of the predictor.
Variance concentrated at both ends makes the classical 95% interval far too narrow: it covers the truth about 86% of the time here. A plain megaphone puts the extra variance at one extreme and the least at the other, so the two partly cancel and coverage lands nearer 93%. Variance concentrated in the middle makes the interval conservative instead — about 99% coverage, which costs power rather than credibility.
The heteroscedasticity-consistent standard error stays near its nominal level in all four cases, and costs almost nothing when the variance turns out to be constant after all.
A plot is a diagnostic, not a verdict
Reading residual plots is a skill, and a fallible one: two competent readers routinely disagree about the same picture, and small samples produce fan shapes and curves out of nothing at all. Formal tests do not settle it either, because their sensitivity depends on the sample size — a trivial departure will be flagged in a large study and a serious one missed in a small one. The reasonable practice is to look at the plot, say what you saw, report standard errors that do not assume the thing you are unsure about, and let the reader see both.
For teaching elsewhere: take this activity as one self-contained block of HTML, on the clipboard or as a file. Either way it is styled so that it will not disturb the page you put it into.