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
4.9k200 skills

Claude Code

$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill linearmodels --agent claude-code

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
@brycewang-stanford
Ships withauto-empirical-research-skills

## ๐Ÿ”ฅ ๅŠ›่ ยท StatsPAI โ€” Stata ไธŽ R ็š„ Python ๅนณๆ›ฟ๏ผŒไธบ AI Agent ่€Œ็”Ÿ ๐Ÿ” Stata / R ๅนณๆ›ฟ๏ผšreghdfeใ€csdidใ€rdrobustใ€synthใ€fixestใ€did ็ญ‰ๅธธ็”จๅ‘ฝไปคๅœจ Python ไธญไธ€็ซ™ๅผๆ›ฟไปฃ๏ผŒไธ€ไธช import statspai as sp ๆžๅฎš DID / RD / IV / SCM / DML / matching ๐Ÿค– ้ขๅ‘ Agent ่ฎพ่ฎก๏ผš็ป“ๆž„ๅŒ–็ป“ๆžœๅฏน่ฑก + ๅ†…็ฝฎ MCP Server๏ผŒClaude / Codex

4.9k200 skills
Get the whole plugin

Stars on GitHub

Momentum

stars in total
4.9k
Star history of brycewang-stanford/Auto-Empirical-Research-Skills on GitHub, a chart by star-history.com

More skills from other plugins.

agent-builder

agent-builder

Load immediately after an Agent intent, before the first agent_builder_* call. Governs how you create, configure, test, andโ€ฆ

n8n2w209k
@n8n-io@n8n-ioInstall Skill
browser-use

browser-use

Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also coversโ€ฆ

@browser-use@browser-useInstall Skill
agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, fillingโ€ฆ

@vercel-labs-2@vercel-labs-2Install Skill
add-anydoc

add-anydoc

Add local office-document-to-Markdown conversion to NanoClaw agent containers with the pinned Firecrawl AnyDoc CLI. Use whenโ€ฆ

@nanocoai@nanocoaiInstall Skill

Questions about linearmodels.

Which coding agents can use linearmodels?
linearmodels installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.