Solveeit Logo

Question

Question: How do you find the slope of the regression line for the following set of data? X values -3 0 3 5 ...

How do you find the slope of the regression line for the following set of data?
X values -3 0 3 5 3
Y values 7 4 -2 2 -3

Explanation

Solution

To calculate the slope and intercept of a regression line, we are going to take the set of data having xx and yy values. We are taking xx and yy values because we have to calculate the slope of a straight line and the straight line is of the form y=mx+cy = mx + c, where "mm and cc" corresponds to slope and intercept of the straight line. We are taking the set of xx and yy values (x,y)\left( {x,y} \right) as: (3,7),(0,4),(3,2),(5,2),(3,3)\left( { - 3,7} \right),\left( {0,4} \right),\left( {3, - 2} \right),\left( {5,2} \right),\left( {3, - 3} \right). Then, find the slope of the regression line for the given set of data by putting the values of x,y,nx,y,n in the formula for slope of the regression line.
Formula used:
The formula for slope of the regression line is as follows:
m=nxy(x)(y)nx2(x)2m = \dfrac{{n\sum {xy} - \left( {\sum x } \right)\left( {\sum y } \right)}}{{n\sum {{x^2}} - {{\left( {\sum x } \right)}^2}}}

Complete step by step answer:
Let us assume that we have drawn the regression line using the following set of xx and yy values:
(3,7),(0,4),(3,2),(5,2),(3,3)\left( { - 3,7} \right),\left( {0,4} \right),\left( {3, - 2} \right),\left( {5,2} \right),\left( {3, - 3} \right)
The above coordinates are plotted on the graph where in each bracket, first coordinate is the xx coordinate and the second coordinate is the yy coordinate.
We know that the equation of a straight line contains a slope and intercept and in the below, we are writing the formula for slope and intercept of a regression line.
The formula for slope of the regression line is as follows:
m=nxy(x)(y)nx2(x)2m = \dfrac{{n\sum {xy} - \left( {\sum x } \right)\left( {\sum y } \right)}}{{n\sum {{x^2}} - {{\left( {\sum x } \right)}^2}}}
Now, using the above set of xx and yy in the above equation we get,
m=5(21+06+109)(3+0+3+5+3)(7+42+23)5(9+0+9+25+9)(3+0+3+5+3)2m = \dfrac{{5\left( { - 21 + 0 - 6 + 10 - 9} \right) - \left( { - 3 + 0 + 3 + 5 + 3} \right)\left( {7 + 4 - 2 + 2 - 3} \right)}}{{5\left( {9 + 0 + 9 + 25 + 9} \right) - {{\left( { - 3 + 0 + 3 + 5 + 3} \right)}^2}}}
m=5×(26)8×85×5282\Rightarrow m = \dfrac{{5 \times \left( { - 26} \right) - 8 \times 8}}{{5 \times 52 - {8^2}}}
m=1306426064\Rightarrow m = \dfrac{{ - 130 - 64}}{{260 - 64}}
m=194196\Rightarrow m = \dfrac{{ - 194}}{{ - 196}}
m=97980.989\therefore m = \dfrac{{97}}{{98}} \approx 0.989
Final solution: Hence, the slope of the regression line for the given set of data is 9798\dfrac{{97}}{{98}} or 0.9890.989.

Note:
Regression line we have to draw when we have a dependent and independent variable. The independent variable we have plotted on the xx-axis and the dependent variable we have plotted on the yy-axis and then to get the best fit line which is passing through these points we need the slope and intercept formula. This is the example where we require calculating the slope and intercept of a regression line.