OLS with Python and Statsmodels
OLS, a kind of linear least squares approach, is used in statistics to estimate unidentified parameters in a linear regression model. By minimizing the sum of squares of the differences between the observed values of the dependent variable and the values predicted by the linear function of the independent variable, OLS derives the parameters of a linear function from a set of explanatory variables in accordance with the least squares principle.
As a reminder, a linear regression model establishes the relationship between a dependent variable (y) and at least one independent variable (x), as follows:
In the OLS method, we have to choose the values of and , such that the total sum of squares of the difference between the calculated and observed values of is minimized.
OLS can be described in geometrical terms as the sum of all the squared distances between each point to the regression surface. This distance is measured...