4 · IB Maths
Scatter and regression
The least-squares line minimises the sum of the squared vertical distances to the points. Drag any point, click empty space to add your own, and watch r and the line respond. Show the residuals to see what "least squares" means.
Predict first
Start from the default settings. Drag Spread of data all the way down to 0. What is the correlation coefficient r?
With zero spread every point lies exactly on one straight line with positive gradient, so the fit is perfect and r = 1. The correlation measures how closely the points follow a line, not how steep it is.
Check it in the model: Drag the Spread of data slider from 1.2 to 0 and read Correlation r (it shows 1.00).
Drag a point to move it. Click or tap empty space to add a point. Gold: data. Dark line: least-squares line. Rust: residuals.
r = Sxy ÷ √(Sxx Syy)
SSE = Σ (y − ŷ)²
Try this
- Press "Strong positive", then "Weak negative". Compare r and r², and say what each tells you about the strength and direction of the relationship.
- Tick "Show residuals" and "Draw residuals as squares", then drag one point far from the line. Watch the sum of squared residuals as the line tilts towards it.
- Press "New sample", then "Add an outlier" and note how much r and the gradient change. Remove it again and compare.
Common error: using the regression line of y on x to predict x from y, or extrapolating far outside the data; the line minimises vertical distances, and a large r does not by itself prove that one variable causes the other.
More on 4: Venn diagrams and conditional probability · Discrete random variables · Continuous random variables · Bayes' theorem: medical test · Standard deviation and outliers · Binomial distribution · Markov chains · The normal distribution · Poisson distribution · Tree diagrams and Bayes’ theorem · Box plots and histograms