Interactive statistics

56 free interactive lessons: from mean and median to A/B tests and Bayes. Drag the charts and build intuition. No sign-up.

Module 7: Relationships & regression

Regression assumptions and residual analysis

Regression can be computed on any data — the button won't ask whether a straight line is appropriate. But the coefficients and their "significance" are honest only if the assumptions hold. You check them not by r itself but by the RESIDUALS — the line's misses. Drag the points and watch the residuals.

residual = 0x →residual
The residuals are a structureless cloud around zero. A straight line is appropriate.

A good regression leaves the residuals as structureless noise around zero. Any pattern in the residuals is a signal the line cannot be trusted, whatever the R². That is why this chart is always checked after a regression.

A residual is the model's miss (actual minus predicted). The main diagnostic tool is the plot of residuals against x. In the "all fine" mode they form a structureless cloud around zero: the straight line is appropriate. Any pattern in the residuals is a signal the model cannot be trusted, whatever the R².

What it means

The working ritual: computed a regression — plotted the residuals. An arc → the relationship is nonlinear. A fan → heteroscedasticity. A lone distant point → check its influence. Only after that do you read the coefficients and their significance.

A high R² does not save you from broken assumptions: a model can fit well on average while giving wrong intervals and a deceptive slope. The residual picture is more honest than a single number.

Where it shows up

Economic and financial data are almost always heteroscedastic and time-dependent — which is why robust standard errors and dedicated time-series models are the default there.

In product data nonlinearity is everywhere (saturation, thresholds), so blind linear regression often understates or distorts the relationship — a look at the residuals and transformations save the day.

Definitions
Residuals
the model's misses (actual − predicted). Their structure tells whether the model is fit for the data.
Linearity
the relationship is close to a straight line; a violation shows as an arc/bend in the residuals.
Homoscedasticity
constant spread of residuals across the range of x; a "fan" means heteroscedasticity.
Influential observation
a point (often at the edge in x) that strongly changes the coefficient estimates.
When the method lies (assumptions)

Residual diagnostics themselves assume you have enough data for structure to be visible; on a handful of points a pattern in the residuals is hard to spot.

Fixing one violation (say, a log transform for heteroscedasticity) changes how the coefficients read — they are now about percentages, not absolute units.

Next →
Enjoying the materials?

This site is built by the DataSlice Telegram channel: data analytics in plain words — real cases, metrics, careers. The channel is in Russian.

Open the Telegram channel