statsmodels is an open source Python package that provides a complement to SciPy for statistical computations including descriptive statistics and estimation and inference for statistical models.
statsmodels is built on top of the numerical libraries NumPy and SciPy, integrates with Pandas for data handling and uses patsy for an R-like formula interface. Graphical functions are based on the matplotlib library.
statsmodels provides the statistical backend for other Python libraries.
Key Features
- Linear regression models:
- Ordinary least squares.
- Generalized least squares.
- Weighted least squares.
- Least squares with autoregressive errors.
- Quantile regression.
- Recursive least squares.
- Mixed Linear Model with mixed effects and variance components.
- GLM: Generalized linear models with support for all of the one-parameter exponential family distributions.
- Bayesian Mixed GLM for Binomial and Poisson.
- GEE: Generalized Estimating Equations for one-way clustered or longitudinal data.
- Discrete models:
- Logit and Probit.
- Multinomial logit (MNLogit).
- Poisson and Generalized Poisson regression.
- Negative Binomial regression.
- Zero-Inflated Count models.
- RLM: Robust linear models with support for several M-estimators.
- Time Series Analysis: models for time series analysis.
- Complete StateSpace modeling framework:
- Seasonal ARIMA and ARIMAX models.
- VARMA and VARMAX models.
- Dynamic Factor models.
- Unobserved Component models.
- Markov switching models (MSAR), also known as Hidden Markov Models (HMM).
- Univariate time series analysis: AR, ARIMA.
- Vector autoregressive models, VAR and structural VAR.
- Vector error correction modle, VECM.
- Parameter estimation for cointegrated VAR.
- Forecasting.
- Testing for Granger-causality and instantaneous causality.
- Testing for cointegrating rank.
- Lag order selection.
- exponential smoothing, Holt-Winters.
- Hypothesis tests for time series: unit root, cointegration and others.
- Descriptive statistics and process models for time series analysis.
- Complete StateSpace modeling framework:
- Survival analysis:
- Proportional hazards regression (Cox models).
- Survivor function estimation (Kaplan-Meier).
- Cumulative incidence function estimation.
- Multivariate:
- Principal Component Analysis with missing data.
- Factor Analysis with rotation.
- MANOVA.
- Canonical Correlation.
- Nonparametric statistics: Univariate and multivariate kernel density estimators.
- Datasets: Datasets used for examples and in testing.
- Statistics: a wide range of statistical tests:
- diagnostics and specification tests.
- goodness-of-fit and normality tests.
- functions for multiple testing.
- various additional statistical tests.
- Imputation with MICE, regression on order statistic and Gaussian imputation.
- Mediation analysis.
- Graphics includes plot functions for visual analysis of data and model results.
- I/O:
- Tools for reading Stata .dta files, but pandas has a more recent version.
- Table output to ascii, latex, and html.
- Miscellaneous models.
- Sandbox: statsmodels contains a sandbox folder with code in various stages of developement and testing which is not considered “production ready”. This covers among others:
- Generalized method of moments (GMM) estimators.
- Kernel regression.
- Various extensions to scipy.stats.distributions.
- Panel data models.
- Information theoretic measures.
Website: www.statsmodels.org
Support: GitHub Code Repository, Mailing List
Developer: Statsmodels Developers
License: Modified BSD (3-clause) license
statsmodels is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Python Data Analysis | |
|---|---|
| pandas | High-level building block for doing practical, real world data analysis |
| NumPy | Core package for scientific computing with Python |
| SciPy | Ecosystem for mathematics, science, and engineering |
| Polars | DataFrame interface on top of an OLAP Query Engine |
| statsmodels | Statistical modeling and econometrics in Python |
| Dask | Advanced parallelism for analytics |
| Orange | Component-based framework for machine learning and data mining |
| Modin | Drop-in replacement for pandas |
| Vaex | Fast visualization of big data |
| AWS DW | Extends the power of pandas library |
| yt | Multi-code Toolkit for Analyzing and Visualizing Volumetric Data |
| HoloViews | Make Data Analysis and Visualization Seamless |
| datatable | Manipulate 2-dimensional tabular data structures |
| xarray | Work with labelled multi-dimensional arrays and datasets |
| pyjanitor | Extend pandas with readable data-cleaning functions |
| Optimus | Agile Data Preparation Workflows |
Read our verdict in the software roundup.
| Python Mathematics Tools | |
|---|---|
| scikit-learn | Machine learning library for Python |
| NumPy | Core package for scientific computing with Python |
| SciPy | Ecosystem for mathematics, science, and engineering. |
| statsmodels | Statistical modeling and econometrics |
| JAX | Python library for high-performance numerical computing |
| SageMath | Computer algebra system |
| SymPy | Library for symbolic mathematics |
| PyMC | Bayesian statistical modeling and probabilistic programming |
| Pyomo | Object-oriented algebraic modeling language |
| patsy | Package for describing statistical models and to build design matrices |
| mpmath | Library for arbitrary-precision floating-point arithmetic |
| SfePy | Finite element software package |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

