OLS Squared-Residual Fit, Residual Plot & Anscombe's Quartet Lab
Click/drag points with visible squared residual boxes, compare confidence vs. prediction bands, and inspect all four Anscombe datasets.
Draw literal squared residuals to see what Least Squares minimizes—and load Anscombe's Quartet to prove why summary numbers never replace plotting.
Sensor calibration curves, trend forecasting, and diagnosing nonlinear patterns or high-leverage anomalies in residuals.
How do correlation and Ordinary Least Squares slope capture linear trends—and why can four radically different scatterplots share identical , , and fitted lines?
Minimizing vertical squared residuals projects orthogonally onto , yielding as explained variance fraction.
Anscombe's Quartet proves that and compress curves, leverage outliers, and clusters into the same numbers—making residual plots mandatory before trusting any fit.
What makes the OLS line the 'best' line through noisy points—and how can four wildly different scatterplots share the exact same mean, r, R², and regression equation?
Click or drag scatter points with live squared-residual boxes ∑eᵢ², inspect the residual diagnostic panel, toggle 95% confidence vs. prediction bands, and cycle through Anscombe's Quartet.
One predictor is rarely enough in real engineering. Chapter S.6.2 lifts lines into 3D planes and reveals how Ridge and Lasso tame correlated predictors.
Every straight line misses data points by a vertical gap called a residual (). Turn each gap into a literal square of area : Ordinary Least Squares (OLS) picks the unique slope and intercept that make the total inked yellow area as small as mathematically possible! Even more astonishingly, load Anscombe's Quartet below: four completely different datasets share the exact same mean, slope, , and —proving why summary statistics never replace looking at residuals.
Preparing interactive canvas & numerical solver…
wanna math drafting viewport
Pearson is unit-free tightness around a line; multiplying by converts SD-units into real -per- units! Notice the line always passes through the centroid .
Remember from ANOVA (S.5.3)? In regression, measures how much of 's vertical spread your line explains compared to predicting a flat average !
If , , , and :
A parent +2 SDs above average predicts a child only SDs above average—that's Regression Toward the Mean!
High never proves causes (hidden confounders like season can drive both ice-cream sales and sunburns), and dragging a single high-leverage corner outlier can flip a slope from negative to positive!
Real systems depend on dozens of predictors (). In S.6.2, our OLS line lifts into a 3D Plane—and we see why correlated features need Ridge () or Lasso ()!
Equating both partial derivatives forces the OLS line through centroid with standardized slope . Notice automatically produces regression to the mean!
Residuals sit strictly orthogonal to , splitting outcome variance into explained and unexplained noise—though residual plots remain mandatory (Anscombe's warning).
Uncertainty about the average line shrinks toward zero as , whereas a single future point always retains its own irreducible variance ( under the radical).
Click/drag points with visible squared residual boxes, compare confidence vs. prediction bands, and inspect all four Anscombe datasets.
Drag any point (or click empty space to add a point) and watch squared residual boxes update live.
Notice how the Confidence Band hugs the average line tightly, while the Prediction Band is much wider because one future observation carries extra noise!