statsmodels supports statistical modeling in Python alongside pandas, NumPy, SciPy, Matplotlib, seaborn, and scikit-learn. Its demonstrated role is fitting interpretable regression models and inspecting statistical output. section 1.2.1 section 4.2.2
Core workflows include:
- Fit ordinary least squares regression with sm.OLS(y, x).fit(), adding an intercept explicitly with sm.add_constant(). section 4.2.2
- Fit logistic regression with smf.logit(...).fit() and inspect coefficients, p-values, likelihood statistics, and goodness-of-fit measures. section 5.2.2
- Investigate multicollinearity with auxiliary OLS regressions and variance inflation factors, then compare reduced predictor sets. section 5.2.2
Predicting split times
Regress stage2 against stage1, fit the model, and print its regression table: lm = sm.OLS(y, x).fit(); print(lm.summary()). The output includes R-squared, coefficients, standard errors, t statistics, and information criteria. section 4.2.2
>>> import statsmodels.api as sm >>> y = mds['stage2']
Use the compact listing to trace imports, response-variable selection, and the first OLS setup. section 4.2.2
