When we start analyzing any data we try to decode the hidden message in that data. We try to predict something unknown. We analyze the input and try to find output and thats is the point where we wish there should be some mechanism which should be able to predict the output. SLR is one of the method which can assist us to find the relation between one variable and target variable to predict the target.
But before we go for the prediction model building we should understand what is Linear regression.
As name suggest it is Linear approach to design a model with relationship between two or more variable. If it is between one variable and target we simple linear regression but if the variables are more than one than we have Multple linear regresion.
Where can we use Linear Regression
To evaluate sales and trends
To analyze the impact of price change
TO Assess risk in financial services and insurance domain
Here in this segment we are going to deal with Simple Linear regression.
Steps to follow
Read the data
Data cleaning
Null Values elimination
Outliers elimination
Model building
Train test split
Creating stats model by train data
Adding constant
Checking the statistical parameters
Predicting y value
Residual Analysis
Finding error distribution - It should have normal distribution with no specific pattern of sitribution
Prediction on test set
Model Evaluation
Calculate r squared for both train and test. As less is the difference between test and train that much good is model.
Comments