Knowing how to calculate regression you can know how to establish a relationship between an independent variable (x) and dependent variable (y). A regression can be a linear regression or non linear regression. Regression equations have a wide range of applications in many statistical calculations.
A straight line depicts a linear regression and an equation of first order is used to describe this type of regression. Higher order equations are used to describe non-linear regression. This article will help you in calculating linear regression manually using an equation. Linear regression is also called as simple regression.

The equation for linear regression is given as follows.
Regression Equation(y) = a + bx
In the above equation,
- “b” is the slope of the regression line
- “a” is the intercept point of the regression line and y- axis
- “x” and “y” are the variables where y is a dependent variable that depends upon the values of “x” and “x” is an independent variable which can take any value.
The equations for slope “b” and intercept “a” are as given below:
Slope (b) = (NΣXY – (ΣX) (ΣY)) / (NΣX2 - (ΣX) 2)
Intercept (a) = (ΣY – b (ΣX)) / N
In the above equations,
- X = First Score
- Y = Second Score
- ΣXY = Sum of the product of first and Second scores
- ΣX = Sum of First scores
- ΣY = Sum of Second Scores
- ΣX2 = Sum of square First Scores
Calculating linear regression manually:
Let me explain calculating linear regression using a simple example. Using a calculator would lessen your effort in the calculations as the calculations are somewhat complicated. Suppose we want to calculate linear regression for the values of x and y as,
X = (60, 61, 62, 63, 65)
Y = (3.1, 3.6, 3.8, 4, 4.1)
Now, to find out the regression equation we need to calculate all the required values that are necessary to place in the above equations. Steps for calculating linear regression are as given below.
- Step 1: Initial step is to calculate the number of values. Make sure that the number of x values and y values is same. In the above data we have been given 5 values.
Therefore,
N = 5
- Step 2: Now, find the values of XY i.e. the product of x values and y values.
Therefore,
|
XY |
|
60 * 3.1 = 186 |
|
61 * 3.6 = 219.6 |
|
62 * 3.8 = 235.6 |
|
63 * 4 = 252 |
|
65 * 4.1 = 266.5
|
- Step 3: Find the values of X2.
|
X2 |
|
60 * 60 = 3600 |
|
61 * 61 = 3721 |
|
62 * 62 = 3844 |
|
63 * 63 = 3969 |
|
65 * 65 = 4225 |
- Step 4: Now, that we have the values of X, Y, XY and X2 we calculate their summations which are to be used in our equations.
ΣX = 60 + 61 + 62 + 63 + 65 = 311
ΣY = 3.1 + 3.6 + 3.8 + 4 +4.1 = 18.6
ΣXY = 186 + 219.6 + 235.6 + 252 + 266.5 = 1159.7
ΣX2 = 3600 + 3721 + 3844 + 3969 + 4225 = 19359
- Step 5: Substitute the above calculated values in the equation of the slope and you will get the value of the slope of the line whose x and y values are given to us.
Slope (b) = (NΣXY – (ΣX) (ΣY)) / (NΣX2 – (ΣX) 2)
= ((5)*(1159.7)-(311)*(18.6))/((5)*(19359)-(311)2)
= (5798.5 – 5784.6)/(96795 – 96721)
= 13.9/74
= 0.19
Therefore, Slope of the line is 0.19.
- Step 6: Substitute the values in the equation of the intercept to get the value of the intercept.
Intercept (a) = (ΣY – b (ΣX)) / N
= (18.6 – 0.19(311))/5
= (18.6 – 59.09)/5
= -40.49/5
= -8.098
- Step 7: Place the values obtained by calculating the slope of the line and the intercept of the line in the equation of regression of the line.
Therefore,
Regression Equation(y) = a + bx
= -8.098 + 0.19x
Now, you can find the value of y for any value of x, suppose you want to find out the approximate value of y when x = 64. Place the value of x in the above equation for which y value is to be found out and solve the equation, you will get the required value of variable y.
Therefore,
Regression Equation(y) = a + bx
= -8.098 + 0.19(64).
= -8.098 + 12.16
= 4.06
- We usually use regression equations to interpret the relationship between two variables by drawing graphs.
- You can also calculate the equation of linear regression using Excel sheets. Just insert the given values of x and y in two separate columns in the Excel sheet and calculate the required values using the formulas given in the formulas tab of the Excel sheet.
If you want to plot a regression line using the Excel sheet then follow the steps given below. You need not perform any calculations initially, you can directly use the X and Y values in this.
- Step 1: Before plotting a regression line, you need to plot a scatter graph using the X and Y values.
- Step 2: When the chart window of that scatter graph is highlighted, add the regression line to it by clicking on the chart and then choosing “add trendline”.
- Step 3: When you do this a dialogue box appears. In this dialogue box choose linear trend/regression type.
- Step 4: Now, choose the “options” tab and then click on “display equation on chart”.
- Step 5: Now, if you click on the “ok” button the dialogue box closes and the chart displays the regression line along with the equation of regression.
Hope the above methods of calculating regression have helped you. You can also use online calculators for calculating regression. Substitute the x and y values in the online calculators and click on the calculate button and you will get the equation of regression calculated.
Related Tags: how to calculate regression, linear regression manual calculation, how to manually calculate linear regression, How to Calculate Regression Line, how to calculate regression equation, linearity manual calculation, calculating regression, manually calculating linear regression
Related Content: