Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store
seo-qna
SearchIcon
banner

How do you calculate the slope and intercept of a regression line?

Answer
VerifiedVerified
477k+ views
like imagedislike image
Hint: To calculate the slope and intercept of a regression line, we are going to take a set of data having x and y values. We are taking x and y values because we have to calculate the slope and intercept of a straight line and the straight line is of the form y=mx+c where “m and c” corresponds to slope and intercept of the straight line. We are taking the set of x and y values (x,y) as: (x1,y1),(x2,y2),(x3,y3)......(xn,yn) . So, we are going to write the formula for slope and intercept of a regression line which are the expressions containing x, y and n.

Complete step by step answer:
Let us assume that we have drawn the regression line using the following set of x and y values:
 (x1,y1),(x2,y2),(x3,y3)......(xn,yn)
The above coordinates are plotted on the graph where in each bracket, first coordinate is the x coordinate and the second coordinate is the y 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)2
Now, using the above set of x and y in the above equation we get,
 m=n(x1y1+x2y2+x3y3+.....xnyn)(x1+x2+x3+....xn)(y1+y2+y3+....yn)n(x12+x22+x32+....xn2)(x1+x2+x3+....xn)2
The formula for intercept of the regression line is as follows:
 c=ymxn
Substituting the values of data sets of x and y in the above equation we get,
 c=(y1+y2+y3+.....+yn)m(x1+x2+x3+....+xn)n
In the above formula, substitute the value of m (which is the slope of the regression line) which we have calculated above.
In this way, we have shown the calculation of slope and intercept of a regression line for the given set of x and y.

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