Skip to content
All apps

Regression diagnostics

About this app

Residual plots, leverage and Cook's distance on the lecture datasets and Anscombe's quartet – one wrong measurement tilts the line.

The statistics

Regression diagnostics check whether a straight line is a sensible model of the data and whether individual points dictate it. The coefficient of determination R² answers neither question. The residual eᵢ = yᵢ − ŷᵢ is the vertical distance to the line, and the standard error is s² = Σeᵢ²/(n − 2). The leverage hᵢ = 1/n + (xᵢ − x̄)²/Σ(xⱼ − x̄)² depends only on x and is large for points at the edge. Cook’s distance Dᵢ combines residual and leverage and measures how much all predictions change when point i is left out.

What you see

The scatter plot shows data points and the regression line, each point with a halo proportional to its Cook’s distance. Below sits a residual plot with optional smoothing. Data sets include lecture examples (a DC motor, the same data with a typo, mortgage rates and construction orders), the four Anscombe sets, a funnel with growing spread and an empty canvas for your own points. A diagnosis panel reports R², s and n and checks influence, curvature and funnel shape. For a clicked point the app works out leverage and Cook’s distance with the numbers filled in.

Things to try

Load the motor data and then the version with a typo, where 7 instead of 70 hp was recorded: a single point tilts the line and its Cook’s distance spikes. Switch on the line without that point to see its influence directly. Compare Anscombe II and IV: the same R², but one shows curvature in the residual plot and the other a point with leverage h = 1. In the funnel data set the spread grows with x. The tools let you drag, place and delete points.

Frequently asked questions

What is Cook’s distance?
Cook’s distance measures the influence of a single data point on a regression. It compares the predictions with and without that point, combining residual and leverage. As a rough guide, values above 0.5 are worth a look and values above 1 indicate strong influence.
What is leverage in regression?
Leverage hᵢ shows how far a point lies from the mean x̄ in the x direction, and therefore how strongly it can pull the line towards itself. It depends only on the x values, not on y. A point with high leverage and a large residual has a large influence.
Why is R² not enough to judge a regression?
R² only states what share of the variation in y the line explains. It shows neither whether a linear relationship fits at all nor whether single points drive the result. Anscombe’s quartet has almost the same R² four times over with completely different data; residual plots and influence measures reveal the difference.
Which data sets are in the regression diagnostics app?
It includes a DC motor (power against speed), the same data with a decimal error, mortgage rates and construction orders, the four Anscombe sets, a simulated funnel with heteroscedasticity and an empty canvas for your own points.

Subject: Statistics

More from Statistics

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps