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 →
FORMULA SHEET • MODULE S.63 Reference Sections

OLS Regression, Regularization (Ridge/Lasso), Bayesian Updating & Bootstrap

Pearson correlation, Simple OLS normal equations and R², Confidence vs. Prediction bands, Multiple Linear Regression (XᵀX)⁻¹Xᵀy, Ridge (L₂) vs. Lasso (L₁) shrinkage geometry, Beta–Binomial conjugate updating, and Nonparametric Bootstrap.

Mathematical Rigor & Accuracy Notes
  • Anscombe's Quartet Warning: Correlation rr and R2R^2 measure ONLY linear association; nonlinear curves, single high-leverage outliers, and bimodal clusters can match identical rr and OLS slopes, making residual plots non-negotiable.
  • Standardize Before Applying Ridge or Lasso: Penalizing λ∥β∥pp\lambda \|\boldsymbol{\beta}\|_p^p depends on feature scale (e.g., meters vs. millimeters), so always center and standardize predictors to unit variance before tuning λ\lambda.
  • Credible Intervals vs. Confidence Intervals: A Bayesian 95%95\% credible interval literally satisfies P(θ∈[a,b]∣D)=0.95P(\theta \in [a,b] \mid D) = 0.95 conditional on prior + data, whereas frequentist confidence intervals refer to repeated sampling coverage.
  • Bootstrap Resampling Assumptions: Efron's nonparametric bootstrap assumes the sample is representative and independent; it cannot repair biased sampling or capture extreme heavy tails in tiny samples (n<10n < 10).

1. Pearson Correlation, Simple OLS & Uncertainty Bands

Pearson Correlation r & OLS Slope / Intercept
r=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2∑(yi−yˉ)2,b1=SxySxx=rsysx,b0=yˉ−b1xˉr = \frac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\sum(x_i-\bar{x})^2\sum(y_i-\bar{y})^2}}, \qquad b_1 = \frac{S_{xy}}{S_{xx}} = r\frac{s_y}{s_x}, \qquad b_0 = \bar{y} - b_1\bar{x}
Coefficient of Determination R² & Sum-of-Squares Partition
SST=SSR+SSE,R2=1−SSESST=SSRSST=r2(for simple OLS)\text{SST} = \text{SSR} + \text{SSE}, \qquad R^2 = 1 - \frac{\text{SSE}}{\text{SST}} = \frac{\text{SSR}}{\text{SST}} = r^2 \quad (\text{for simple OLS})
Mean-Response Confidence Band vs. Individual Prediction Interval
y^0±tα/2, n−2 se1n+(x0−xˉ)2Sxx(CI),y^0±tα/2, n−2 se1+1n+(x0−xˉ)2Sxx(PI)\hat{y}_0 \pm t_{\alpha/2,\, n-2}\, s_e\sqrt{\frac{1}{n} + \frac{(x_0 - \bar{x})^2}{S_{xx}}} \quad (\text{CI}), \qquad \hat{y}_0 \pm t_{\alpha/2,\, n-2}\, s_e\sqrt{1 + \frac{1}{n} + \frac{(x_0 - \bar{x})^2}{S_{xx}}} \quad (\text{PI})

Here se=SSE/(n−2)s_e = \sqrt{\text{SSE}/(n-2)}; the extra +1+1 accounts for fresh observation noise εnew\varepsilon_{\text{new}}, making Prediction Intervals permanently wider than mean bands.

2. Multiple Linear Regression, Diagnostics & Ridge / Lasso Geometry

Matrix Normal Equations & Orthogonal Hat Projection
β^OLS=(XTX)−1XTy,y^=Hy,H=X(XTX)−1XT\hat{\boldsymbol{\beta}}_{\text{OLS}} = (X^T X)^{-1} X^T \mathbf{y}, \qquad \hat{\mathbf{y}} = H\mathbf{y}, \qquad H = X(X^T X)^{-1} X^T

Condition:Each column residual vector e=(I−H)y\mathbf{e} = (I - H)\mathbf{y} sits strictly orthogonal to Col⁡(X)\operatorname{Col}(X): XTe=0X^T\mathbf{e} = \mathbf{0}.

Adjusted R² & Variance Inflation Factor (Multicollinearity)
Radj2=1−SSE/(n−p−1)SST/(n−1),VIFj=11−Rj2R^2_{\text{adj}} = 1 - \frac{\text{SSE}/(n - p - 1)}{\text{SST}/(n - 1)}, \qquad \text{VIF}_j = \frac{1}{1 - R_j^2}

Comparison of OLS, Ridge (L₂) & Lasso (L₁) Regression

MethodObjective FunctionConstraint GeometryKey Property
OLS (λ=0\lambda = 0)min⁡β∥y−Xβ∥22\min_{\boldsymbol{\beta}}\|\mathbf{y} - X\boldsymbol{\beta}\|_2^2Unconstrained projectionUnbiased if full rank; explodes under collinearity
Ridge (L2L_2)∥y−Xβ∥22+λ∥β∥22\|\mathbf{y} - X\boldsymbol{\beta}\|_2^2 + \lambda\|\boldsymbol{\beta}\|_2^2Smooth ball / circle ∑βj2≤t\sum \beta_j^2 \le tClosed form (XTX+λI)−1XTy(X^T X + \lambda I)^{-1}X^T\mathbf{y}; shrinks all weights smoothly
Lasso (L1L_1)∥y−Xβ∥22+λ∥β∥1\|\mathbf{y} - X\boldsymbol{\beta}\|_2^2 + \lambda\|\boldsymbol{\beta}\|_1Sharp diamond ∑∣βj∣≤t\sum |\beta_j| \le tRSS ellipses hit corners on axes   ⟹  \implies exact sparse zeros βj=0\beta_j = 0

3. Bayesian Conjugate Updating & Nonparametric Bootstrap

Continuous Bayes' Rule & Posterior Proportionality
p(θ∣D)=p(D∣θ) p(θ)∫p(D∣ϑ) p(ϑ) dϑ∝L(θ;D) p(θ)p(\theta \mid D) = \frac{p(D \mid \theta)\,p(\theta)}{\int p(D \mid \vartheta)\,p(\vartheta)\,d\vartheta} \propto L(\theta; D)\,p(\theta)
Beta–Binomial Conjugate Updating & Precision Shrinkage
θ∼Beta⁡(α0,β0),  k hits in n  ⟹  θ∣D∼Beta⁡(α0+k,  β0+n−k),E[θ∣D]=α0+kα0+β0+n\theta \sim \operatorname{Beta}(\alpha_0, \beta_0),\; k \text{ hits in } n \implies \theta \mid D \sim \operatorname{Beta}(\alpha_0 + k,\; \beta_0 + n - k), \qquad \mathbb{E}[\theta \mid D] = \frac{\alpha_0 + k}{\alpha_0 + \beta_0 + n}

Posterior mean is a convex weighted blend of prior mean α0/(α0+β0)\alpha_0/(\alpha_0+\beta_0) and MLE k/nk/n; as n→∞n \to \infty, the data dominates.

Normal–Normal Updating & Nonparametric Bootstrap Resampling
μpost=μ0/τ02+nxˉ/σ21/τ02+n/σ2,SEboot=1B−1∑b=1B(θ^b∗−θˉ∗)2,CIpct=[θ^(α/2)∗,  θ^(1−α/2)∗]\mu_{\text{post}} = \frac{\mu_0/\tau_0^2 + n\bar{x}/\sigma^2}{1/\tau_0^2 + n/\sigma^2}, \qquad \text{SE}_{\text{boot}} = \sqrt{\frac{1}{B-1}\sum_{b=1}^{B}(\hat{\theta}^*_b - \bar{\theta}^*)^2}, \qquad \text{CI}_{\text{pct}} = \bigl[\hat{\theta}^*_{(\alpha/2)},\; \hat{\theta}^*_{(1-\alpha/2)}\bigr]

Related Formula Reference Sheets

All Formula Sheets