← All topics

Regression Diagnostics

Click empty space to add a point, drag a point to move it, double-click a point to remove it. All four diagnostic plots below update live and share the same simulated dataset — drag a point far from the cloud and watch its leverage and Cook's distance grow. Points turn red when their Cook's distance exceeds 4/n, a common rule-of-thumb threshold for flagging unusually influential observations — the same points are flagged in the stats line and stand out on the Residuals vs. Leverage plot. Each violation below is a severity slider rather than an on/off toggle, since real data is rarely a clean-cut case — turn one up gradually and watch the corresponding diagnostic plot develop the pattern it's meant to detect.

n = 0  |  slope = –  |  intercept = –  |  flagged points (Cook's D > 4/n) = 0
How standardized residuals, leverage, and Cook's distance are calculated

For the n points currently on the plot, let eᵢ = yᵢ − ŷᵢ be the raw residual for point i, and let σ̂ = √SSE / (n − 2) be the residual standard error, where SSE = Σᵢeᵢ².

Leverage hᵢ measures how far xᵢ sits from the center of the x's, where SSX = Σⱼ(xⱼ − x̄)²:

hᵢ = 1/n  +  (xᵢ − x̄)² / SSX

Standardized residual rᵢ rescales eᵢ by its own estimated standard deviation, which shrinks as leverage grows:

rᵢ = eᵢ / (σ̂·√1 − hᵢ)

Cook's distance Dᵢ combines the standardized residual and leverage into a single influence measure (p = 2 parameters: intercept and slope):

Dᵢ = (rᵢ² / p) · (hᵢ / (1 − hᵢ))

Residuals vs. Fitted

Normal Q-Q

Histogram of Standardized Residuals

Residuals vs. Leverage (Cook's distance)