Citation and evidence

statsmodels

13 min full readUpdated 31 references

This article's verification

Report a problem with this article

Edit article
More

Use this article

Raw MarkdownExplore connections

Improve this page

Revision historyDiscuss this article

Topics

Data ScienceDeveloper ToolsStatistics

Cite this article

statsmodels is an open-source Python library for estimating statistical models, running statistical tests and exploring data, released under the Modified (3-clause) BSD license.[1] It began as the models module of SciPy, written by the statistician Jonathan Taylor, and was turned into a standalone package during Google Summer of Code 2009.[2] Skipper Seabold and Josef Perktold described it in a 2010 SciPy conference paper as "a library for statistical and econometric analysis in Python".[3] The library covers linear regression, generalized linear models, discrete choice and count models, robust and mixed-effects models, a large time series module and a wide range of hypothesis tests, and each estimator comes with an extensive set of result statistics.[1][20]

The project's own FAQ says that, compared with other Python modelling tools, statsmodels "focuses more heavily on the statistics and diagnostics underlying the models than having the most cutting-edge or predictive models", and that its user base has historically leaned toward econometrics.[17] As of November 2026 the latest release is version 0.15.0, published on August 27, 2026.[1][6]

Overview

FieldValue
TypeStatistical modelling and econometrics library
LanguagePython, with Cython extensions
Original authorJonathan Taylor (SciPy models module)
Copyright noticeJosef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers
First PyPI release0.1.0b1 (as scikits.statsmodels), August 2009
Latest release0.15.0, 2026-08-27
LicenseBSD 3-clause
Python requirement (0.15.0)3.10 or later
Core dependencies (0.15.0)NumPy, SciPy, pandas, patsy, formulaic, packaging
Websitestatsmodels.org
Repositorygithub.com/statsmodels/statsmodels

Expanded article table

Sources for the table: the project home page and user guide, the PyPI listings and the GitHub repository.[1][20][5][6][26]

"Allen Downey - Time Series Analysis with StatsModels | PyData Global 2024", video from PyData, published April 21, 2025. Watch on YouTube.

History

Origins in SciPy and NIPY

According to Seabold and Perktold's 2010 paper, statsmodels started as a SciPy component called models, written by Jonathan Taylor, whom the paper describes as a statistician now at Stanford. The code was later removed from SciPy and moved into the NIPY neuroimaging project so that it could mature. Improving it was accepted as a SciPy-focused Google Summer of Code project in 2009 and again in 2010, and at the time of the paper it was distributed as a "SciKit", an add-on package for SciPy, under the import name scikits.statsmodels.[3] The project's documentation gives the same account: the models module of scipy.stats was removed from SciPy and, during Google Summer of Code 2009, was "corrected, tested, improved and released as a new package".[2] The documentation also credits Google with funding the project's Google Summer of Code participation from 2009 to 2017.[2]

The first package on the Python Package Index (PyPI) was scikits.statsmodels 0.1.0b1, uploaded on August 31, 2009, followed by versions 0.2.0 (February 2010) and 0.3.x (2011).[5] The PyPI page for that package now carries a note that the name was changed to statsmodels; the earliest version listed under the new name is 0.4.0, uploaded in June 2012.[5][6]

The 2010 paper described the main developers as economists with a background in econometrics and said that, as a result, much of the development over the previous year had focused on econometric applications.[3] At that point the main codebase had five modelling modules: regression (OLS, WLS and GLS), glm (generalized linear models with six exponential-family distributions and at least ten link functions), rlm (M-estimator robust linear models with eight norms), discretemod (Logit, Probit, multinomial logit and Poisson estimated by maximum likelihood) and contrast (helpers for linear contrasts). It also shipped tests for heteroskedasticity and autocorrelation, a table-printing class, a reader for Stata .dta files and fourteen bundled datasets.[3]

Time series and the SciPy 2011 paper

In 2011 Wes McKinney, Perktold and Seabold described the new time series features of scikits.statsmodels in the proceedings of the 10th Python in Science Conference. The paper covered descriptive statistics and tests for time series, and model classes for autoregressive (AR), autoregressive moving-average (ARMA) and vector autoregressive (VAR) models, including impulse response analysis and Granger causality tests.[4] The statsmodels documentation notes that AQR financially sponsored McKinney's work on VAR models.[2]

Formulas, state space models and later releases

Version 0.5.0 (August 2013), which its release notes describe as a year of work by 38 authors and more than 2,000 commits, added R-style model formulas through the patsy library, so that a model could be written as smf.ols('Lottery ~ Literacy + np.log(Pop1831)', data=data). The same release added empirical likelihood inference and multivariate kernel density estimation (both Google Summer of Code 2012 projects) and analysis of variance with type I, II and III sums of squares.[7] Version 0.6.0 (November 2014) added generalized estimating equations (GEE) for clustered and longitudinal data, with five working dependence structures.[8]

Version 0.7 was never officially released. Chad Fulton had written the state space framework for it, with Kalman filtering and maximum likelihood estimation of state space models, so 0.8.0 was the first release to include that framework.[31][9] Version 0.8.0 (February 2017) added further time series models built on the state space framework, which its release notes say were authored largely by Chad Fulton during Google Summer of Code 2015: a Kalman smoother, forecasting and simulation methods, residual diagnostics, VARMAX and dynamic factor models, and a model that decomposes a series into trend, cycle, seasonal and irregular components. It also added Markov switching regression and autoregression models, and it was the last release to support Python 2.6.[9] Later releases added, among other things:

VersionPyPI uploadSelected additions
0.9.02018-05-15VECM and cointegration tests, generalized Poisson and zero-inflated count models, Bayesian mixed GLM, factor analysis, MANOVA, Holt-Winters exponential smoothing
0.10.02019-06-24Generalized additive models (experimental), conditional logit and Poisson models, Gaussian process regression, dimension reduction methods
0.11.02020-01-22New ARIMA class with several estimators, AutoReg, STL decomposition, rolling OLS and WLS, linear exponential smoothing in state space form
0.12.02020-08-27ETS models, Theta model, STL forecasting, a dynamic factor model for large mixed-frequency datasets, meta-analysis
0.13.02021-10-01Beta regression, ordinal regression, copulas, ARDL models
0.14.02023-05-05Treatment effect estimation, hurdle and truncated count models, multiple-season STL (MSTL), extended post-estimation methods
0.15.02026-08-27Formula engine abstraction with formulaic, Polars input, Meson build, new robust estimators and tests

Expanded article table

Release dates are the first upload of each version to PyPI.[6] Feature lists come from the release notes for each version.[10][11][12][13][14][15][16]

Design

Models and results

The 2010 paper set out the package's basic object model. A base class Model serves as a template for parametric models and holds the data, while LikelihoodModel is the subclass behind most regression models. Calling a model's fit method returns a results object (Results, LikelihoodModelResults and their subclasses) that holds estimates and post-estimation statistics. Those statistics are computed lazily, only when a user asks for them, so that someone who only wants the coefficients does not pay for the rest.[3]

statsmodels names the data endog and exog (endogenous and exogenous variables) rather than y and X. The documentation explains that these correspond to the dependent and independent variables, or response and explanatory variables, and that the project chose descriptive names over one-letter ones, while noting that the choice "has been criticized" and might change.[18]

The library offers two ways to import its contents: import statsmodels.api as sm loads most public classes and functions for interactive use, and direct imports from submodules such as statsmodels.regression.linear_model avoid loading unnecessary modules in programs.[19] The formula interface lives in statsmodels.formula.api, conventionally imported as smf.[7]

A minimal ordinary least squares fit with a formula looks like this:

import statsmodels.api as sm
import statsmodels.formula.api as smf

df = sm.datasets.get_rdataset("Guerry", "HistData").data
results = smf.ols("Lottery ~ Literacy + Wealth + Region", data=df).fit()
print(results.summary())

The getting-started guide fits the same model to the Guerry dataset (historical data on the 86 French departments), building the design matrices with patsy, and gives the coefficient estimates as $\hat{\beta} = (X'X)^{-1} X'y$, where $y$ is the column of lottery wagers per capita and $X$ is the matrix of regressors with an intercept.[28]

Verification against other software

The 2010 paper argued that the same data should not produce different conclusions depending on the statistical package used, and described a test-driven process in which new models are checked against results from other software (often R, SAS or Stata) or against Monte Carlo simulation when no reference exists; deviations are recorded in the test suite.[3] The current documentation says most results have been verified against R, Stata or SAS, with the principle that "all numbers have to be verified", but that this is no guarantee the code is free of bugs.[2] It also says the interfaces of established models are mostly settled, without a formal guarantee of API stability, and that changes are introduced with long deprecation periods.[2]

Capabilities

The user guide groups the library's features into regression and linear models, time series analysis, other models, and statistics and tools.[20]

Regression and linear models

  • Linear regression: ordinary, weighted and generalized least squares, and feasible GLS with autoregressive AR(p) errors.[24] See also linear model.
  • Generalized linear models: families including Binomial, Gamma, Gaussian, InverseGaussian, NegativeBinomial, Poisson and Tweedie, with link functions such as logit, log, identity, power, complementary log-log and CDF-based links.[23]
  • Discrete dependent variables: binary (Logit, Probit), nominal (multinomial logit) and count models (Poisson, negative binomial, generalized Poisson and zero-inflated variants).[25] See logistic regression.
  • Mixed and clustered data: linear mixed effects models with random intercepts, random slopes and variance components, plus GEE and generalized linear mixed models.[29][20]
  • Other models: robust linear models, generalized additive models, ANOVA, quantile regression, survival and duration analysis, nonparametric methods, the generalized method of moments, multivariate statistics such as principal component analysis, multiple imputation by chained equations, treatment effects and empirical likelihood.[20][26]

Time series analysis

The statsmodels.tsa module provides univariate autoregressive, ARMA and ARIMA models, vector autoregressions and vector error correction models, Markov switching models, autoregressive distributed lag (ARDL) models, Holt-Winters and ETS exponential smoothing, the Theta forecasting model, and seasonal decomposition with moving averages, STL and MSTL. It also includes autocorrelation and partial autocorrelation functions and tests such as the augmented Dickey-Fuller and KPSS tests for stationarity, cointegration tests and Granger causality tests.[21]

The statsmodels.tsa.statespace subpackage fits linear Gaussian state space models with the Kalman filter. The general form it uses is

yt=Ztαt+dt+εt,αt+1=Ttαt+ct+Rtηty_t = Z_t \alpha_t + d_t + \varepsilon_t, \qquad \alpha_{t+1} = T_t \alpha_t + c_t + R_t \eta_t

where $y_t$ is the observation vector, $\alpha_t$ the unobserved state vector, $\varepsilon_t \sim N(0, H_t)$ and $\eta_t \sim N(0, Q_t)$ the disturbances, and $Z_t, d_t, T_t, c_t, R_t$ matrices describing the process.[22] Models built on this framework include SARIMAX (seasonal ARIMA with exogenous regressors), unobserved components, VARMAX, dynamic factor models and linear exponential smoothing; the framework handles missing observations, forecasting and impulse response functions.[22][26]

Statistics and tools

The stats module collects residual diagnostics and specification tests (for autocorrelation, heteroscedasticity and normality), outlier and influence measures, sandwich robust covariances, tests for proportions and rates, multiple testing procedures, power and sample size calculations, meta-analysis, mediation analysis and interrater agreement statistics.[30] Contingency tables have their own module.[20] Other parts of the package cover probability distributions, graphics such as Q-Q plots, and input and output, and the datasets package can download datasets from the Rdatasets collection.[20][19][28] A sandbox directory holds experimental code that the project does not consider production-ready.[26]

Version 0.15.0

Version 0.15.0, released on August 27, 2026, covers changes merged between May 2023 and August 2026: 655 merged pull requests and 1,740 non-merge commits by 171 contributors, according to its release notes.[16] Its main changes were:

  • Formula engine. A new formula layer can use either patsy (still the default when installed) or formulaic, selectable with the SM_FORMULA_ENGINE environment variable. formulaic became a required dependency, and the notes say this "lays the groundwork" for moving away from patsy, which has been in low-maintenance mode for several years.[16]
  • Randomness and return values. A single rng keyword replaces the older random_state and seed keywords, following the community SPEC 007 convention, and many functions that returned plain tuples now return named tuples.[16]
  • Polars support. Models and the formula interface accept Polars DataFrames and Series, which are converted to pandas internally.[16]
  • Build and platforms. The build system moved from setuptools to meson-python, with experimental Pyodide/WebAssembly support and work toward free-threaded CPython.[16]
  • New methods. New robust covariance and MM regression estimators, a multivariate least squares model, the Leybourne-McCabe stationarity test, the Games-Howell post-hoc test, Diebold-Mariano and Pesaran-Timmermann forecast tests, the Hamilton filter, a block jackknife and local false discovery rate estimation.[16]

The release also raised minimum dependency versions to NumPy 1.23.5, SciPy 1.8, pandas 1.4 and patsy 0.5.6.[16] PyPI lists Python 3.10 as the minimum supported version.[6]

Relationship to other libraries

statsmodels builds on NumPy, SciPy and pandas, and its README describes it as a complement to SciPy for statistical computations.[26][5] The 2010 paper placed it alongside other scientific Python packages of the time, including PyMC for Bayesian statistics, scikits.learn (now scikit-learn) for machine learning, and pandas for data structures, and suggested it to users of R, Stata, SAS, SPSS and similar tools who would rather work in Python.[3]

Adoption

As of November 2026 the GitHub repository had about 11,800 stars and 3,700 forks.[26] Semantic Scholar counted 6,304 citations of the 2010 Seabold and Perktold paper, which the documentation gives as the citation for the project.[27][1]

Continue reading

More from See also

More to read

Topics:Data ScienceDeveloper ToolsStatistics

References

  1. ^1 ^2 ^3 ^4 ^5statsmodels developers. "statsmodels documentation" (version 0.15.0). statsmodels.org, August 27, 2026. statsmodels.org/stable
  2. ^1 ^2 ^3 ^4 ^5 ^6statsmodels developers. "About statsmodels". statsmodels.org. statsmodels.org/...about
  3. ^1 ^2 ^3 ^4 ^5 ^6 ^7Skipper Seabold and Josef Perktold. "Statsmodels: Econometric and Statistical Modeling with Python". Proceedings of the 9th Python in Science Conference (SciPy 2010), pp. 92-96, 2010. doi.org/...Majora-92bf1922-011
  4. ^Wes McKinney, Josef Perktold and Skipper Seabold. "Time Series Analysis in Python with statsmodels". Proceedings of the 10th Python in Science Conference (SciPy 2011), pp. 107-113, 2011. doi.org/...Majora-ebaa42b7-012
  5. ^1 ^2 ^3 ^4Python Package Index. "scikits.statsmodels" (project page and release history). PyPI. pypi.org/...scikits.statsmodels
  6. ^1 ^2 ^3 ^4 ^5Python Package Index. "statsmodels" (project page and release history). PyPI. pypi.org/...statsmodels
  7. ^1 ^2statsmodels developers. "Release 0.5.0". statsmodels.org. statsmodels.org/...version0.5
  8. ^statsmodels developers. "Release 0.6.0". statsmodels.org. statsmodels.org/...version0.6
  9. ^1 ^2statsmodels developers. "Release 0.8.0". statsmodels.org. statsmodels.org/...version0.8
  10. ^statsmodels developers. "Release 0.9.0". statsmodels.org. statsmodels.org/...version0.9
  11. ^statsmodels developers. "Release 0.10.0". statsmodels.org. statsmodels.org/...version0.10
  12. ^statsmodels developers. "Release 0.11.0". statsmodels.org. statsmodels.org/...version0.11
  13. ^statsmodels developers. "Release 0.12.0". statsmodels.org. statsmodels.org/...version0.12
  14. ^statsmodels developers. "Release 0.13.0". statsmodels.org. statsmodels.org/...version0.13.0
  15. ^statsmodels developers. "Release 0.14.0". statsmodels.org. statsmodels.org/...version0.14.0
  16. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8statsmodels developers. "Release 0.15.0". statsmodels.org, 2026. statsmodels.org/...version0.15.0
  17. ^statsmodels developers. "Frequently Asked Question". statsmodels.org. statsmodels.org/...faq
  18. ^statsmodels developers. "endog, exog, what's that?". statsmodels.org. statsmodels.org/...endog_exog
  19. ^1 ^2statsmodels developers. "Import Paths and Structure". statsmodels.org. statsmodels.org/...api-structure
  20. ^1 ^2 ^3 ^4 ^5 ^6 ^7statsmodels developers. "User Guide". statsmodels.org. statsmodels.org/...user-guide
  21. ^statsmodels developers. "Time Series analysis tsa". statsmodels.org. statsmodels.org/...tsa
  22. ^1 ^2statsmodels developers. "Time Series Analysis by State Space Methods statespace". statsmodels.org. statsmodels.org/...statespace
  23. ^statsmodels developers. "Generalized Linear Models". statsmodels.org. statsmodels.org/...glm
  24. ^statsmodels developers. "Linear Regression". statsmodels.org. statsmodels.org/...regression
  25. ^statsmodels developers. "Regression with Discrete Dependent Variable". statsmodels.org. statsmodels.org/...discretemod
  26. ^1 ^2 ^3 ^4 ^5 ^6statsmodels developers. "statsmodels/statsmodels" (repository and README). GitHub. github.com/...statsmodels
  27. ^Semantic Scholar. "Statsmodels: Econometric and Statistical Modeling with Python" (citation record). Semantic Scholar, accessed November 2026. semanticscholar.org/...592d04b9ded83d4499e28924e03
  28. ^1 ^2statsmodels developers. "Getting started". statsmodels.org. statsmodels.org/...gettingstarted
  29. ^statsmodels developers. "Linear Mixed Effects Models". statsmodels.org. statsmodels.org/...mixed_linear
  30. ^statsmodels developers. "Statistics stats". statsmodels.org. statsmodels.org/...stats
  31. ^statsmodels developers. "Release 0.7.0". statsmodels.org. statsmodels.org/...version0.7

Improve this article

Add missing citations, update stale details, or write a clearer explanation. Anyone can edit: changes go live when you publish, and every edit is checked by an editor.

2 revisions · v2 · 2,625 words · full history

Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify

Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here

Reviewer note: Independent fact-check before publication on November 18, 2026: 92 claims checked against 34 cited and independent sources; 0 material and 6 minor corrections applied before publication.

Cite this page: AI Wiki. "statsmodels." aiwiki.ai, updated 18 Nov 2026, fact-checked 18 Nov 2026. CC BY 4.0. https://aiwiki.ai/wiki/statsmodels

Edit article