Module 4 · Linear functions · Lesson 26 of 84

Fitting linear models to data

Scatter plots, the line of best fit, the correlation coefficient, and predicting by interpolation and extrapolation.

In this lesson · about 20 minutes

  • Draw and read a scatter plot
  • Find a line of best fit and use it to predict
  • Interpret the correlation coefficient r
  • Tell interpolation from extrapolation, and know why extrapolation is risky

Real data is messy. If you record how many hours ten students studied and their test scores, the points will not sit perfectly on a line. They will scatter around one. A scatter plot shows each pair as a dot so you can see the pattern.

When the dots follow a rough straight path, we can draw a line of best fit through the middle of them. The standard choice is the least squares regression line: for every dot, find how far it is above or below the line (the residual), square it, and add them up. The regression line makes that total as small as possible. Calculators and spreadsheets find it for you.

The correlation coefficient r

The number r is always between −1 and 1. It says how close the dots are to a straight line:

  • r near 1: a strong positive pattern (as x goes up, y goes up).
  • r near −1: a strong negative pattern (as x goes up, y goes down).
  • r near 0: no straight-line pattern.

Correlation is not causation. Ice cream sales and drownings both rise in summer, but ice cream does not cause drowning. Hot weather drives both.

Try it · interactive

Fit a line to data

Move the slope and intercept until your line hugs the dots, then compare with the least squares line.

ŷ = 4x + 54

Your squared error

259

Smallest possible

?

Move the sliders to get your line as close as you can to the dots. The squared error adds up (actual − predicted)² for every dot. The line of best fit (least squares regression) makes it as small as possible.

12345678910114550556065707580859095

Whiteboard · watch and try

Using a fitted line to predict

4 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Sorting drill

How strong is the correlation?

Sort each r value.

  • r = 0.93
  • r = −0.88
  • r = 0.08
  • r = −0.15
  • r = 0.99
  • r = −0.97

0 of 6 sorted

Check your understanding0 of 5 correct

Question 1

1.The line of best fit for a car's value is V = −2.1t + 27 (thousands of dollars, t in years). What does it predict at t = 4?

Question 2

2.Which r shows the strongest straight-line relationship?

Question 3

3.Data runs from 2010 to 2020. Using the fitted line to predict 2035 is…

Question 4

4.A dot sits at (6, 40) and the line predicts 35 at x = 6. The residual is…

Question 5

5.Towns with more firefighters have more fires. What is the best explanation?

Key terms

Say the meaning to yourself, then tap a card to check.

Quiz score: 0 of 5

Tip: answer every quiz question correctly first.

Based on Algebra and Trigonometry 2e by Jay Abramson and others (OpenStax, Rice University), openstax.org/details/books/algebra-and-trigonometry-2e, licensed under CC BY-NC-SA 4.0. Noviq Academy rewrote and reorganized the material in its own words and added its own examples, whiteboard lessons, tools and quizzes; this adapted course is free and shared under the same license. Not endorsed by OpenStax or Rice University. Read-aloud and the whiteboard voice use your device's built-in voices, so the voice varies by device.