Aisaturdays Ogbomoso, Cohort2, WEEK 6: Introduction to Simple Linear Regression

Lautech DataScience
2 min readMar 4, 2019

--

Linear Regression is a predictive algorithm which provides a linear relationship between prediction(y) and input(x)

The Simple linear regression is an algorithm that is very useful while working on a prediction task and it is defined by the equation:

y=mx+c or y=b0+b1x

where y is the dependent variable and after the model is built will be the predicted value

m and c are the slope and y-intercept/b0 and b1 are the values that will be found by the linear regression algorithm, they are also called coefficients and they can be thought of as multipliers that help to establish a relationship between x, the independent variable and y, the dependent variable. This therefore implies that they show how much a unit change in the independent variable affects the dependent variable.

x is the independent variable and is also known as the input x provided to predict y.

For a simple linear regression algorithm, we only have one independent variable which explains the reason for its name ‘simple’.

Finding the regression model

The regression model is found using the OLS(Ordinary Least Square). The way the Ordinary Least Square works is shown in this equation:

Y=B0+B1X

B0=mean of y- B1*mean of x

Where B1= for i=1 to m (summation(xi-mean of x)(yi-mean of y))/summation(xi-mean of x)²

NB: (xi-mean of x) is the deviation score i.e how much it deviates from the value.

(yi-mean of y)-Error, also called the residual.

The regression analysis requires the Least Square Error to be done/calculated for the many different lines that can fit through the data. The line that has the minimum Least Square Error differences compared to the other lines is the best fitting line. The equation for this line represent your simple linear regression model.

We had a great time introducing ourselves to this algorithm.

Thanks to our coach 0basa Samuel temitope for taking the class and contributing to this write-up and thanks to Daniel Ajisafe for guiding us through.
We mustn’t forget to thank our partner Intel for sponsoring us and our fellow coaches and ambassadors for making the class possible.

follow us on twitter

--

--

Lautech DataScience

A community of data scientists and AI practitioners in LAUTECH.