Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Flashcards: open the module flashcards (end-of-module review with workplace questions).

Online Courses / University Track / Learning from Data

Module 3 · Lesson 1 · Core

The line: slope, intercept and prediction

Read and use a straight-line model y = a + bx.

  • 55 minutes
  • Serves O3
  • Assumes Module 2

Phase 1: Prepare

Step 1 Warm-up recall

From Module 2: what is the baseline for predicting a number?

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • say what slope and intercept mean (Foundation);
  • predict from a given line (Foundation);
  • explain the slope in words for a real situation (Core).

Phase 2: Teach

Step 3 A familiar example

A taxi charges a fixed fee and then a price for each kilometre. Knowing those two numbers lets you quote any journey. A regression line works in exactly the same way.

Step 4 Clear explanation

The simplest model for predicting a number y from a number x is a straight line: y = a + bx. The number a is the intercept, the predicted y when x is 0. The number b is the slope, how much the prediction changes for each one-unit increase in x.

Interceptvalue when x is 0Slopechange in y per 1 of xPredictionintercept + slope × x
A straight line has two numbers: the intercept (where it starts) and the slope (how much it rises for each step in x).

Take a taxi fare of 3 + 2x pounds, where x is the distance in kilometres. The intercept 3 is the fixed fee and the slope 2 is the price per kilometre.

Distance x (km)Fare y = 3 + 2x (£)
03
15
27
615

For 6 km the prediction is 3 + 2 × 6 = 15 pounds. The slope is the useful sentence to say aloud: each extra kilometre adds about two pounds. A negative slope means y falls as x rises, as with the price of a used car against its age.

In machine learning this line is a model. The two numbers a and b are its parameters, and fitting the model means choosing them from data, which is the subject of the next lesson.

Step 5 Worked example (4 marks)

A model is y = 10 + 4x, where x is hours of training and y is units sorted per hour. Predict y for x = 3 and explain the slope.

  1. Substitute: 10 + 4 × 3. (1 mark)
  2. Calculate: 10 + 12 = 22. (1 mark)
  3. The slope is 4. (1 mark)
  4. Answer: 22 units per hour; each extra hour of training adds about 4 units per hour. (1 mark)

Go deeper: the professor's notes

A line y = a + bx has an intercept and a slope. The slope is the sentence worth saying aloud.
Intercept

Start.

Slope

Per unit.

Predict

a + bx.

InterceptaSlopebxinputPredictiony
Line

Fare

Distance (km)Fare (£)
03
27
615

At work: Taxi fare

The fare is 3 + 2x pounds.

  1. Read the intercept as the fixed fee.
  2. Read the slope as pounds per kilometre.

What a careful practitioner decides. Say the slope in words with its units.

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. In y = a + bx the intercept is:

2. The slope tells you:

3. For y = 3 + 2x, x = 5 gives:

4. A negative slope means:

Phase 4: Close

Step 7 Recap

  • A line model is y = a + bx.
  • The intercept is the prediction at x = 0; the slope is the change per unit of x.
  • Fitting means choosing a and b from data.

Step 8 Exit ticket (ungraded)

For y = 5 + 3x, predict y when x = 4 and say what the slope means.

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Find a relationship in your own work that is roughly a line and say what its slope would mean.

In industry: Anscombe: four data sets, one line

In 1973 the statistician Francis Anscombe built four small data sets of eleven points each. All four give the same fitted line, y = 3.00 + 0.500x, and the same R squared of 0.67, yet they look completely different when plotted.

Link to this lesson. The numbers from a fit cannot say whether a line is the right shape, so plot the data first.

Source: Anscombe (1973), Graphs in Statistical Analysis, The American Statistician 27(1); Anscombe quartet, Wikipedia

Common mistakes

MistakeWhy it fails
Swapping slope and interceptThe intercept is where the line starts; the slope is how steeply it rises.
Giving the slope without unitsSay “pounds per kilometre”, not just 2.
Reading the slope as causeIt shows association in the data, not necessarily cause.

Limits. Straight lines are the simplest case; curves and several features come later.

Flashcards for this lesson (3)

Tap a card to reveal the answer. Read the question, answer it aloud or in writing first, then check yourself against the explanation.

Card 1 of 3 · What is the model y = a + bx?
ainterceptbslopeyprediction
Line

A straight-line model for predicting a number y from a number x. A taxi fare of 3 + 2x is a fixed fee of three pounds plus two pounds per kilometre.

Card 2 of 3 · What does the intercept mean?
x = 0startTaxifixed feeBewareoutside data
Intercept

The predicted y when x is 0. In the taxi example it is the fixed fee. It can be meaningless if x = 0 is far outside the data.

Card 3 of 3 · What does the slope mean?
+1 in xchangeSaywith unitsNotcause
Slope

The change in the prediction for each one-unit increase in x. Say it with units: two pounds per kilometre, or 0.6 marks per hour of revision.

Review with flashcards

Test yourself on this module with workplace flashcards and detailed answers.

Open the module flashcards