Linear Regression

ByHariharan Rajendran

Linear Regression

Before starting with linear regression, let us try to understand the machine learning concepts.

As of today, machine learning is one of the trending technologies as the applications are started to consume real-time data and deliver machine learning services.

As part of machine learning, we have three different types of machine learning models available.

  1. Supervised Learning
  2. Unsupervised Learning
  3. Reinforcement learning

In Supervised Learning, the system tries to learn from the previous examples that are given.

Under supervised learning, we have classification and regression models.

One of the common and simple techniques for predicting a continuous variable is called linear regression.

It assumes a linear relationship between the outcome and the predictor variables.

The linear regression equation can be written as y = b0 + b*x + e, where:

  1. b0 is the intercept,
  2. b is the regression weight or coefficient associated with the predictor variable x.
  3. e is the residual error

This post covers the linear regression on excel and R studio.

Linear Regression on Excel

Follow the below steps to perform the linear regression in excel

Step 1: Consider you have year wise sales amount. You are in the situation to predict the sales amount for the year 2011.

Step 2: Create a scatter plot like below with Year and Sales Amount

Step 3: Right-click on the line and choose trendline.

Step 4: Display the equation on the trendline by selecting the checkbox on the Format trendline properties.

Step 5: Predict the value using the generated formula for existing values.

Step 6: Predict for the year 2011.

As you can see the values are not 100% correct, we need to adjust the con-efficient and reduce the r2 values to get the perfect result.

About the Author

Hariharan Rajendran author

Hariharan Rajendran is a Microsoft Certified Trainer and Lead BI Solutions Consultant with 8+ years of experience in Database, BI and Azure platforms. Hariharan is also an active community leader, speaker & organizer and leads the Microsoft PUG (Power BI User Group – Chennai), SQLPASS Power BI Local Group – Chennai and an active speaker in SQL Server Chennai User Group and also a leader in Data Awareness Program worldwide events. Hariharan also frequently blogs (www.dataap.org/blog), provides virtual training (on ad-hoc basis) on Microsoft Azure, Database Administration, Power BI and database development to worldwide clients/audience.

Comments Are Closed!!!