Skip to content
Automation
Skill

/pyfixest

Fast high-dimensional fixed effects: OLS, Poisson, IV with multi-way FE; DiD (TWFE, did2s, Sun-Abraham); clustered SEs; etable/coefplot/iplot. Use for FE regressions or DiD. For panel RE/between use linearmodels; for GLM without FE use statsmodels.

From plugin
auto-empirical-research-skills
4.9k200 skills

Claude Code

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

SKILL.md

pyfixest.SKILL.md
name: pyfixest
description: >-
  Fast high-dimensional fixed effects: OLS, Poisson, IV with multi-way FE; DiD (TWFE, did2s, Sun-Abraham); clustered SEs; etable/coefplot/iplot. Use for FE regressions or DiD. For panel RE/between use linearmodels; for GLM without FE use statsmodels.
metadata:
  audience: research-coders
  domain: python-library
  library-version: "0.40.0"
  skill-last-updated: "2026-03-27"

pyfixest Skill

pyfixest: fast high-dimensional fixed effects estimation for Python. Covers OLS, Poisson, and IV regression with multi-way fixed effects; difference-in-differences estimators (TWFE, did2s, lpdid, Sun-Abraham); clustered standard errors; wild bootstrap; and publication output (etable regression tables, coefplot, iplot event study plots). Use when running fixed effects regressions, difference-in-differences designs, Poisson count models with FE, or producing publication-ready regression tables. For panel random/between effects, use linearmodels; for GLM/time series without FE, use statsmodels.

Comprehensive skill for fixed effects regression, instrumental variables, and difference-in-differences estimation with pyfixest. Use decision trees below to find the right guidance, then load detailed references.

What is pyfixest?

pyfixest is a Python implementation of the R **fixest** package (Berge, Butts, & McDermott, 2026):

  • **Fast**: Multi-way FE demeaning via alternating projections with numba/JAX/GPU backends
  • **Concise formula syntax**: Fixed effects after `|`, IV after second `|`, multiple estimation via `sw()`/`csw()`
  • **Modern DiD**: Built-in did2s, local projections DiD (lpdid), and Sun-Abraham saturated estimator
  • **Flexible inference**: Switch SE types post-estimation; wild bootstrap, randomization inference, CCV
  • **Publication output**: `etable()` for regression tables, `coefplot()` and `iplot()` for coefficient visualization

Version Notes

This skill targets **pyfixest 0.40.0**, the major release aligning with R fixest 0.13. Breaking changes from earlier versions:

  • Default standard errors changed from "cluster by first FE" to `"iid"` — old code silently produces different SEs
  • `ssc()` arguments renamed: `adj` → `k_adj`, `fixef_k` → `k_fixef`, `cluster_adj` → `G_adj`, `cluster_df` → `G_df`
  • `fixef_rm` default changed from `"none"` to `"singleton"` — singletons now dropped by default
  • Multicollinearity tolerance reduced from 1e-10 to 1e-09

How to Use This Skill

Reference File Structure

Each topic in `./references/` contains focused documentation:

| File | Purpose | When to Read | |------|---------|--------------| | `quickstart.md` | Installation, first regression, formula syntax | Starting with pyfixest | | `fixed-effects.md` | Multi-way FE, SE types, clustering, wild bootstrap | FE models and inference | | `instrumental-variables.md` | IV syntax, first stage, weak instruments | IV/2SLS estimation | | `difference-in-differences.md` | TWFE, did2s, lpdid, Sun-Abraham, event studies | DiD designs | | `tables-and-plots.md` | etable, coefplot, iplot, dtable | Reporting results | | `advanced-inference.md` | Wild bootstrap, randomization inference, MHT corrections, Gelbach | Advanced statistical inference | | `integration.md` | Multiple estimation, Poisson, GLM, marginaleffects, online learning | Advanced features | | `gotchas.md` | Common errors, v0.40 breaking changes, fixest vs pyfixest | Debugging issues |

Reading Order

1. **New to pyfixest?** Start with `quickstart.md` then `fixed-effects.md` 2. **Running DiD?** Read `quickstart.md`, then `difference-in-differences.md` 3. **Need IV?** Read `quickstart.md`, then `instrumental-variables.md` 4. **Making tables?** Check `tables-and-plots.md` 5. **Coming from R fixest?** Read `quickstart.md` then `gotchas.md`

Related Skills

| Skill | Relationship | |-------|-------------| | `data-scientist` | Methodology guidance — load for "why and when" behind methods | | `statsmodels` | Complement for non-FE models: GLM, time series, diagnostics | | `linearmodels` | Random effects, GMM, system estimation when pyfixest's FE-only approach is insufficient | | `svy` | Survey-weighted regression with complex survey designs. pyfixest's clustered SEs account for within-group correlation but do NOT handle full survey design features (stratification, unequal probability weights, FPC). If your data comes from a complex probability survey, use `svy` for design-based inference | | `polars` | Data preparation before estimation (convert to pandas before passing to pyfixest) | | `plotnine` | Custom visualization beyond pyfixest's built-in plots |

Quick Decision Trees

"I need to run a regression"

What kind of regression?
├─ OLS with fixed effects → ./references/quickstart.md
├─ OLS without fixed effects → ./references/quickstart.md
├─ IV / 2SLS → ./references/instrumental-variables.md
├─ Poisson (count data) → ./references/integration.md
├─ Logit / Probit → ./references/integration.md
├─ Quantile regression → ./references/integration.md
└─ Multiple models at once → ./references/integration.md

"I need difference-in-differences"

DiD design?
├─ Simple 2x2 DiD (one treatment date) → ./references/difference-in-differences.md
├─ Staggered treatment timing → ./references/difference-in-differences.md
│   ├─ did2s (Gardner imputation) → ./references/difference-in-differences.md
│   ├─ Local projections DiD → ./references/difference-in-differences.md
│   └─ Sun-Abraham saturated → ./references/difference-in-differences.md
├─ Event study plot → ./references/difference-in-differences.md
├─ Visualize treatment patterns → ./references/difference-in-differences.md
└─ Parallel trends assessment → ./references/difference-in-differences.md

"I need to choose standard errors"

What inference?
├─ Heteroskedasticity-robust (HC1) → ./references/fixed-effects.md
├─ Clustered (one-way / two-way) → ./references/fixed-effects.md
├─ Few clusters (<20) → ./references/advanced-inference.md
│
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…

n8n13d209k
@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 pyfixest.

Which coding agents can use pyfixest?
pyfixest 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.