Chalk−1

Math · Introductory statistics · Worked example

Fit a least-squares line and interpret r²

Five students report hours studied and exam scores: (1, 55), (2, 62), (3, 64), (4, 71) and (5, 78). Find the least-squares line, r and r², and predict the score after 3.5 hours.

Find the means

1+2+3+4+55=355+62+64+71+785=66

Find the slope

Multiply each pair of deviations and add: (−2)(−11) + (−1)(−4) + 0(−2) + 1(5) + 2(12) = 55. The squared x-deviations add to 10.

5510=5.5

Find the intercept

The line passes through (x̄, ȳ) = (3, 66).

66−5.5⋅3=49.5

Find r and r²

The squared y-deviations add to 310.

5510⋅310≈0.9880.9882≈0.976

Predict

Substitute x = 3.5, which lies inside the data.

49.5+5.5⋅3.5=68.75

Result

ŷ = 49.5 + 5.5x; r ≈ 0.988 and r² ≈ 0.976, so the line accounts for about 97.6% of the variation in scores. At 3.5 hours it predicts 68.75.

Your turn

The line ŷ = 49.5 + 5.5x predicts 71.5 at x = 4, where the observed score was 71. What is the residual?

Show the answer and explanation

−0.5.

Residual = observed − predicted = 71 − 71.5 = −0.5, so the point sits just below the line.

71−(49.5+5.5⋅4)=−0.5

Keep exploring

In Statistics, Regression shows the same equation, r and R², and the residuals 0, 1.5, −2, −0.5 and 1. The line would predict 115.5 for 12 hours, an impossible score: extrapolation.

Return to the concept →
Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

Make it concrete

Try in the workspace

Open the example inputs, change a value and keep a useful result on your board.

Fit the line in Statistics Check the line in Math Open worked example on a board Statistics formulas in Math Reference

Your existing work stays on this device. Examples open as editable copies.