Facts Behind Linear regression

MONIKA RAJPUT
Analytics Vidhya
Published in
3 min readApr 15, 2021

--

By the end of this article you will learn what is linear regression? Maths Behind Linear Regression? Use Cases of Linear Regression. Implementation and how to evaluate Linear regression model.

Ok let’s start with the regression, if i say Linear Relationship🤔? Does it sound weird?

No absolutely not so we can define linear regression as Finding the Linear relationship between the two or multiple parameters or features.

So here the problem we are trying to solve is :

let’s take a use case, you want to predict the house price by using independent features or variables like Avg. income of people, Area population and the age of house.

By this you have the idea that if our independent variables fluctuate then the price of the house will also fluctuate.

So our main goal is to draw a best fit line between these features (a straight line).

In data science most of the things depend on the data, what type of data we are using, so for the linear regression, we have to assume some of the things about our data so let’s discuss.

  • It assumes that the relationship between dependent and independent variables must be linear and that is a very rare case in real-world data.
  • Data must be independent.
  • Our model assumes that there is no Multi-collinearity in the data

Now What’s the mathematics behind this algorithm(Read that part twice because the interviewer will ask so be ready)

y=mx +c (the equation of line)

Here Y is what we want to predict or dependent variable and X value (Independent variable) will help us to predict our Y value. And m is the slope of the line and C is our intercept.

Types Of Linear regression

  • Simple Linear Regression: Predict the output using a single feature.
  • Multiple Linear Regression: Predict the output using multiple features.

5 uses of Linear regression

  • Predictive Analytics

Predictive analytics forecasting future opportunities and risks is the most prominent application of regression analysis in business. Demand analysis, for instance, predicts the number of items that a consumer will probably purchase.

  • Operation Efficiency

Regression Models can also be used to optimize the business processes.In a call centre, we can analyze the relationship between wait times of callers and the number of complaints. Data-driven decision making eliminates guesswork, hypothesis and corporate politics from decision making.

  • Supporting Decisions

Regression is not only great for lending empirical support to management decisions but also for identifying errors in judgement. Ex a manager believe by Extending shopping our will increase the sales , however it indicates that the rise of revenue might not be sufficient to support the rise of additional employee labour charges.Hence, this analysis can provide quantitative support for decisions and prevent mistakes due to manager’s intuitions.

  • New Insights

As data is useless without proper analysis. so Regression Analysis techniques can find a relationship between different variables by uncovering patterns that were previously unnoticed.

How Can you evaluate the regression model?

4 methods by which we can evaluate our regression model-

  • R-squared

R2 corresponds to the squared correlation between the observed outcome values and the predicted values by the model. The Higher the R-squared, the better the model.

  • Root Mean squared error

which is the average squared difference between the observed actual outcome values and the values predicted by the model. The lower the RMSE, the better the model.

  • Residual Standard Error

It is a variant of the RMSE adjusted for the number of predictors in the model. The lower the RSE, the better the model.

  • Mean Absolute Error

It is the average absolute difference between observed and predicted outcomes.

Put in other words, including additional variables in the model will always increase the R2 and reduce the RMSE.

Implementation

Closure

So we have covered all facts of Linear regression hope you liked it.

Tell me which part you like the most and what I should improve or add.

Connect with me:😉

LinkedIn: http://linkedin.com/in/monika0104

Github: https://github.com/monika0123

Twitter: https://twitter.com/monikarajput99

--

--