Lesson 8
Ordinary Least Squares intuition
Big question
How does OLS choose the fitted line?
Lesson progress
Complete checkpoints as you learn
Learning objectives
- Explain ordinary least squares intuition in plain language.
- Use ordinary least squares correctly in an interpretation.
- Connect the lesson idea to a formula, graph, Python result, or real example.
Simple explanation
Ordinary Least Squares chooses the intercept and slope that make the sum of squared residuals as small as possible. Squaring makes positive and negative residuals count as errors and gives larger misses extra weight.
Key terms
- Ordinary Least Squares
- The method that chooses the fitted line by minimizing the sum of squared residuals.
- Squared residual
- A residual multiplied by itself.
- Sum of squared residuals
- The total of all squared residuals for a fitted line.
- Best fit
- The fitted line selected by the chosen criterion.
OLS objective
Example
A line that is too flat underpredicts high-education wages and overpredicts low-education wages. OLS balances these misses by minimizing squared residuals.
Interactive visual
Find the least-squares line
Try nearby slopes and compare the residual sum of squares.
Least-squares target
Sum of squared residuals
20.88
The OLS slope near 2.33 gives the smallest total squared residuals for this teaching sample.
Live notebook
Run this lesson as a notebook
Open an editable notebook cell-by-cell, run Python in the browser, and download the `.ipynb` file for later.
Interactive activity
OLS best-line intuition
OLS chooses the line that makes these vertical misses as small as possible after squaring them.
OLS line challenge
Adjust the line, then compare your sum of squared residuals with the OLS line.
Your line compared with the data
Each dot is one observation. The fitted line summarizes the relationship between Education and Wage.
Your SSR: 157.28
OLS SSR: 20.88
Try it yourself
Write one plain-English sentence explaining the main idea from this lesson.
Common mistakes
Check these before you move on.
A regression coefficient describes a pattern unless the assumptions or research design support a causal interpretation.
Quick quiz
What does OLS minimize?
Quick quiz
Why are residuals squared in OLS?
Key takeaway
OLS chooses the line with the smallest total squared prediction errors.