Skip to content
Automation
Skill

/linearmodels

Panel data, IV/GMM, system regression. PanelOLS (FE/RE), BetweenOLS, Fama-MacBeth, IV2SLS/LIML/GMM, SUR, 3SLS, Driscoll-Kraay SEs. Use for RE/between, system estimation, or GMM. Complements pyfixest (FE + DiD) and statsmodels (GLM + time series).

From plugin
auto-empirical-research-skills
3.3k200 skills146 agents
Install
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill linearmodels --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/linearmodels

Context preview

The summary Claude sees to decide when to auto-load this skill.

Panel data, IV/GMM, system regression. PanelOLS (FE/RE), BetweenOLS, Fama-MacBeth, IV2SLS/LIML/GMM, SUR, 3SLS, Driscoll-Kraay SEs. Use for RE/between, system estimation, or GMM. Complements pyfixest (FE + DiD) and statsmodels (GLM + time series).

SKILL.md

linearmodels.SKILL.md
name: linearmodels
description: >-
  Panel data, IV/GMM, system regression. PanelOLS (FE/RE), BetweenOLS, Fama-MacBeth, IV2SLS/LIML/GMM, SUR, 3SLS, Driscoll-Kraay SEs. Use for RE/between, system estimation, or GMM. Complements pyfixest (FE + DiD) and statsmodels (GLM + time series).
metadata:
  audience: research-coders
  domain: python-library
  library-version: "7.0"
  skill-last-updated: "2026-03-27"

linearmodels Skill

linearmodels: panel data, IV/GMM, system regression, and asset pricing models in Python. Covers PanelOLS (FE/RE), BetweenOLS, FirstDifferenceOLS, Fama-MacBeth, IV2SLS/LIML/GMM, SUR, IV3SLS, and Driscoll-Kraay SEs. Use for random effects estimation, between or first-difference panel models, system estimation (SUR, 3SLS), LIML/GMM instrumental variables, Fama-MacBeth regressions, or Driscoll-Kraay standard errors. Complements pyfixest (high-dimensional FE + DiD) and statsmodels (GLM + time series).

Comprehensive skill for panel data estimation, instrumental variables, system regression, and asset pricing with linearmodels (Kevin Sheppard). Use decision trees below to find the right guidance, then load detailed references.

What is linearmodels?

linearmodels extends statsmodels with specialized model classes for structured data:

  • **Panel data**: PanelOLS (fixed effects), RandomEffects, BetweenOLS, FirstDifferenceOLS, PooledOLS, FamaMacBeth
  • **Instrumental variables**: IV2SLS, IVLIML (k-class), IVGMM, IVGMMCUE (continuously updating), AbsorbingLS
  • **System estimation**: SUR (Seemingly Unrelated Regression), IV3SLS, IVSystemGMM
  • **Asset pricing**: LinearFactorModel, LinearFactorModelGMM, TradedFactorModel
  • **Rich inference**: Driscoll-Kraay, clustered (1- and 2-way), HAC kernels (Bartlett, Parzen, Quadratic Spectral)
  • **Dual API**: Formula-based (via formulaic) and array-based interfaces

How to Use This Skill

Reference File Structure

| File | Purpose | When to Read | |------|---------|--------------| | `quickstart.md` | Installation, MultiIndex setup, formula vs array API, first model | Starting with linearmodels | | `panel-models.md` | PanelOLS, RandomEffects, BetweenOLS, FD, Pooled, FamaMacBeth | Panel data estimation | | `iv-models.md` | IV2SLS, IVLIML, IVGMM, IVGMMCUE, AbsorbingLS | IV / GMM estimation | | `system-models.md` | SUR, IV3SLS, IVSystemGMM, cross-equation constraints | System estimation | | `asset-pricing.md` | LinearFactorModel, TradedFactorModel, GMM estimation | Asset pricing tests | | `covariance-inference.md` | All SE types, Driscoll-Kraay, clustering, GMM weights | Choosing standard errors | | `gotchas.md` | MultiIndex requirement, pyfixest/statsmodels boundary, limits | Debugging issues |

Reading Order

1. **New to linearmodels?** Start with `quickstart.md` then `panel-models.md` 2. **Need IV/GMM?** Read `quickstart.md` then `iv-models.md` 3. **System estimation (SUR/3SLS)?** Read `quickstart.md` then `system-models.md` 4. **Asset pricing?** Read `quickstart.md` then `asset-pricing.md` 5. **Choosing SEs?** Read `covariance-inference.md` 6. **Coming from pyfixest?** Read `quickstart.md` then `gotchas.md`

Related Skills

| Skill | Relationship | |-------|-------------| | `pyfixest` | Preferred for high-dimensional FE, FE + IV, DiD, fast demeaning, publication tables. Use linearmodels when pyfixest cannot do what you need (RE, system models, LIML/GMM, Fama-MacBeth) | | `statsmodels` | Foundation library. Use statsmodels for GLM, time series, diagnostics. linearmodels extends statsmodels for panel/IV/system models | | `svy` | Survey-weighted regression with complex survey designs. linearmodels supports `weights` for population/precision weighting in panel models, but this is NOT equivalent to design-based survey inference — it does not handle stratification, clustering as a design feature, or replicate weights. If your data comes from a complex probability survey, use `svy` | | `data-scientist` | Methodology guidance — load for "why and when" behind model choices | | `polars` | Data preparation before estimation; convert to pandas with `.to_pandas()` before passing to linearmodels |

Quick Decision Trees

"I need a panel model"

What panel estimation method?
├─ Fixed effects (within estimator)
│   ├─ 1-2 way FE, no IV → linearmodels PanelOLS or pyfixest feols
│   ├─ 3+ way FE → pyfixest (linearmodels max 2-way in PanelOLS)
│   ├─ FE + IV combined → pyfixest (linearmodels has no Panel IV)
│   └─ FE + DiD → pyfixest (linearmodels has no DiD)
├─ Random effects (GLS) → linearmodels RandomEffects
│   └─ → ./references/panel-models.md
├─ FE vs RE comparison → linearmodels (run both, compare)
│   └─ → ./references/panel-models.md
├─ Between estimator → linearmodels BetweenOLS
│   └─ → ./references/panel-models.md
├─ First difference → linearmodels FirstDifferenceOLS
│   └─ → ./references/panel-models.md
├─ Pooled OLS (panel-aware SEs) → linearmodels PooledOLS
│   └─ → ./references/panel-models.md
└─ Fama-MacBeth → linearmodels FamaMacBeth
    └─ → ./references/panel-models.md

"I need IV / GMM estimation"

What IV method?
├─ 2SLS (standard IV)
│   ├─ With fixed effects → pyfixest (linearmodels has no Panel IV)
│   └─ Without FE → linearmodels IV2SLS or pyfixest
│       └─ → ./references/iv-models.md
├─ LIML / k-class (better finite-sample) → linearmodels IVLIML
│   └─ → ./references/iv-models.md
├─ GMM-IV (efficient, overidentified) → linearmodels IVGMM
│   └─ → ./references/iv-models.md
├─ Continuously updating GMM → linearmodels IVGMMCUE
│   └─ → ./references/iv-models.md
└─ High-dimensional absorbed FE (OLS) → linearmodels AbsorbingLS
    └─ → ./references/iv-models.md

"I need system estimation"

System of equations?
├─ Multiple equations, correlated errors → SUR
│   └─ → ./references/system-models.md
├─ Multiple equations + endogenous variables → IV3SLS
│   └─ → ./references/system-models.md
├─ System GMM → IVSystemGMM
│   └─ → ./references/system-models.md
├─ Cross-equation paramet
Read more
Ships withauto-empirical-research-skills

📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |

Get the whole plugin