MML204

Ordinary Least Squares (OLS)

⏱8 min read👁️Eye-Care Reading Mode

What you'll learn

  • Why representing linear regression in matrix notation simplifies multidimensional estimation.
  • How to expand the matrix Sum of Squared Residuals (RSS=eTe\text{RSS} = \mathbf{e}^T\mathbf{e}) step by step.
  • How to differentiate quadratic matrix forms to derive the Normal Equations XTXβ^=XTy\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}^T\mathbf{y}.
  • The closed-form analytical OLS estimator β^=(XTX)−1XTy\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y} and its full-rank requirements.
  • The fundamental geometric property of OLS: residual orthogonality (XTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0}) and why residuals sum to zero when an intercept is present.

Explained in detail

1. The True Model in Matrix Form

In multiple linear regression, we relate a continuous dependent target variable yy to kk explanatory feature variables across nn observations. In scalar summation notation, this equation quickly becomes unwieldy. Matrix algebra provides a clean, rigorous, and computationally efficient representation.

The population regression model in matrix notation is:

y=Xβ+ε\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}

Let's break down each component and its exact dimensions:

  • X\mathbf{X} is an n×kn \times k Design Matrix: Contains the observations on kk independent variables across nn training instances. When the model includes an intercept (constant term), the first column of X\mathbf{X} consists entirely of ones (1\mathbf{1}).
  • y\mathbf{y} is an n×1n \times 1 Vector: The observed values of the dependent target variable.
  • ε\boldsymbol{\varepsilon} is an n×1n \times 1 Vector of Disturbances: The unobserved random errors or influences not captured by the features.
  • β\boldsymbol{\beta} is a k×1k \times 1 Vector of True Parameters: The fixed but unknown population coefficients we wish to estimate.

The model decomposes into a systematic component (Xβ\mathbf{X}\boldsymbol{\beta}) and a stochastic component (ε\boldsymbol{\varepsilon}). Our goal in estimation is to infer the unknown population vector β\boldsymbol{\beta} using sample observations.

Matrix Dimensions Check

Matrix dimensions must align under standard matrix multiplication:

(n×k)×(k×1)=n×1(n \times k) \times (k \times 1) = n \times 1

Thus, Xβ\mathbf{X}\boldsymbol{\beta} has dimensions n×1n \times 1, which matches the dimension of y\mathbf{y} and ε\boldsymbol{\varepsilon}.

Dimension check for the scalar product y'X beta-hat


2. Estimates, Fitted Values, and Residuals

Let β^\hat{\boldsymbol{\beta}} denote the estimated parameter vector calculated from our sample data.

The fitted (predicted) values y^\hat{\mathbf{y}} are obtained by projecting the design matrix through our parameter estimate:

y^=Xβ^\hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol{\beta}}

The residual vector e\mathbf{e} is the sample difference between the actual observations and the fitted predictions:

e=y−y^=y−Xβ^\mathbf{e} = \mathbf{y} - \hat{\mathbf{y}} = \mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}

Disturbances (ε\boldsymbol{\varepsilon}) vs. Residuals (e\mathbf{e})

Students often conflate the theoretical error term with the empirical residual. They represent fundamentally different concepts:

PropertyDisturbance ε\boldsymbol{\varepsilon}Residual e\mathbf{e}
MeaningUnobserved noise in the true population modelObserved minus fitted sample prediction
Observable?No (theoretical population quantity)Yes (calculated directly from sample data)
RolePart of the data-generating processGenerated after estimating β^\hat{\boldsymbol{\beta}}
⚠️

Crucial Distinction: In general, ε≠e\boldsymbol{\varepsilon} \ne \mathbf{e}. Never infer properties of the unobserved population disturbances solely because sample residuals happen to satisfy mathematical identities by construction!


3. The OLS Criterion: Minimizing the Sum of Squared Residuals (RSS)

The Ordinary Least Squares criterion selects the estimate β^\hat{\boldsymbol{\beta}} that minimizes the scalar sum of squared residuals:

RSS=∑i=1nei2=eTe\begin{aligned} \text{RSS} &= \sum_{i=1}^{n} e_i^2 \\ &= \mathbf{e}^T\mathbf{e} \end{aligned}

Why Does ∑i=1nei2=eTe\sum_{i=1}^{n} e_i^2 = \mathbf{e}^T\mathbf{e}?

To see why the sum of squared residuals equals the vector dot product eTe\mathbf{e}^T\mathbf{e}, write out the vectors explicitly:

  1. Residual Column Vector (e∈Rn×1\mathbf{e} \in \mathbb{R}^{n \times 1}):

    e=[e1⋮en]\mathbf{e} = \begin{bmatrix} e_1 \\ \vdots \\ e_n \end{bmatrix}
  2. Transposed Row Vector (eT∈R1×n\mathbf{e}^T \in \mathbb{R}^{1 \times n}):

    eT=[e1…en]\mathbf{e}^T = \begin{bmatrix} e_1 & \dots & e_n \end{bmatrix}
  3. Inner Product (Row ×\times Column):

    eTe=[e1…en][e1⋮en]=e12+⋯+en2=∑i=1nei2\begin{aligned} \mathbf{e}^T\mathbf{e} &= \begin{bmatrix} e_1 & \dots & e_n \end{bmatrix} \begin{bmatrix} e_1 \\ \vdots \\ e_n \end{bmatrix} \\ &= e_1^2 + \dots + e_n^2 \\ &= \sum_{i=1}^{n} e_i^2 \end{aligned}

In geometric terms, eTe=∥e∥22\mathbf{e}^T\mathbf{e} = \|\mathbf{e}\|_2^2 is the squared Euclidean norm (length) of the residual vector in observation space Rn\mathbb{R}^n.

Substituting the residual definition e=y−Xβ^\mathbf{e} = \mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}:

RSS=(y−Xβ^)T(y−Xβ^)\text{RSS} = (\mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}})^T (\mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}})

Recall the transpose property for matrix products and differences:

(AB)T=BTAT,(A−B)T=AT−BT(\mathbf{A}\mathbf{B})^T = \mathbf{B}^T\mathbf{A}^T, \qquad (\mathbf{A} - \mathbf{B})^T = \mathbf{A}^T - \mathbf{B}^T

Applying this to our residual expression:

(y−Xβ^)T=yT−(Xβ^)T=yT−β^TXT(\mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}})^T = \mathbf{y}^T - (\mathbf{X}\hat{\boldsymbol{\beta}})^T = \mathbf{y}^T - \hat{\boldsymbol{\beta}}^T\mathbf{X}^T

Substituting this back into RSS and distributing terms:

RSS=(yT−β^TXT)(y−Xβ^)=yTy−yTXβ^−β^TXTy+β^TXTXβ^\begin{aligned} \text{RSS} &= (\mathbf{y}^T - \hat{\boldsymbol{\beta}}^T\mathbf{X}^T)(\mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}) \\ &= \mathbf{y}^T\mathbf{y} - \mathbf{y}^T\mathbf{X}\hat{\boldsymbol{\beta}} - \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y} \\ &\quad + \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} \end{aligned}

Why is yTXβ^\mathbf{y}^T\mathbf{X}\hat{\boldsymbol{\beta}} a Scalar?

Let's verify the dimensions of the middle term:

yT⏟1×n×X⏟n×k×β^⏟k×1\underbrace{\mathbf{y}^T}_{1 \times n} \times \underbrace{\mathbf{X}}_{n \times k} \times \underbrace{\hat{\boldsymbol{\beta}}}_{k \times 1}

Multiplying from left to right:

(1×n)×(n×k)=1×k(1 \times n) \times (n \times k) = 1 \times k(1×k)×(k×1)=1×1(1 \times k) \times (k \times 1) = 1 \times 1

A 1×11 \times 1 matrix is a single real number (scalar). Because every scalar equals its own transpose:

yTXβ^=(yTXβ^)T=β^TXTy\mathbf{y}^T\mathbf{X}\hat{\boldsymbol{\beta}} = (\mathbf{y}^T\mathbf{X}\hat{\boldsymbol{\beta}})^T = \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y}

The two cross-terms in the expansion are identical! Combining them yields the Master Expanded RSS:

RSS=yTy−2β^TXTy+β^TXTXβ^\text{RSS} = \mathbf{y}^T\mathbf{y} - 2\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y} + \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}

4. Differentiating RSS with Respect to β^\hat{\boldsymbol{\beta}}

To find the coefficient vector β^\hat{\boldsymbol{\beta}} that minimizes RSS, we take the vector derivative of RSS with respect to β^\hat{\boldsymbol{\beta}} and equate it to the zero vector.

Useful Matrix Differentiation Rules

  1. Linear Form: For constant vectors a\mathbf{a} and variable vector b\mathbf{b}: ∂(bTa)∂b=a\frac{\partial (\mathbf{b}^T\mathbf{a})}{\partial \mathbf{b}} = \mathbf{a}
  2. Quadratic Form: For a square matrix A\mathbf{A}: ∂(βTAβ)∂β=(A+AT)β\frac{\partial (\boldsymbol{\beta}^T\mathbf{A}\boldsymbol{\beta})}{\partial \boldsymbol{\beta}} = (\mathbf{A} + \mathbf{A}^T)\boldsymbol{\beta} If A\mathbf{A} is symmetric (AT=A\mathbf{A}^T = \mathbf{A}), this simplifies to: ∂(βTAβ)∂β=2Aβ\frac{\partial (\boldsymbol{\beta}^T\mathbf{A}\boldsymbol{\beta})}{\partial \boldsymbol{\beta}} = 2\mathbf{A}\boldsymbol{\beta}

Deriving the Quadratic-Form Rule via Differentials

Let f(β)=βTAβf(\boldsymbol{\beta}) = \boldsymbol{\beta}^T\mathbf{A}\boldsymbol{\beta}. Using the product rule in differential form:

df=dβTAβ+βTA dβdf = d\boldsymbol{\beta}^T\mathbf{A}\boldsymbol{\beta} + \boldsymbol{\beta}^T\mathbf{A}\,d\boldsymbol{\beta}

Because the second term is a scalar, it equals its transpose:

βTA dβ=(βTA dβ)T=dβTATβ\boldsymbol{\beta}^T\mathbf{A}\,d\boldsymbol{\beta} = (\boldsymbol{\beta}^T\mathbf{A}\,d\boldsymbol{\beta})^T = d\boldsymbol{\beta}^T\mathbf{A}^T\boldsymbol{\beta}

Factoring out dβTd\boldsymbol{\beta}^T:

df=dβT(A+AT)βdf = d\boldsymbol{\beta}^T(\mathbf{A} + \mathbf{A}^T)\boldsymbol{\beta}

Therefore, the gradient is (A+AT)β(\mathbf{A} + \mathbf{A}^T)\boldsymbol{\beta}.

Differentiating the Three RSS Terms

Differentiating each term of RSS=yTy−2β^TXTy+β^TXTXβ^\text{RSS} = \mathbf{y}^T\mathbf{y} - 2\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y} + \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}:

  1. Term 1 (yTy\mathbf{y}^T\mathbf{y}): Does not depend on β^\hat{\boldsymbol{\beta}}: ∂(yTy)∂β^=0\frac{\partial (\mathbf{y}^T\mathbf{y})}{\partial \hat{\boldsymbol{\beta}}} = \mathbf{0}
  2. Term 2 (−2β^TXTy-2\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y}): Applying the linear rule where a=XTy\mathbf{a} = \mathbf{X}^T\mathbf{y}: ∂(−2β^TXTy)∂β^=−2XTy\frac{\partial (-2\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y})}{\partial \hat{\boldsymbol{\beta}}} = -2\mathbf{X}^T\mathbf{y}
  3. Term 3 (β^TXTXβ^\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}): Here A=XTX\mathbf{A} = \mathbf{X}^T\mathbf{X}. Since (XTX)T=XT(XT)T=XTX(\mathbf{X}^T\mathbf{X})^T = \mathbf{X}^T(\mathbf{X}^T)^T = \mathbf{X}^T\mathbf{X}, the matrix is symmetric: ∂(β^TXTXβ^)∂β^=2XTXβ^\frac{\partial (\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}})}{\partial \hat{\boldsymbol{\beta}}} = 2\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}

Combining all three derivatives gives the RSS Gradient Vector:

∂RSS∂β^=−2XTy+2XTXβ^\frac{\partial \text{RSS}}{\partial \hat{\boldsymbol{\beta}}} = -2\mathbf{X}^T\mathbf{y} + 2\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}

5. Normal Equations and the OLS Estimator

At the minimum, the gradient must equal the zero vector:

−2XTy+2XTXβ^=0-2\mathbf{X}^T\mathbf{y} + 2\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{0}

Dividing by 22 and rearranging gives the celebrated Normal Equations:

XTXβ^=XTy\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}^T\mathbf{y}

If the k×kk \times k matrix XTX\mathbf{X}^T\mathbf{X} is invertible (non-singular), we premultiply both sides by (XTX)−1(\mathbf{X}^T\mathbf{X})^{-1}:

(XTX)−1XTXβ^=(XTX)−1XTy(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}

Since (XTX)−1XTX=Ik(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{X} = \mathbf{I}_k, we arrive at the Closed-Form OLS Estimator:

β^=(XTX)−1XTy\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}

When Does (XTX)−1(\mathbf{X}^T\mathbf{X})^{-1} Fail to Exist?

The matrix XTX\mathbf{X}^T\mathbf{X} is non-invertible if:

  1. n<kn < k (Underdetermined system): Fewer observations than independent features.
  2. Perfect Multicollinearity: One or more columns of X\mathbf{X} are exact linear combinations of other columns (e.g., redundant or duplicate features).

The full column rank condition (rank(X)=k\text{rank}(\mathbf{X}) = k) guarantees that XTX\mathbf{X}^T\mathbf{X} is strictly positive definite and invertible.


6. Verifying the Stationary Point is a Minimum

To confirm that the stationary point is a strict local minimum rather than a maximum or saddle point, we evaluate the second derivative (Hessian matrix):

∂2RSS∂β^∂β^T=2XTX\frac{\partial^2 \text{RSS}}{\partial \hat{\boldsymbol{\beta}} \partial \hat{\boldsymbol{\beta}}^T} = 2\mathbf{X}^T\mathbf{X}

If X\mathbf{X} has full column rank, then for any non-zero vector v≠0\mathbf{v} \ne \mathbf{0}:

vT(2XTX)v=2(Xv)T(Xv)=2∥Xv∥2>0\mathbf{v}^T (2\mathbf{X}^T\mathbf{X}) \mathbf{v} = 2(\mathbf{X}\mathbf{v})^T(\mathbf{X}\mathbf{v}) = 2 \|\mathbf{X}\mathbf{v}\|^2 > 0

Since the quadratic form is strictly positive for all non-zero vectors, the Hessian matrix 2XTX2\mathbf{X}^T\mathbf{X} is positive definite. Consequently, the stationary point β^\hat{\boldsymbol{\beta}} is guaranteed to be a unique global minimum.


7. Fundamental Property: Residual Orthogonality (XTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0})

Starting from the normal equations XTXβ^=XTy\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}^T\mathbf{y} and substituting the residual definition e=y−Xβ^\mathbf{e} = \mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}:

XTe=XT(y−Xβ^)=XTy−XTXβ^=XTy−XTy=0\begin{aligned} \mathbf{X}^T\mathbf{e} &= \mathbf{X}^T(\mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}) \\ &= \mathbf{X}^T\mathbf{y} - \mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} \\ &= \mathbf{X}^T\mathbf{y} - \mathbf{X}^T\mathbf{y} \\ &= \mathbf{0} \end{aligned}XTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0}

This equation demonstrates that the residual vector e\mathbf{e} is strictly orthogonal to every single column of the design matrix X\mathbf{X}!

Conceptual illustration of residual orthogonality. The residual direction is perpendicular to the column-space direction.

Column-by-Column Interpretation

If xj\mathbf{x}_j is the jj-th column of X\mathbf{X}, then XTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0} implies:

xjTe=∑i=1nXijei=0for every feature j=1,…,k\mathbf{x}_j^T\mathbf{e} = \sum_{i=1}^{n} X_{ij} e_i = 0 \qquad \text{for every feature } j = 1, \dots, k

In sample terms, every regressor has zero sample correlation with the OLS residuals.

Consequences When the Model Includes an Intercept

When the regression includes a constant intercept term, the first column of X\mathbf{X} is a column of ones: 1=[1,1,…,1]T\mathbf{1} = [1, 1, \dots, 1]^T.

Evaluating the first element of XTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0}:

1Te=∑i=1nei=0\mathbf{1}^T\mathbf{e} = \sum_{i=1}^{n} e_i = 0

The sum of OLS residuals is always zero! Dividing by the sample size nn gives the sample mean of residuals:

eˉ=1n∑i=1nei=0\bar{e} = \frac{1}{n}\sum_{i=1}^{n} e_i = 0
💡

Note on Intercept Requirement: The properties ∑ei=0\sum e_i = 0 and eˉ=0\bar{e} = 0 hold only when the model includes an intercept column. In regressions forced through the origin without an intercept, the residuals generally do not sum to zero!

Figure 3.2: OLS Closed-Form Estimator & Orthogonality

👆 Drag points vertically to update OLS
OLS β̂:[0.85, 1.05]ᵀ
RSS:1.475
Xᵀe (1ᵀe):0.00
Xᵀe (xᵀe):0.00

Interactive matrix solution β̂ = (XᵀX)⁻¹Xᵀy. Drag any observation point vertically to inspect how the normal equations and residual orthogonality Xᵀe = 0 update in real time.

What to try

  • Switch to the "Matrix Inspector" tab: Inspect each intermediate matrix (X\mathbf{X}, XTX\mathbf{X}^T\mathbf{X}, (XTX)−1(\mathbf{X}^T\mathbf{X})^{-1}, XTy\mathbf{X}^T\mathbf{y}) computed live.
  • Drag an observation vertically: Watch the OLS closed-form parameters β^0\hat{\beta}_0 and β^1\hat{\beta}_1 update instantly.
  • Inspect the Orthogonality verification: Notice how 1Te=∑ei=0.00\mathbf{1}^T\mathbf{e} = \sum e_i = 0.00 and xTe=∑xiei=0.00\mathbf{x}^T\mathbf{e} = \sum x_i e_i = 0.00 hold true regardless of where you move the data points.
  • Click "Collinear Preset": Observe how a perfectly straight line yields RSS=0.000\text{RSS} = 0.000 and zero residuals.

Key ideas at a glance

Summary Reference Table

ConceptMathematical FormMeaning
True Modely=Xβ+ε\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}Data-generating process with unobserved disturbance ε\boldsymbol{\varepsilon}
Fitted Valuesy^=Xβ^\hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol{\beta}}Orthogonal projection of y\mathbf{y} onto column space col(X)\text{col}(\mathbf{X})
Residualse=y−Xβ^\mathbf{e} = \mathbf{y} - \mathbf{X}\hat{\boldsymbol{\beta}}Sample prediction errors (n×1n \times 1)
RSS CriterionRSS=eTe\text{RSS} = \mathbf{e}^T\mathbf{e}Scalar quantity minimized by the OLS estimator
Expanded RSSyTy−2β^TXTy+β^TXTXβ^\mathbf{y}^T\mathbf{y} - 2\hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{y} + \hat{\boldsymbol{\beta}}^T\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}Quadratic polynomial in parameter vector β^\hat{\boldsymbol{\beta}}
RSS Gradient−2XTy+2XTXβ^-2\mathbf{X}^T\mathbf{y} + 2\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}}Vector of first partial derivatives equated to 0\mathbf{0}
Normal EquationsXTXβ^=XTy\mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}^T\mathbf{y}Linear system of kk equations in kk unknowns
OLS Estimatorβ^=(XTX)−1XTy\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}Closed-form analytical solution (requires full column rank)
Residual OrthogonalityXTe=0\mathbf{X}^T\mathbf{e} = \mathbf{0}Residual vector is perpendicular to every regressor column
Zero Mean Residuals∑i=1nei=0 and eˉ=0\sum_{i=1}^n e_i = 0 \text{ and } \bar{e} = 0Guaranteed whenever X\mathbf{X} includes a constant column

Check your understanding

🧩

Ready to test yourself?

20 questions · explanations shown after


Teach & Solidify

🎓
Feynman Teaching Card

Teach This: OLS in Matrix Form

Core Intuition

Ordinary Least Squares finds β̂ = (XᵀX)⁻¹Xᵀy by orthogonally projecting target y onto the column space of design matrix X, guaranteeing Xᵀe = 0.

Key Concepts to Explain

  • 1Matrix notation unifies multiple regression into compact equations: y = Xβ + ε.
  • 2RSS = eᵀe expands into yᵀy - 2β̂ᵀXᵀy + β̂ᵀXᵀXβ̂ because yᵀXβ̂ is a 1×1 scalar.
  • 3Setting the gradient ∂RSS/∂β̂ = -2Xᵀy + 2XᵀXβ̂ to zero yields the normal equations XᵀXβ̂ = Xᵀy.
  • 4Residuals are strictly orthogonal to every regressor column: Xᵀe = 0.
  • 5When an intercept column 1 is included, residuals always sum to zero (∑ eᵢ = 0, ē = 0).

⚠️ What Most Students Get Confused About

Confusing the unobservable population disturbances ε with the computable sample residuals e = y - Xβ̂. In general, ε ≠ e.

✍️
Active Recall Practice

Explain Ordinary Least Squares (OLS) in your own words

Imagine you are explaining this idea to a friend or classmate with no math background. Writing it out forces your brain to bridge gaps in your intuition.

Saved locally on your device

Resources & GitHub

🎯

Mastered this concept?

Tick this box when you feel confident explaining it.

📁
Study Notes & Files3 files

Topic Resources

GitHub↗
📕

OLS.pdf

PDF Note

279.3 KB · Modified Latest

📐

OLS_matrix_notes.tex

LaTeX Source

16.2 KB · Modified Latest

📝

Ordinary_Least_Squares_Summary.md

Markdown Note

2.0 KB · Modified Latest

Was this clear?