Posted by: shijesh | April 17, 2020

Simple Linear Regression – Theory

In Simple Linear Regression, we predict a dependent variable (y) using a single independent variable(X). [Note: Independent Variable are also know as feature and Dependent Variable are also known as response]

Mathematically, Simple Linear Regression is represent by following equation:

simple linear regression

The goal of Simple Linear Regression model is to find the value of b0 and b1. Once the value of b0 and b1 is determined, we will be able to predict the value of y for a given x1.  

How do we find the value of b0 and b1 ?

  1. Using statistical method manually
  2. Using statistical software
  3. Using Microsoft Excel (In this post I will explain this method)

In machine learning programming using python, there is no need to find b0 and b1 . Using appropriate libraries, we can write the program to predict the value of y for a given value of x1.

Finding the value of b0 and b1 using MS Excel?

SLR

  1. Plot the scattered chart from the given data.
  2. Right click on any data point in the scatter charter and select “Add Trendline”
  3. Click on the trend line and select “Display Equation on Chart”.fr
  4. From the equation extract the value of  b0 and b1 (In this case b0= 7836.3 and  b1= -502.42)
  5. Using this equation you should be able to predict value of y (int this case price of the car in $) based on the value of x (in this case age of car)\slrchart

Example: if the age of the car is 6 years, then the predicted price of the car (based on trend line equation) will be

y = – 502.42 * 6 + 7836.3 = 4821.8


Leave a comment

Categories