Linear Regression in statsmodels

Click here to watch a video on fitting linear regression models in ‘statsmodels’
Author

George I. Hagstrom

Published

September 15, 2026

I have recorded two videos on how to use the ‘statsmodels’ package in python to make linear regression models. I have also included a third video which I recorded last spring which is very long and comprehensive. The two new videos are a lot shorter and focus on AIC and on how to use residuals to do feature engineering. They also complete the end of the last meetup. I’ve edited the long video from last year to get rid of debuggin pauses to make it shorter, apologies if this made it flow less. The old video closely followed the python notebook provided by ‘ISLP’, the new videos look at the ‘hitters’ dataset.

Here are the videos:

  1. ‘statsmodels’ AIC vignette
  2. ‘statsmodels’ Feature Engineering Vignette
  3. ‘statsmodels’ Comprehensive Vignette

Here are the notebooks:

  1. New Vignette (Hitters, AIC, Feature Engineering): hitters_aic_features_vignette.ipynb
  2. Old Vignette (My take on the ISLP notebook): sm-vignette.ipynb

You can download my python notebook here: statsmodels vignette