Statsmodels: econometric and statistical modeling with Python
Paper · 2010 · Skipper Seabold and Josef Perktold
Summary
Economists have mostly done statistical work in proprietary tools such as Stata, SAS, GAUSS, MATLAB and NLOGIT, or in R. Python had no dedicated package for estimating and testing statistical and econometric models. The authors present statsmodels, a SciKit add-on to NumPy/SciPy. It began as Jonathan Taylor's models code, which moved from SciPy to NIPY and was then developed further during Google Summer of Code 2009 and 2010.
The design treats a model as an object that reduces data. A base Model class holds endog and exog data and provides placeholders for fit and predict. LikelihoodModel supports the regression models. Fitting returns Results objects that compute their statistics lazily, only when requested.
To ensure correctness, the developers follow a test-driven workflow. Outputs are checked against R, SAS, Stata or Monte Carlo simulations, and any mismatches are documented. Worked examples, including OLS on the highly collinear Longley data, show a uniform API across models. The paper matters because it laid out a transparent, replicable, open-source foundation for statistical modeling in Python.
Key points
- The main codebase has five model modules:
- regression (OLS, WLS, GLS)
- glm (six exponential-family distributions, at least ten link functions)
- rlm (M-estimators with eight norms)
- discretemod (Logit, Probit, MNLogit and Poisson, estimated by maximum likelihood)
- contrast
- Supporting tools include:
- tests for heteroskedasticity and autocorrelation
- a framework for linear hypotheses on coefficients
- descriptive statistics
- SimpleTable output with LaTeX export
- a reader for Stata .dta files
- The package ships fourteen datasets. The Longley 1967 data, with a condition number of 456,037, is used to check least-squares accuracy, and parameters are computed by default via the pseudoinverse.
- The development process uses distributed version control branches and a sandbox directory, with tests against reference software and code review on the mailing list. Releases are distributed via PyPI/easy_install.
- Planned additions include time-series models, kernel density estimation and nonparametric regression, panel data, systems of equations, and maximum entropy models.
Institutions
Fields, topics and concepts
📚 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 18,614 worksArtificial Intelligence · 17,965 worksMathematics · 189 worksStatistics and Probability · 19 works
Cite
Cite as Skipper Seabold and Josef Perktold. 2010. Statsmodels: econometric and statistical modeling with Python. Proc. 9th Python in Science Conf. (SciPy 2010).
@inproceedings{seabold2010statsmodels,
title = {{Statsmodels: econometric and statistical modeling with Python}},
author = {Skipper Seabold and Josef Perktold},
booktitle = {Proc. 9th Python in Science Conf. (SciPy 2010)},
year = {2010},
doi = {10.25080/majora-92bf1922-011},
url = {https://doi.org/10.25080/majora-92bf1922-011}
}References
- [AltmanMcDonald] M. Altman and M.P. McDonald. 2003. "Replication with Attention to Numerical Accuracy." Political Analysis, 11.3, 302-7. [BilinaLawford] R. Bilina and S. Lawford. July 4, 2009. Python for Unified Research in Econometrics and Statistics, July 4, 2009. Available at SSRN: http://ssrn.co… ↗
- Cryer and K.S. Chan. 2008. Time Series Analysis: with Applications in R, Springer. [Enthought] Enthought Tool Suite. Available at http://code.enthought.com/. [Gill] J. Gill. 2001. Generalized Linear Models: A Unified Approach. Sage Publications. [Greene] W. H. Greene. 2003. Econometric Analysis 5th… ↗
- Isaac. 2008. "Simulating Evolutionary Games: a Python- Based Introduction." Journal of Artificial Societies and Social Simulation. 11.3.8. Available at http://jasss.soc.surrey.ac.uk/11/3/8.html [KleiberZeileis] C. Kleiber and A. Zeileis. 2008. Applied Econometrics with R, Springer. [Longley] J.W. ↗
- Longley. 1967. "An Appraisal of Least Squares Programs for the Electronic Computer from the Point of View of the User." Journal of the American Statistical Association, 62.319, 819-41. [Matplotlib] J. Hunter, et al. Matplotlib. Available at http://matplotlib.sourceforge.net/index.html. ↗
Updated
This page in Markdown → https://md.research.elamur.ai/free/en/papers/seabold-2010-statsmodels-econometric-statistical-modeling-python/