Linear Regression Explanation in Simple way | Data Science

Linear Regression and Multiple Regression

Simple Linear Regression :

Suppose you have a business and if I ask you, what is your monthly sales in your business?

You can see, Sales depends on different things like Marketing (i.e. Sales depends on number of Advertisement), Gender, Education, Experience etc. affect Number of Sales.

So, here Sales is a dependent variable and Marketing is an independent variable.

When one dependent variable depends on one independent variable

then it is called Simple Linear Regression.

In the below table you can see,

If we spend Re.1 in Advertisement then Sales will be 3.

If we spend Rs.2 in Advertisement then Sales will be 5.

so on…

Here we can analyze it with few data in a table but in real life there will be thousands of rows, millions of data. Then analyzing the data becomes too hard. So we plot graph to analyze data and to understand the relationship between variables.

Here we can see that by increasing the Advertisements(x) the Sales(y) also increased. So we can understand that there is a linear relationship between Advertisement and Sales. Some points will lies in a line.


· The range of the relationship lies between -1 to +1.(If all the points lies in a straight line then it is called strong relationship).

· Dependent variables are continuous in nature (i.e. it can take both decimal values, fraction values )

We can predict the future results from linear regression. How?

Suppose, If we use Rs.257 in advertisement then how many sales will be there?

The result can be calculated from the below formula and the above data (data from table).

We will form a model and predict the result.

y=A + Bx.

( y -> dependent variable, x -> independent variable, A,B->coefficient of regression )

Image Source :

By calculating (using the above formula), we get, A= 5.40 and B=0.51

Therefore y = (5.40) + (0.51)*(257)

= 136.47

Application of linear regression:

· Sales forecasting (Discussed above)

· Price estimation(Suppose, your house is 1000sq.ft. then we can estimate the price of your house)

· Employment income (Employee income depends on Experience, Gender, Education etc. But in simple linear regression we can predict the income if it is simply depends on Education )

Multiple Linear Regression :

When one dependent variable depends on more than one independent variable then it is called Multiple Linear Regression.

Equation of Multiple Linear Regression :

y=m1x1 + m2x2 + m3x3 + ….. + mnxn + c

( where, m1, m2, m3,….., mn -> Coefficient of Regression

x1, x2, x3,….., xn -> Independent Variable

y -> Dependent Variable

c -> Constant)

In the below table Sales is Dependent Variable and Emp ID, Age, Experience, Advertisement are Independent Variable.

Now, if I ask you which Independent Variable effects the most to the Dependent Variable (Sales) or

which is the most important Independent Variable to increase the number of Sales?

After calculating m1,m2,m3 and m4 we will get a maximum value among these.

Suppose, coefficient of x4 is m4 which is largest among m1,m2,m3,m4. So, Advertisement is most important Independent Variable in this data table. By changing the Advertisement value there will be a major change in Sales.

Applications of Multiple Linear Regression :

There are mainly two applications for multiple linear regression.

1. First, it can be used when we would like to identify the strength of the effect that the Independent Variables have on the Dependent Variable.

For example, does revision time, test anxiety, lecture attendance and gender have any effect on exam performance of students? Of Course, Yes. But we have to see,

which Independent Variable effect most and which effect less. Here gender will effect least to performance of students.

2. Second, it can be used to predict the impact of changes, that is, to understand how the Dependent Variable changes when we change the Independent Variables.

For example, if we were reviewing a person’s health data, Multiple Linear Regression could tell you how much that person’s blood pressure was increasing or decreasing in each unit increase or

a decrease in the index of the patient’s body mass index holding other factors constant.

As with Simple Linear Regression, Multiple Linear Regression is a way to predict continuous fluctuations.

Thank you :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store