--- id: linearmodels version: "7.0" license: NCSA license_treatment: unclear maintenance: active --- # linearmodels — Linear Panel, Instrumental Variable, Asset Pricing, and System Regression models for Python License: unclear · Maintenance: active · Downloads: 440.1K/mo ## What it is and what it does Linearmodels extends statsmodels with specialized econometric and financial regression estimators. It provides panel data models (fixed effects, first difference, between, pooled, Fama-MacBeth), instrumental variable methods (2SLS, LIML, k-class, GMM), high-dimensional regression via absorbing least squares, factor asset pricing models, and system regression (SUR, 3SLS, GMM system). The package is designed to work with NumPy, Pandas, and xarray data structures and supports formula-based model specification using formulaic. The package targets econometricians, financial researchers, and data scientists working with panel data, endogenous regressors, or multi-equation systems. It builds on statsmodels' foundation but adds specialized estimators not available in the base library. Installation requires seven runtime dependencies (numpy, pandas, scipy, statsmodels, mypy_extensions, pyhdfe, formulaic), and the package is actively maintained with support for current Python versions. Use it for: - Estimate panel regression models with entity and time fixed effects on longitudinal firm or country data. - Perform instrumental variable regression when regressors are endogenous, using 2SLS or GMM estimators. - Implement Fama-MacBeth cross-sectional regression for asset pricing factor models across time periods. - Fit system regression models (SUR, 3SLS) when multiple equations share disturbances or have cross-equation constraints. - Handle high-dimensional fixed effects using absorbing least squares for large categorical variables. - Estimate k-class or continuously-updating GMM models for robust inference under weak instruments. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides panel regression, instrumental variable estimators, system regression, and factor asset pricing models that extend statsmodels for econometric and financial analysis. Yes, with conditions. Install if you need specialized econometric estimators (panel models, IV, system regression, asset pricing) beyond statsmodels' scope and can work with Python 3.10 or later. The package is actively maintained with no known vulnerabilities. Verify the NCSA license terms match your project's requirements before committing to production use. ## Install pip install linearmodels uv add linearmodels poetry add linearmodels ## Installing linearmodels Before you install: Medium install friction due to compiled wheels across multiple platforms and Python versions (3.10–3.13). Active maintenance with last commit on 2026-08-13 and 1060 repository stars indicate ongoing support. License in practice: Licensed under NCSA with unclear treatment in the package metadata—verify the actual license terms before use in proprietary or restricted contexts. Quickstart: pip install linearmodels from linearmodels import PanelOLS import numpy as np from statsmodels.datasets import grunfeld data = grunfeld.load_pandas().data data.year = data.year.astype(np.int64) data = data.set_index(['firm','year']) mod = PanelOLS(data.invest, data[['value','capital']], entity_effects=True) res = mod.fit(cov_type='clustered', cluster_entity=True) Requires Python 3.10 or later; depends on numpy, pandas, scipy, and statsmodels at specified minimum versions. Verify before relying: - Whether NCSA license treatment is suitable for your use case (commercial, proprietary, or restricted distribution). - Performance characteristics and scalability limits for high-dimensional regression with absorbing least squares. - Compatibility with xarray data structures beyond the stated optional support. - Actual download volume and user base size to assess community support. ## Package facts - License: NCSA (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 440.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags panel regression fixed effects, instrumental variable estimation, two-stage least squares, econometric modeling python, asset pricing models, system regression SUR, high-dimensional regression absorbing, fama-macbeth estimation, econometrics, panel-data, instrumental-variables [View on SkillFed](https://skillfed.io/packages/linearmodels) · [View on PyPI](https://pypi.org/project/linearmodels/)