# What is a Linear Regression?

Whenever we start our journey into the Machine Learning, linear regression is the first basic algorithm which we study into the regression problem. It is a very straightforward, easy but very important algorithm. So let’s see what this linear regression is?

*“The linear regression algorithm establishes the relationship between the dependent(Y) and the independent (X) variables by finding the best fit straight line.”*

The equation for the linear regression is **Y = mx+c**

Where **m** is the slope and **c** is the intercept of the line.

In the above diagram, the straight line which you see is the best-fitted line.

## Example of Linear Regression

Let’s take an example of the chance of admission in foreign universities on the basis of GRE scores. In this example, the *‘chance of admission’* is the dependent variable and *‘GRE score’* is the independent variable. Here it is very clear that the chance of whether admission will be done or not is totally dependent on the GRE score. If you have a better score then the chances of admission are more, and if the score is less then the chances of admission are very less. The independent variable can be more than one. For example, the chance of admission can also depend on the CGPA, TOEFL score, University rating, whether you have published a paper or not, etc.

## Residual

Residual is defined as the difference between the predicted value and the measured value.

# Accuracy measurement of the model

## Mean Square Error

Mean Square Error(MSE) is used to find out the accuracy of the linear model. It tells that the how closed is the regression line to the points. It minimizes the error.

## R Square

R Square shows how close the data is to the fitted regression line. It is also known as the coefficient of determination.

There are some other ways to measure the accuracy of the model such as adjusted R square, root mean square error(RMSE), etc. If you want to know about click here.

I will discuss all these terms in detail in my next post.