Steply

Line of best fit (1, 3) (2, 5) (3, 6) (4, 8), predict x = 6

Step by step, with the reason for every step · Line of best fit · Statistics

Step by step

The question

Question: find the line of best fit for (1, 3), (2, 5), (3, 6), (4, 8).

Then predict y when x is 6.

(1, 3) (2, 5) (3, 6) (4, 8)

The line of best fit is the straight line that comes closest to all the points.

best fit: the line closest to all the points

1 Find the means

The mean of the x numbers: 10 divided by 4 is 2.5.

mean x = 1 + 2 + 3 + 44 = 104 = 2.5

The mean of the y numbers: 22 divided by 4 is 5.5.

mean y = 3 + 5 + 6 + 84 = 224 = 5.5

The line of best fit always goes through the mean point, (2.5, 5.5).

the line goes through (2.5, 5.5)

2 Make the table

A table with the points.

Each x minus the mean x, 2.5.

Each y minus the mean y, 5.5.

For the first point: 1 minus 2.5 is −1.5, and 3 minus 5.5 is −2.5.

The product: the two distances multiplied.

−1.5 times −2.5 is 3.75.

And the x distance squared.

−1.5 squared is 2.25.

We add the last two columns: 8 and 5.

3 Find the slope

The slope is the total of the products, over the total of the squares.

m = total of productstotal of squares

Careful!

The bottom uses only the x distances, squared.

Not the y distances.

Careful: the bottom is the x distances squared

8/5 is 1.6.

m = 85 = 1.6

4 Find b

The line goes through the mean point.

So b is the mean y, minus m times the mean x.

b = mean y − m × mean x

1.6 times 2.5 is 4.

5.5 minus 4 is 1.5.

b = 5.5 − 1.6 × 2.5 = 5.5 − 4 = 1.5

So the line of best fit is y = 1.6x + 1.5.

= y = 1.6x + 1.5

5 Draw the line

Now the points on a graph.

Each point is a dot.

The line goes through the mean point.

The line y = 1.6x + 1.5: it passes close to all the points.

6 Predict

To predict, we put x = 6 into the line.

y = 1.6 × 6 + 1.5

1.6 times 6 is 9.6.

Plus 1.5 is 11.1.

y = 11.1

On the graph: at x = 6, the line is at 11.1.

7 Check

Let's check: the mean point must be on the line.

1.6 times 2.5 plus 1.5 is 5.5.

That is the mean y.

So it is right!

1.6 × 2.5 + 1.5 = 5.5

Let's look back.

First: find the means.

Then: make the table.

Then: find the slope.

Then: find b.

Then: draw the line.

Then: predict.

Last: check.

Answer
= y = 1.6x + 1.5

Your turn

Try this one yourself, then check:

Best-fit line: (1, 4) (2, 6) (3, 4) (4, 8); predict x = 6
Show the answer
y = x + 3; x = 6: y = 9

More from Line of best fit

The whole lesson: Line of best fit →