# Question Video: Calculating the Equation of the Least Squares Regression Line Mathematics

The scatterplot shows a set of data for which a linear regression model appears appropriate. The data used to produce the scatterplot is given in the table shown. Calculate the equation of the least squares regression line of 𝑦 on 𝑥, rounding the regression coefficients to the nearest thousandth.

03:13

### Video Transcript

The scatterplot shows a set of data for which a linear regression model appears appropriate. The data used to produce the scatterplot is given in the table shown. Calculate the equation of the least squares regression line of 𝑦 on 𝑥, rounding the regression coefficients to the nearest thousandth.

Essentially, linear regression is a single independent variable that’s used to predict the value of a dependent variable. So this line will help predict the dependent variable. The equation of this line is 𝑦 equals 𝑎 plus 𝑏𝑥, where 𝑎 is equal to 𝑦 minus 𝑏𝑥, where 𝑦 is the mean 𝑦 value and 𝑥 is the mean 𝑥 value. And 𝑏 is equal to S𝑥𝑦 divided by S𝑥𝑥. S𝑥𝑦 is the covariance of 𝑥 and 𝑦 divided by 𝑛 and S𝑥𝑥 is a variance of 𝑥 divided by 𝑛.

The formulas for these, S𝑥𝑦 is equal to the sum of 𝑥 times 𝑦s minus the sum of 𝑥 times the sum of 𝑦 divided by 𝑛 and then S𝑥𝑥 is equal to the sum of 𝑥 squareds minus the sum of the 𝑥s squared divided by 𝑛. Let’s go ahead and make a table of everything we need to find. Let’s first begin by finding 𝑏. Here are our formulas. So if we take all our 𝑥s and we square them, we have these answers. And if we take 𝑥 times 𝑦, we have these answers. And if we would find the sum of each column, we have these: 18, 45.1, 51, and 78.05.

18 is the sum of the 𝑥s. 45.1 is the sum of the 𝑦s. 51 is the sum of the 𝑥 squares and 78.05 is the sum of 𝑥 times 𝑦s. And now we’ve plugged them in correctly. After multiplying and dividing, we have 78.05 minus 101.475 divided by 51 minus 40.5, which is equal to negative 23.475 divided by 10 and a half which equals negative 2.236. This is the value of 𝑏.

So for our equation, 𝑦 equals 𝑎 plus 𝑏𝑥, we have 𝑦 equals 𝑎 minus 2.236𝑥. So now we need to find 𝑎. 𝑎 was equal to the mean value of 𝑦 minus 𝑏 times the mean value of 𝑥. To find the mean, you take the sum and divide by, in this case, eight since there’s eight 𝑥s and eight 𝑦s. After plugging in, this results in 10.669. Therefore, the equation of the least squares regression line of 𝑦 on 𝑥 will be 𝑦 equals 10.669 minus 2.236𝑥.

Now remember, depending on how you rounded, for example, when you found the 𝑥 times 𝑦s, we rounded three decimal places right away. So therefore, keep in mind that your final answer maybe just a little bit different depending on how far you rounded throughout your work.