Open the editor

Maths · High school

Residuals and R-Squared Slides

Free animated slides, ready to teach: 6 slides where every step appears on a click and the diagrams move. Play them right here, present them full screen, or copy them into your account to edit.

A real Tracé deck playing in your browser. No account needed.

What the lesson covers

A residual is how far a data point lies above or below the regression line. Students see the residuals of four points, learn why least squares minimises their squares and calculate R², the share of the variation the line explains.

The slides, one by one

1 Residuals and R²

How well does the line fit?

How can you measure how good a line of best fit is?

2 A residual is actual minus predicted

e_i = y_i - \hat y_i
\begin{aligned}&\textsf{Least squares makes }\sum e_i^2\textsf{ as}\\ &\textsf{small as possible}\end{aligned}

3 R² is the share of variation explained

R^2 = 1 - \dfrac{SS_{res}}{SS_{tot}}
\textsf{Here: }R^2 = 1 - 0.2/10 = 0.98

4 Fitting a line and finding R²

Fit the least-squares line to (1, 2), (2, 3), (3, 5), (4, 6) and find R².

→ Slope b = Sxy/Sxx, intercept from the means, then compare the squared residuals with SStot

\bar x = 2.5,\ \bar y = 4,\ S_{xy} = 7,\ S_{xx} = 5
b = 7/5 = 1.4,\ a = 4 - 1.4 \times 2.5 = 0.5
SS_{res} = 0.01 + 0.09 + 0.09 + 0.01 = 0.2
SS_{tot} = 4 + 1 + 1 + 4 = 10,\ R^2 = 0.98

ŷ = 0.5 + 1.4x with R² = 0.98

5 Quick check

A regression has R² = 0.64. This means…

  • 64% of the points are on the line
  • The slope is 0.64
  • The line explains 64% of the variation in y
  • r = 0.64
Show the answer

The line explains 64% of the variation in y

R² is the fraction of variation explained; here r would be ±0.8.

6 What to remember

Residual = actual − predicted

\textsf{Least squares minimises }\sum e^2
R^2 = 1 - SS_{res}/SS_{tot}

R² near 1: the line fits well

Challenge: Why should you still plot the residuals even when R² is high?

Every slide is built click by click: text, formulas and pictures come in one step at a time, so the class follows the reasoning instead of reading ahead. Graphs with sliders can be dragged live while you present.

Make your own version with AIChange the level, the numbers or the language: type the topic and get a new deck that moves in about 30 seconds. Free, no account needed.

Questions teachers ask

What does R² tell you?

R² = 1 − SSres/SStot, the fraction of the variation in y that the regression line explains. R² = 0.98 means the line explains 98% of it; R² near 0 means x tells you almost nothing about y.

Are these slides really free?

Yes. Watch them on this page or present them full screen with no account. Making your own copy to edit is free too.

Can I change the slides before my lesson?

Yes. Press "Make my own copy" and the deck becomes one of your projects in the Tracé editor, where you can change the text, the numbers, the colours or the order of the clicks.

Do they work on a classroom projector or an interactive whiteboard?

Yes. They run in the browser on any laptop, so anything that shows your screen works. Press the right arrow or click to go to the next step.