Linear regression is a basic and commonly used type of predictive analysis in statistics.Â Its complete idea is to examine two things. First, to check whether a set of predictor variables do a good job in predicting an outcome. And second, to find which variable, in particular, is significant predictors of the outcome variable, and in what way.Â These regression estimates are very useful for explaining the relationship between one or more independent variables & only one dependent variable.Â The simplest form is the linear equation. In this article, we will discuss the linear regression formula with examples. Let us begin the topic!

**Linear Regression Formula**

**What is Linear Regression?**

It is very important and used for easy analysis of the dependency of two variables. One variable will be considered to be an explanatory variable, while others will be considered to be a dependent variable. Linear regression is a linear method for modeling the relationship between the independent variables and dependent variables. The linearity of the learned relationship makes the interpretation very easy. Linear regression models have long been used by people as statisticians, computer scientists, etc. who tackle quantitative problems. For example, a statistician might want to relate the weights of individuals to their heights using a linear regression model.

**Types of Linear Regression Analyses**

**Simple linear regression:**It has one dependent variable i.e. interval or ratio. And, one independent variable i.e. interval or ratio.**Multiple linear regression:**It has one dependent variable i.e. interval or ratio. And two or more independent variables i.e. interval or ratio.**Logistic regression:**It has one dependent variable (binary). And two or more independent variable(s) such as interval or ratio.**Ordinal regression:**It has one dependent variable (ordinal) and one or more independent variable(s) which are nominal.**Multinomial regression:**It has one dependent variable i.e. nominal. And, one or more independent variable(s) i.e. interval or ratio.**Discriminant analysis:**It has one dependent variable (nominal). And one or more independent variable(s) i.e. interval or ratio.

**Linear Regression Formula Analyses**

The equation is given by:

y=a+bx

a and b can be computed by the following formulas:

b =\(\frac{n\sum xy-\left(\sum x\right)\left(\sum y\right)}{n\sum x^{2}-\left(\sum x\right)^{2}}\\\)

a = \(\frac{\sum y-b \left (\sum x \right )}{n}\)

Where,

x and y are the variables for which we will make regression line.

- b =Â Slope of the line.
- a =Â Y-intercept of the line.
- XÂ = Values of the first data set.
- Y = Values of the second data set.

## Solved Examples

Q.1: Find out the linear regression equation for the following sets of data:

X | Â 2 | Â 3 | Â 5 | Â 8 |

Y | 3 | 6 | 5 | Â 12 |

Solution:

X | Y | X^2 | XY |

2 | 3 | 4 | 6 |

3 | 6 | 9 | 18 |

5 | 5 | 25 | 25 |

8 | 12 | 64 | 96 |

\(\sum X= \)18 | \(\sum Y= 26\) | Â \(\sum X^2 = 102\) | \(\sum XY= 145\) |

Now we will apply the formula to get values of a and b, as follows:

\(b =\frac{n\sum xy-\left(\sum x\right)\left(\sum y\right)}{n\sum x^{2}-\left(\sum x\right)^{2}}\\\)

\(b= \frac{4 \times 145 â€“ 18 \times 26}{4 \times 102 â€“ 324}\\\)

\(b = \frac{112}{84}\\\)

b = 1.33

\(a = \frac{\sum y-b \left (\sum x \right )}{n} \\ =Â \frac{26 -1.33 \times 18}{4}\\\)

a = 0.515

Linear regression equation is given by:

y = 0.515 + 1.33x

I get a different answer for first example.

I got Q1 as 20.5

median 23 and

Q3 26