Regression Explorer
A regression line is a summary: one straight line standing in for a cloud of points. This explorer lets you interrogate that summary. The data below is drawn from a known true line buried under noise, so you can judge the fitted line against the truth it is trying to recover — then audit the fit with its residuals, try to drag it with a single far-away point, and finally meet four famous datasets whose summaries are identical and whose pictures are not.
How it works
The line is fitted by ordinary least squares: of all possible lines, it is the one that makes the sum of the squared residuals — each point's vertical distance from the line — as small as possible. Its slope is Sxy ÷ Sxx and its intercept places it through the centroid (x̄, ȳ), the point the line always passes through. R² is the share of y's total variation the line accounts for: R² = 1 − SSres ÷ SStot, with both sums shown in the working. For simple regression it also equals the square of the Pearson correlation.
Three honest limits, stated plainly. A high R² says the line summarises this data well — it does not say x causes y (the confounding simulator shows how a third variable fakes exactly that). The summary can be identical for data that look nothing alike, which is Anscombe's lesson: the residual view is not decoration, it is the audit. And a single point far out in x holds leverage over the line's direction out of all proportion to its count of one — the playground above prices that pull in exact numbers. The generated data is seeded (the mulberry32 generator), so every picture here is reproducible — the same runs the site's tests verify. All math runs client-side and is verified against independently computed reference values — see Software & sources.