New Zealand
Level 8 - NCEA Level 3

# Line of best fit - calculating

Lesson

In Does this Fit?, we looked at how to identify a line of best fit. A line of best fit  (or "trend" line) is a straight line that best represents the data on a scatter plot. This line may pass through some of the points, none of the points, or all of the points. In this chapter, we are going to look at how to calculate the equation of a given line of best fit.

To calculate the equation of a given line of best fit, we need to be able to calculate:

• gradient: $m=\frac{y_2-y_1}{x_2-x_1}$m=y2y1x2x1
• y-intercept/ constant term: this is the $b$b term in $y=mx+b$y=mx+b

Once you can identify these features, you can use them to make conclusions and predictions about the data.

Remember!

There are different ways to calculate the equation of a straight line. These include:

• gradient-intercept form: $y=mx+b$y=mx+b, where $m$m is the gradient and $b$b is the y-intercept
• two point form: $\frac{y-y_1}{x-x_1}=\frac{y_2-y_1}{x_2-x_1}$yy1xx1=y2y1x2x1
• point-gradient form: $y-y_1=m\left(x-x_1\right)$yy1=m(xx1)

Since lines of best fit are used in real statistical analyses, graphing them is similar to other linear models that we looked at earlier.

#### Worked Examples

##### Question 1

The equation for the line of best fit is given by $P=-4t+116$P=4t+116, where $t$t is time.

This relationship shows that over time, $P$P is:

1. remaining constant

A

decreasing

B

increasing

C

remaining constant

A

decreasing

B

increasing

C

##### QUESTION 2

A car company looked at the relationship between how much it had spent on advertising and the amount of sales each month over several months. The data has been plotted on the scatter graph and a line of best fit drawn. Two points on the line are $\left(3200,300\right)$(3200,300) and $\left(5600,450\right)$(5600,450).

1. Using the two given points, what is the gradient of the line of best fit?

2. The line of best fit can be written in the form $S=\frac{1}{16}A+b$S=116A+b, where $S$S is the value of Sales in thousands of dollars and $A$A is advertising expenditure.

Determine the value of $b$b, the vertical intercept of the line.

3. Use the line of best fit to estimate the number of sales next month (in dollars) if $\$48004800 is to be spent on advertising.

##### QUESTION 3

The table shows the number of people who went to watch a movie $x$x weeks after it was released.

 Weeks ($x$x) $1$1 $2$2 $3$3 $4$4 $5$5 $6$6 $7$7 Number of people ($y$y) $17$17 $17$17 $13$13 $13$13 $9$9 $9$9 $5$5
1. Plot the points from the table.

2. If a line of best fit were drawn to approximate the relationship, which of the following could be its equation?

$y=-2x+20$y=2x+20

A

$y=2x+20$y=2x+20

B

$y=-2x$y=2x

C

$y=2x$y=2x

D

$y=-2x+20$y=2x+20

A

$y=2x+20$y=2x+20

B

$y=-2x$y=2x

C

$y=2x$y=2x

D
3. Graph the line of best fit whose equation is given by $y=-2x+20$y=2x+20.

4. Use the equation of the line of best fit to find the number of people who went to watch the movie $10$10 weeks after it was released.

### Outcomes

#### S8-1

Carry out investigations of phenomena, using the statistical enquiry cycle: A conducting experiments using experimental design principles, conducting surveys, and using existing data sets B finding, using, and assessing appropriate models (including linear regression for bivariate data and additive models for time-series data), seeking explanations, and making predictions C using informed contextual knowledge, exploratory data analysis, and statistical inference D communicating findings and evaluating all stages of the cycle.

#### 91581

Investigate bivariate measurement data

#### 91582

Use statistical methods to make a formal inference