wanna mathMath ain't scary (not anymore)
4-Tier Textbook Index • Vol → Mod → Ch → Lab

Engineering Mathematics Volumes I–VI

6 Volumes • 20 Modules • 85 ChaptersFull Matrix →
4-Tier Statistics Index • Vol S → Mod → Ch → Lab

Interactive Statistics (S.1–S.6)

6 Modules • 18 ChaptersStatistics Index →
CHAPTER S.6.1 • 2DPublished Interactive Labs~30 min study

Correlation (r), OLS Linear Regression, R² & Anscombe's Quartet

Draw literal squared residuals to see what Least Squares minimizes—and load Anscombe's Quartet to prove why summary numbers never replace plotting.

Engineering & Physical Application Context

Sensor calibration curves, trend forecasting, and diagnosing nonlinear patterns or high-leverage anomalies in residuals.

Governing Mathematical Formulation
b1=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2=rsysx,R2=r2b_1 = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2} = r\frac{s_y}{s_x}, \qquad R^2 = r^2
Volume S • Module S.61 Interactive Lab(s)

The Question You Should Ask

How do correlation rr and Ordinary Least Squares slope b1=r(sy/sx)b_1 = r(s_y/s_x) capture linear trends—and why can four radically different scatterplots share identical rr, R2R^2, and fitted lines?

In Simple Words & Math

Minimizing vertical squared residuals ∑(yi−b0−b1xi)2\sum (y_i - b_0 - b_1 x_i)^2 projects y\mathbf{y} orthogonally onto span⁡(1,x)\operatorname{span}(\mathbf{1}, \mathbf{x}), yielding R2=r2=1−SSE/SSTR^2 = r^2 = 1 - \text{SSE}/\text{SST} as explained variance fraction.

Anscombe's Quartet proves that rr and R2R^2 compress curves, leverage outliers, and clusters into the same numbers—making residual plots mandatory before trusting any fit.

4-Step Pedagogical Chapter Rhythm • Geometric Intuition First
Ch. S.6.1
STEP 1 • GEOMETRIC QUESTION

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?

STEP 2 • INTERACTIVE LAB EXPLORATION

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.

STEP 3 • SYMBOLIC FORMALIZATION
y^=b0+b1x,b1=rsysx,R2=1−SSESST\hat{y} = b_0 + b_1 x, \quad b_1 = r\frac{s_y}{s_x}, \quad R^2 = 1 - \frac{\text{SSE}}{\text{SST}}
STEP 4 • EDGE CASES & NEXT BRIDGE

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.

Interactive Laboratories in Chapter S.6.1
FIRST-TIMER GUIDE • LINEAR TREND FITTING & VISUAL DIAGNOSTICS

Drawing Literal Residual Squares: What Least Squares Minimizes—And Why Anscombe's Quartet Demands Plotting

Every straight line misses data points by a vertical gap called a residual (ei=yi−y^ie_i = y_i - \hat{y}_i). Turn each gap into a literal square of area ei2e_i^2: 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, r=0.816r = 0.816, and R2=66.7%R^2 = 66.7\%—proving why summary statistics never replace looking at residuals.

Initializing Interactive Laboratory
LOADING MODULE

Preparing interactive canvas & numerical solver…

wanna math drafting viewport

Slope vs. Correlation (b1b_1 vs. rr), Variance Explained (R2R^2) & Regression Toward the Mean

1. CORRELATION r VS. OLS SLOPE b₁
b1=r sysx,b0=yˉ−b1xˉb_1 = r\,\frac{s_y}{s_x}, \qquad b_0 = \bar{y} - b_1\bar{x}

Pearson r∈[−1,1]r \in [-1, 1] is unit-free tightness around a line; multiplying by sy/sxs_y / s_x converts SD-units into real yy-per-xx units! Notice the line always passes through the centroid (xˉ,yˉ)(\bar{x}, \bar{y}).

2. PROPORTION OF VARIANCE EXPLAINED (R²)
R2=1−SSESST=r2R^2 = 1 - \frac{\text{SSE}}{\text{SST}} = r^2

Remember SST=SSB+SSW\text{SST} = \text{SSB} + \text{SSW} from ANOVA (S.5.3)? In regression, R2R^2 measures how much of yy's vertical spread your line explains compared to predicting a flat average yˉ\bar{y}!

3. TINY WORKED SLOPE & REGRESSION CHECK

If r=0.60r = 0.60, sx=4s_x = 4, sy=10s_y = 10, and (xˉ,yˉ)=(10,50)(\bar{x}, \bar{y}) = (10, 50):

b1=0.60×104=1.50  ⟹  y^(14)=50+1.5(4)=56b_1 = 0.60 \times \frac{10}{4} = 1.50 \implies \hat{y}(14) = 50 + 1.5(4) = 56

A parent +2 SDs above average predicts a child only r×2=+1.2r \times 2 = +1.2 SDs above average—that's Regression Toward the Mean!

TRAP • CORRELATION ≠ CAUSATION & EXTRAPOLATION

High rr never proves xx causes yy (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!

BRIDGE TO S.6.2 • MULTIPLE PREDICTORS IN 3D & REGULARIZATION

Real systems depend on dozens of predictors (x1,x2,…x_1, x_2, \dots). In S.6.2, our OLS line lifts into a 3D Plane—and we see why correlated features need Ridge (L2L_2) or Lasso (L1L_1)!

Linear Modeling • Ch. S.6.1

Calculus Derivation of OLS Slope, Regression to the Mean & Prediction Intervals

Open OLS Formulas →
1. MINIMIZING SQUARED RESIDUALS
∂SSE∂b0=0  ⟹  b0=yˉ−b1xˉ;∂SSE∂b1=0  ⟹  b1=rsysx\frac{\partial \text{SSE}}{\partial b_0}=0 \implies b_0 = \bar{y}-b_1\bar{x}; \qquad \frac{\partial \text{SSE}}{\partial b_1}=0 \implies b_1 = r\frac{s_y}{s_x}

Equating both partial derivatives forces the OLS line through centroid (xˉ,yˉ)(\bar{x}, \bar{y}) with standardized slope zy=r zxz_y = r\,z_x. Notice ∣r∣<1|r| < 1 automatically produces regression to the mean!

2. ORTHOGONALITY & R² = r² GEOMETRY
∑i=1nei=0,∑i=1nxiei=0  ⟹  SST=SSR+SSE\sum_{i=1}^{n} e_i = 0, \qquad \sum_{i=1}^{n} x_i e_i = 0 \implies \text{SST} = \text{SSR} + \text{SSE}

Residuals ei=yi−y^ie_i = y_i - \hat{y}_i sit strictly orthogonal to xix_i, splitting outcome variance into explained R2=SSR/SSTR^2 = \text{SSR}/\text{SST} and unexplained noise—though residual plots remain mandatory (Anscombe's warning).

3. CONFIDENCE BAND VS. PREDICTION BAND
Var⁡(ynew−y^0)=σ2+σ2(1n+(x0−xˉ)2Sxx)\operatorname{Var}(y_{\text{new}} - \hat{y}_0) = \sigma^2 + \sigma^2\left(\frac{1}{n}+\frac{(x_0-\bar{x})^2}{S_{xx}}\right)

Uncertainty about the average line shrinks toward zero as n→∞n \to \infty, whereas a single future point ynewy_{\text{new}} always retains its own irreducible variance σ2\sigma^2 (+1+1 under the radical).

Chapter S.6.1 Laboratory Specifications

1 Interactive Lab(s)
LAB S.6.1.1Component: OLSRegressionAnscombeLab

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.

min⁡b0,b1∑i=1n(yi−(b0+b1xi))2\min_{b_0,b_1} \sum_{i=1}^{n}(y_i - (b_0 + b_1 x_i))^2