A regression line or line of best fit allows us to use the explanatory variable x to make predictions for the response variable y.
The equation of a regression line for an independent variable x and a dependent variable y is
where
is the predicted y-value for a given x-value.
The slope m and y-intercept b are given by

and

where
is the mean of the y-values in the data set and
is the mean of the x-values. The regression line always passes through the point
.
.
Example. Find the equation of the regression line for the advertising expenditures and company sales data.
| Advertising expenses (1000s of $), x |
Company sales (1000s of $), y |
|
2.4 |
225 |
|
1.6 |
184 |
|
2.0 |
220 |
|
2.6 |
240 |
|
1.4 |
180 |
|
1.6 |
184 |
|
2.0 |
186 |
|
2.2 |
215 |
.
Let’s look at the scatter plot.




.
Guidelines.
1. Find the sum of the x values.
2. Find the sum of the y values
3. Multiply each x value by its corresponding y value and find the sum.
4. Square each x value and find the sum.
5. Square each y value and find the sum. Actually, we don’t need this one for this application, but it was fun finding it.
6. Use these five sums to calculate the slope and y-intercept.
.
| Advertising expenses (1000s of $), x |
Company sales (1000s of $), y |
xy |
x2 |
y2 |
|
2.4 |
225 |
540 |
5.76 |
50625 |
|
1.6 |
184 |
294.4 |
2.56 |
33856 |
|
2.0 |
220 |
440 |
4 |
48400 |
|
2.6 |
240 |
624 |
6.76 |
57600 |
|
1.4 |
180 |
252 |
1.96 |
32400 |
|
1.6 |
184 |
294.4 |
2.56 |
33856 |
|
2.0 |
186 |
372 |
4 |
34596 |
|
2.2 |
215 |
473 |
4.84 |
46225 |
|
∑x = 15.8 |
∑y = 1634 |
∑xy = 3289.8 |
∑x2 = 32.44 |
∑y2 = 337,558 |
.
Using these sums and n = 8, the slope is


and the y-intercept is


.
Here’s what we have…

.
The regression line is ![]()
.
Now check this out.



.
We can also use our LinReg feature. In this screen a is the slope m, and b is the y-intercept.

.
Example. Use the regression line in the previous example to predict the expected company sales (in 1000s of dollars) for the following advertising expenditures (in 1000s of dollars).
a. 1.5 thousand dollars


When the advertising expenditures are $1500, the company sales are about $180,154.
.
b. $2800, which is 2.8 thousand dollars


When the advertising expenditures are $2800, the company sales are about $246,101.
.
An important consideration… Prediction values are meaningful only for x-values in or close to the range of the data. The x-values in the original data set range from 1.4 to 2.6. So, it would not be appropriate to use the regression line
to predict company sales for advertising such as 0.5 ($500) or 5.0 ($5000).
.
A long alternative…







.












































