ε

Ordinary Least Squares

The line of best fit, how it's computed, inference, and the assumptions behind it.

Beginner · 4 modules · Free and browser-based

View the course outline

Course overview

Learn Ordinary Least Squares interactively

This free course uses real Python and statsmodels in your browser. Work through the modules below with explanations, executable examples, interactive controls, and questions.

1 · The line of best fit

What OLS does, and recovering a known slope from data.

2 · How OLS finds the line

The normal equations — OLS in one line of linear algebra.

3 · Inference

Standard errors, t-statistics, confidence intervals — and how they shrink with n.

4 · Assumptions & diagnostics

Gauss–Markov, heteroskedasticity, and robust standard errors.