OLS Regression with Python

Scikit-learn

Scikit-learn can be used to run a normal regression, however, its focus as a library is on machine learning and prediction, not statistical inference, so it doesnt provide a full set of regression statistics. See statsmodel implementation below.

from sklearn.linear_model import LinearRegression ols = LinearRegression() X = [[1,1],[1,3]] y = [[1],[2]] # X and y are numpy matrices ols.fit(X, y) intercept = ols.intercept_ coefficients = ols.coef_