April 2016
Beginner to intermediate
384 pages
8h 36m
English
Ordinary Least Squares (OLS) is also a linear model. In fact, a linear regression is estimated using the least squares method as well. The OLS is, however, capable of estimating a model where the relationship between the dependent and independent variables is nonlinear as long as this relationship is linear in parameters.
To execute this recipe, you will need pandas and Statsmodels. No other prerequisites are required.
We will, as always, wrap our model estimation efforts in a function (the regression_ols.py file):
import statsmodels.api as sm @hlp.timeit def regression_ols(x,y): ''' Estimate a linear regression ''' # add a constant to the data x = sm.add_constant(x) ...
Read now
Unlock full access