Machine Learning | Linear Regression in R

Lets us understand the linear regression model with a example.we would load the real estate dataset from a csv file. 
One of the most common modeling approaches in statistical learning is linear regression. In R, use the lm function to generate these models. The general form of a linear regression model is
 Y = C+M1x1+M2x2+M3x3+Mnxn+ Error Term 
Equation of mlr : 
 Y = Dependent variable is Selling Price 
 C= Constant 
 X1 = 1st INdependent variable , X2 = 2nd Independent variable ,  X3 = 3rd  Independent variable 
 M1= Slope For X1 : First Ind variable In Your Dat A( Local Selling Price ) 
 M2 = Slope For X2 : Second Ind variable In Your Data ( No Of Bathroom)
 M3 = Slope For X3 : Third Ind variable ( Area Of Site) and so on


Now lets built the model. In order to create a linear regression model lm() function is used as shown below.
Summary shows size of the living space is most significant variable.
In the summary, as the p-value in the for most variable is more than 0.05 and we consider them to be insignificant in contributing to the value of the variable "Selling Price". Only Size of living space impacts the "Selling Price" value in this regression model.
Now lets us try to predict the selling price and plot the graph to compare the results.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.