Probability and statistics · University

Linear regression

y ≈ kx + b

The idea

The best line through a cloud of points — the one where the sum of the squared errors is smallest.

The board

  1. You have points (ads → sales). You're looking for y = kx + b.
  2. The error of each point: how far it is above or below the line.
  3. Minimize Σ(error)2 → the least squares method.
  4. Correlation r from −1 to 1: how well the points lie on a line.

The most common mistake

“Correlation means causation.” Ice cream and drownings grow together — because of summer, not because of each other.

The trick

This is the simplest “artificial intelligence” — a model that learns from data.

Problems

r = −0.9 means…

  • no relationship
  • a weak relationship
  • a strong negative linear relationship
  • causation
Show the answer

a strong negative linear relationship — A strong inverse relationship.

Least squares minimizes…

  • the number of points
  • the sum of the squared errors
  • the slope
  • b
Show the answer

the sum of the squared errors — The sum of the squared errors.

Take the lesson · exercises and XPFree, no sign-up needed.

You need to know