# statsmodels

> Source: https://aiwiki.ai/wiki/statsmodels
> Updated: 2026-11-18
> Fact-checked: 2026-11-18
> Categories: Data Science, Developer Tools, Statistics
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "statsmodels." aiwiki.ai, 18 Nov 2026. https://aiwiki.ai/wiki/statsmodels
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

**statsmodels** is an open-source [Python](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/linear_regression), [generalized linear models](https://aiwiki.ai/wiki/generalized_linear_model), discrete choice and count models, robust and mixed-effects models, a large [time series](https://aiwiki.ai/wiki/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

| Field | Value |
|---|---|
| Type | Statistical modelling and econometrics library |
| Language | Python, with Cython extensions |
| Original author | Jonathan Taylor (SciPy `models` module) |
| Copyright notice | Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers |
| First PyPI release | 0.1.0b1 (as `scikits.statsmodels`), August 2009 |
| Latest release | 0.15.0, 2026-08-27 |
| License | BSD 3-clause |
| Python requirement (0.15.0) | 3.10 or later |
| Core dependencies (0.15.0) | NumPy, SciPy, pandas, patsy, formulaic, packaging |
| Website | statsmodels.org |
| Repository | github.com/statsmodels/statsmodels |

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

<figure class="embedvideo">
<iframe src="https://www.youtube-nocookie.com/embed/foMbacbuAQk" title="Allen Downey - Time Series Analysis with StatsModels | PyData Global 2024"></iframe>
<figcaption>"Allen Downey - Time Series Analysis with StatsModels | PyData Global 2024", video from PyData, published April 21, 2025. <a href="https://www.youtube.com/watch?v=foMbacbuAQk">Watch on YouTube</a>.</figcaption>
</figure>

## 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:

| Version | PyPI upload | Selected additions |
|---|---|---|
| 0.9.0 | 2018-05-15 | VECM and cointegration tests, generalized Poisson and zero-inflated count models, Bayesian mixed GLM, factor analysis, MANOVA, Holt-Winters exponential smoothing |
| 0.10.0 | 2019-06-24 | Generalized additive models (experimental), conditional logit and Poisson models, Gaussian process regression, dimension reduction methods |
| 0.11.0 | 2020-01-22 | New `ARIMA` class with several estimators, `AutoReg`, STL decomposition, rolling OLS and WLS, linear exponential smoothing in state space form |
| 0.12.0 | 2020-08-27 | ETS models, Theta model, STL forecasting, a dynamic factor model for large mixed-frequency datasets, meta-analysis |
| 0.13.0 | 2021-10-01 | Beta regression, ordinal regression, copulas, ARDL models |
| 0.14.0 | 2023-05-05 | Treatment effect estimation, hurdle and truncated count models, multiple-season STL (MSTL), extended post-estimation methods |
| 0.15.0 | 2026-08-27 | Formula engine abstraction with formulaic, Polars input, Meson build, new robust estimators and tests |

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:

```python
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](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/quantile_regression), survival and duration analysis, nonparametric methods, the generalized method of moments, multivariate statistics such as [principal component analysis](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/stationarity), cointegration tests and Granger causality tests.[21]

The `statsmodels.tsa.statespace` subpackage fits linear Gaussian [state space models](https://aiwiki.ai/wiki/state_space_model) with the [Kalman filter](https://aiwiki.ai/wiki/kalman_filter). The general form it uses is

$$y_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](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/numpy), [SciPy](https://aiwiki.ai/wiki/scipy) and [pandas](https://aiwiki.ai/wiki/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](https://aiwiki.ai/wiki/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]

## See also

- [Linear regression](https://aiwiki.ai/wiki/linear_regression)
- [Generalized linear model](https://aiwiki.ai/wiki/generalized_linear_model)
- [ARIMA](https://aiwiki.ai/wiki/arima)
- [Time series](https://aiwiki.ai/wiki/time_series)
- [Hypothesis testing](https://aiwiki.ai/wiki/hypothesis_testing)
- [Scikit-learn](https://aiwiki.ai/wiki/scikit_learn)
- [Pandas](https://aiwiki.ai/wiki/pandas)

## References

1. statsmodels developers. "statsmodels documentation" (version 0.15.0). statsmodels.org, August 27, 2026. https://www.statsmodels.org/stable/index.html
2. statsmodels developers. "About statsmodels". statsmodels.org. https://www.statsmodels.org/stable/about.html
3. Skipper 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. https://doi.org/10.25080/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. https://doi.org/10.25080/Majora-ebaa42b7-012
5. Python Package Index. "scikits.statsmodels" (project page and release history). PyPI. https://pypi.org/project/scikits.statsmodels/
6. Python Package Index. "statsmodels" (project page and release history). PyPI. https://pypi.org/project/statsmodels/
7. statsmodels developers. "Release 0.5.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.5.html
8. statsmodels developers. "Release 0.6.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.6.html
9. statsmodels developers. "Release 0.8.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.8.html
10. statsmodels developers. "Release 0.9.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.9.html
11. statsmodels developers. "Release 0.10.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.10.html
12. statsmodels developers. "Release 0.11.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.11.html
13. statsmodels developers. "Release 0.12.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.12.html
14. statsmodels developers. "Release 0.13.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.13.0.html
15. statsmodels developers. "Release 0.14.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.14.0.html
16. statsmodels developers. "Release 0.15.0". statsmodels.org, 2026. https://www.statsmodels.org/stable/release/version0.15.0.html
17. statsmodels developers. "Frequently Asked Question". statsmodels.org. https://www.statsmodels.org/stable/faq.html
18. statsmodels developers. "endog, exog, what's that?". statsmodels.org. https://www.statsmodels.org/stable/endog_exog.html
19. statsmodels developers. "Import Paths and Structure". statsmodels.org. https://www.statsmodels.org/stable/api-structure.html
20. statsmodels developers. "User Guide". statsmodels.org. https://www.statsmodels.org/stable/user-guide.html
21. statsmodels developers. "Time Series analysis tsa". statsmodels.org. https://www.statsmodels.org/stable/tsa.html
22. statsmodels developers. "Time Series Analysis by State Space Methods statespace". statsmodels.org. https://www.statsmodels.org/stable/statespace.html
23. statsmodels developers. "Generalized Linear Models". statsmodels.org. https://www.statsmodels.org/stable/glm.html
24. statsmodels developers. "Linear Regression". statsmodels.org. https://www.statsmodels.org/stable/regression.html
25. statsmodels developers. "Regression with Discrete Dependent Variable". statsmodels.org. https://www.statsmodels.org/stable/discretemod.html
26. statsmodels developers. "statsmodels/statsmodels" (repository and README). GitHub. https://github.com/statsmodels/statsmodels
27. Semantic Scholar. "Statsmodels: Econometric and Statistical Modeling with Python" (citation record). Semantic Scholar, accessed November 2026. https://www.semanticscholar.org/paper/1a6099290afeb592d04b9ded83d4499e28924e03
28. statsmodels developers. "Getting started". statsmodels.org. https://www.statsmodels.org/stable/gettingstarted.html
29. statsmodels developers. "Linear Mixed Effects Models". statsmodels.org. https://www.statsmodels.org/stable/mixed_linear.html
30. statsmodels developers. "Statistics stats". statsmodels.org. https://www.statsmodels.org/stable/stats.html
31. statsmodels developers. "Release 0.7.0". statsmodels.org. https://www.statsmodels.org/stable/release/version0.7.html

