Skip to content
John Sakon edited this page Mar 2, 2023 · 86 revisions

This wiki page assembles a collection "official" and user-contributed examples, tutorials and recipes for statsmodels.

Official examples

A set of notebook examples are provided as part of the official Statsmodels documentation.

User contributions

If you have an interesting example, or if you can write a quick tutorial describing one of statsmodels' features, please consider posting it here. We would be delighted!

Feel free to post your example file in any of the common formats (e.g. .py, .rst, .html) and to use any hosting service you like. One very slick, free, and convenient alternative is to:

  1. Write-up your example in an IPython notebook
  2. Save the content of the .ipynb file in a Gist
  3. Use nbviewer to display the notebook in html format on the web. This step simply involves swapping the domain name in the Gist URL (e.g. https://gist.github.com/3484337 -> http://nbviewer.ipython.org/3484337)

Please post your contributions below!

User-contributed examples

NOTE: ALL OF THE EXAMPLES HOSTED ON umich.box.com ARE AVAILABLE TO DOWNLOAD FROM kshedden HERE:

www.dropbox.com/scl/fo/mylhfjbpl2zlc5z5m4prq/h?dl=0&rlkey=li52chs6rcl6lejspde6n0oqf

Multiple testing and False Discovery Rates

Predictive modeling

Dotplots (forest plots)

Principal Component Analysis

Regularized model fitting

Generalized Linear Models

Scatterplot smoothing (lowess)

  • Cross sectional smoothing of NHANES data HTML View

Mediation analysis

Survival analysis

Covariance matrix estimation

  • Simulation study using "corr_nearest" HTML View

Linear Mixed Models

Generalized Estimating Equations (GEE)

Clone this wiki locally