linearmodels
by Kevin Sheppard · Library
Python package by Kevin Sheppard adding panel data, instrumental-variable, system (SUR/3SLS) and asset-pricing estimators missing from statsmodels
Overview
linearmodels is a Python library by Kevin Sheppard that fills the gaps in statsmodels for applied econometrics and empirical finance. Its panel module offers pooled OLS, fixed effects (PanelOLS with entity, time and other effects), random effects, between, first-difference and Fama-MacBeth estimators plus AbsorbingLS for high-dimensional effects; the IV module provides 2SLS, LIML, GMM, continuously updated GMM and JIVE with weak-identification and specification tests; system estimation covers SUR, 3SLS and system GMM; and the asset-pricing module implements two-step and GMM linear factor models and a SUR model for traded factors. Clustered, heteroskedasticity-robust and kernel covariance estimators are available throughout, with formula interfaces and pandas MultiIndex panels as inputs.
The package is released under the University of Illinois/NCSA license, follows statsmodels conventions and prints comparable summary tables. Version 7.1 is current at the time of writing. It is single-machine and does not cover nonlinear panel models or dynamic panel GMM (Arellano-Bond), for which R or Stata remain more complete.
Capabilities
- Panel estimators: pooled, fixed, random, between, first-difference, Fama-MacBeth
- AbsorbingLS for high-dimensional fixed effects
- IV: 2SLS, LIML, GMM, CUE-GMM, JIVE with diagnostics
- System estimation: SUR, 3SLS, system GMM
- Linear factor asset-pricing models
- Clustered and robust covariance estimators
- Formula interface and pandas MultiIndex panels
Typical workflows
- Two-way fixed-effects panel regression with clustered errors
- Fama-MacBeth cross-sectional asset-pricing tests
- IV estimation with weak-instrument diagnostics
Strengths
- Covers estimators statsmodels lacks
- Consistent with pandas and statsmodels conventions
- Permissive NCSA licence
Limitations
- No dynamic panel GMM (Arellano-Bond)
- Linear models only
- Smaller community than statsmodels
Prerequisites
- Python with NumPy, pandas and statsmodels
Who it is for
- Empirical finance researchers
- Applied econometricians working in Python
Alternatives & comparison
statsmodels covers general regression and time series but not panel IV or system models; fixest in R is faster for many-level fixed effects and includes event-study tooling; arch, by the same author, addresses volatility and bootstrap methods.
- arch (Python package)
Kevin Sheppard's Python package for univariate ARCH/GARCH volatility models, bootstraps, multiple-comparison procedures, unit-root and cointegration tests
Open sourceFree - fixest
R package for fast estimation of OLS, GLM, Poisson, IV and difference-in-differences models with many fixed effects, clustered errors, multiple estimations and publication tables
Open sourceFree - Stata
Commercial statistical software from StataCorp widely used in economics and social science, with editions BE/SE/MP, a command language, Mata and comprehensive PDF manuals
ProprietaryPaid - statsmodels
Python library for estimating statistical and econometric models with R-style formulas, rich result summaries and tests: OLS, GLM, discrete choice, ARIMA, state space, VAR and more
Open sourceFree
Sources & verification
Primary sources consulted for this record. Claims are tied to the fields each source supports; the automated link checker re-verifies every URL on a schedule.
- Licenselinearmodels LICENSE.mdchecked Nov 1, 2026
https://github.com/bashtage/linearmodels/blob/main/LICENSE.md
Supports: license_spdx, source_model
University of Illinois/NCSA Open Source License text
- Official sitelinearmodels 7.1checked Nov 1, 2026
https://bashtage.github.io/linearmodels
Supports: name, summary, capabilities, vendor
- Repositorychecked Nov 1, 2026
- Confidence
- High
- Reviewed
- Nov 1, 2026
- Links
- Verified · Nov 2, 2026
Spotted an error?
More in Econometrics & causal inference
EconML
PyWhy (originally Microsoft Research) · Econometrics & causal inference
Python library for heterogeneous treatment-effect estimation with machine learning: double ML, doubly robust learners, causal forests, meta-learners, IV and policy learning
DoWhy
PyWhy (originally Microsoft Research) · Econometrics & causal inference
Python causal-inference library organized around model, identify, estimate and refute steps, with graphical causal models for attribution, counterfactuals and root-cause analysis
R
R Foundation / R Core Team · Programming languages & runtimes
Language and environment for statistical computing and graphics, with the CRAN package archive and a strong base in academic statistics and econometrics
EViews
S&P Global (EViews) · Econometrics & causal inference
Commercial Windows econometrics package for time-series estimation, forecasting and macro modelling, sold as single-user, volume, University and free Student Lite editions
gretl
gretl developers (Allin Cottrell, Riccardo Lucchetti) · Econometrics & causal inference
Free, GPL-licensed cross-platform econometrics program with a GUI, the hansl scripting language and estimators for time series, panels and limited dependent variables