Whether you are new to data science or even an experienced veteran, interpreting the results of a machine learning algorithm can be a challenge. The challenge is to understand the results of this model. Does that result mean how well the model worked with the data that you used to train it ? Linear regression is one of the most commonly used methods used for inference and prediction. But often people tend to ignore OLS assumptions before interpreting the results of this. Therefore, this is an important step for analysing various statistics released by OLS. I am going to explore the house price prediction dataset, a small, simple dataset containing observations of various house characteristics and prices.

Image for post

Dependent(Predicted) variable- price

Independent variable- size

    y = data['price']
	x1 = data['size']
	x = sm.add_constant(x1)
	results = sm.OLS(y,x).fit()
	results.summary()

Image for post

First Part(model Summary) Interpretation

Dep. Variable: Here dependent variable is price that we are going to predict through model.

Model: OLS stands for Ordinary Least Squares. Ordinary least squares (OLS) is a type of linear least squares method for estimating the unknown parameters in a linear regression model. OLS selects the parameters of a linear function of a set of explanatory variables by the principle of least squares.

Method: Least squares is a standard approach in regression analysis to approximate the solution by minimising the sum of the squares of the residuals.

No of Observations: Total no of observations present in dataset

Df Residuals: The df(Residual) is the sample size minus the number of parameters being estimated, so it becomes df(Residual) = n — (k+1)

In our case n=100,k=1

df(Residual)=98

**R-Squared: **_R_2 is a statistic that will give some information about the goodness of fit of a model. It ranges from 0 to 1. In our case value of R-squared is 0.745 so it explains 74% of variance is explained by the model.

#r-squared #regression-analysis #data-science #dw-test #ols #testing

How to Interpret Results of OLS
55.45 GEEK