本文へ移動
cccskills
無料GitHub で公開

fixest

Fast high-dimensional fixed effects in R: feols/fepois/feglm/fenegbin with multi-way FE; IV estimation; DiD (TWFE, Sun-Abraham via sunab); clustered/ heteroskedasticity-robust SEs; etable/coefplot/iplot for reporting. Use when execution language is R. Python equivalent: pyfixest. For panel RE/between use plm; for GLM without FE use r-stats.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daafスター 238(GitHub 238 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(9)

  • SKILL.md14.7 KB
  • references/did.md11.5 KB
  • references/fixed-effects.md7.6 KB
  • references/gotchas.md12.1 KB
  • references/iv.md7.7 KB
  • references/models.md10.1 KB
  • references/quickstart.md10.3 KB
  • references/reporting.md9.0 KB
  • references/standard-errors.md11.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

fixest Skill

fixest: the canonical R package for fast high-dimensional fixed effects estimation. Covers OLS (feols), Poisson (fepois), GLM (feglm, including logit/probit with FE), negative binomial (fenegbin), and nonlinear models (feNmlm) with multi-way absorbed fixed effects. Supports instrumental variables via three-part formula; difference-in- differences via TWFE and Sun-Abraham (sunab); standard errors including clustered, heteroskedasticity-robust, Newey-West, Driscoll-Kraay, and Conley spatial; and publication output via etable, coefplot, and iplot. Use when execution language is R and the analysis involves fixed effects regression, IV, DiD, or publication-quality regression tables. Python equivalent: pyfixest (which is a port of this package). For panel random/between effects, use plm. For GLM/time series without fixed effects, use base R stats or dedicated packages.

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

What is fixest?

fixest (Berge, 2018) is the most widely-used R package for fast fixed effects estimation in applied economics and quantitative social science:

  • Fast: Multi-way FE demeaning via alternating projections (C++ backend)
  • Concise formula syntax: Fixed effects after |, IV after second |, multi-estimation via sw()/csw()/csw0()
  • Full GLM support with FE: feglm handles logit, probit, and other GLMs with absorbed high-dimensional FE (unlike pyfixest, which lacks this)
  • Sun-Abraham DiD: Built-in sunab() formula function for staggered DiD
  • Flexible inference: Switch SE types post-estimation; one-sided formulas for clustering (vcov = ~group)
  • Publication output: etable() for regression tables, coefplot() and iplot() for coefficient and event study visualization

Version Notes

This skill targets fixest 0.14.0 (R 4.5.3). fixest 0.13 introduced the breaking changes that pyfixest adopted in 0.40.0 (default SE changed to IID, singleton removal by default, ssc argument renames); DAAF now ships pyfixest 0.60.0, which keeps those fixest-0.13-aligned defaults. fixest 0.14.0 is a stable release building on those defaults.

Key defaults in 0.14.0:

  • Default standard errors: "iid" (not cluster-by-first-FE as in pre-0.13)
  • Singleton removal: on by default (fixef.rm = "perfect_fit")
  • ssc() arguments (canonical 0.14 names): K.adj, K.fixef, K.exact, G.adj, G.df, t.df — the pre-0.13 names (adj, fixef.K, cluster.adj, cluster.df) still work as deprecated back-compat aliases

How to Use This Skill

Reference File Structure

Each topic in ./references/ contains focused documentation:

FilePurposeWhen to Read
quickstart.mdfeols() basics, formula syntax, multi-estimation (csw, sw, sw0), data requirementsStarting with fixest
fixed-effects.mdMulti-way FE syntax, FE interactions (^), varying slopes, FE recovery via fixef()FE models and specification
standard-errors.mdClustered SEs (vcov), HC robust, Conley spatial, Driscoll-Kraay, Newey-West, two-way clusteringInference choices
iv.mdIV three-part formula, first-stage diagnostics, weak instrument testsIV/2SLS estimation
did.mdTWFE with feols, sunab() for staggered DiD, event study plots via iplot()DiD designs
reporting.mdetable() for regression tables (LaTeX, data.frame), coefplot(), iplot(), fixef() for FE extractionPresenting results
models.mdfepois (Poisson), feglm (GLM with FE), fenegbin (negative binomial), feNmlm (nonlinear), model familiesNon-OLS models
gotchas.mdSingleton observations, separation in Poisson, formula parsing pitfalls, SE defaults, panel vs cross-sectionDebugging issues

Reading Order

  1. New to fixest? Start with quickstart.md then fixed-effects.md
  2. Running DiD? Read quickstart.md, then did.md
  3. Need IV? Read quickstart.md, then iv.md
  4. Making tables? Check reporting.md
  5. Non-OLS models? Read models.md
  6. Coming from pyfixest? Read quickstart.md then gotchas.md

The reference-file routing in this skill applies to advisory and brainstorming turns as much as implementation. Recommending an SE choice, reviewing a DiD plan, or answering a question that touches a routed topic calls for reading the routed reference file just as much as writing code does — the reference files carry curated caveats and environment-specific constraints (e.g., exact fitstat type names, ssc() defaults) that this overview and general knowledge lack.

Related Skills

SkillRelationship
pyfixestPython port of this package — near-identical formula syntax; residual gaps are GLM families beyond logit/probit/gaussian and fenegbin. Load when execution language is Python.
data-scientistMethodology guidance — load for "why and when" behind methods
r-python-translationCross-language mappings for R fixest vs Python pyfixest and statsmodels
plmRandom effects, between estimator, Hausman test — complements fixest when FE-only is insufficient
r-statsBase R glm(), lm() without FE — use when FE absorption is not needed
gtPublication-quality tables — use gt/modelsummary for formatted regression output (alternative to etable)

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 with FE → ./references/iv.md
├─ Poisson (count data) with FE → ./references/models.md
├─ Logit / Probit with FE → ./references/models.md (feglm)
├─ Negative binomial with FE → ./references/models.md (fenegbin)
├─ Multiple models at once → ./references/quickstart.md (sw/csw)
└─ Nonlinear custom model → ./references/models.md (feNmlm)

"I need difference-in-differences"

DiD design?
├─ Simple 2×2 DiD (one treatment date) → ./references/did.md
├─ Staggered treatment timing → ./references/did.md
│   ├─ Sun-Abraham saturated (sunab) → ./references/did.md
│   └─ TWFE (caution with heterogeneity) → ./references/did.md
├─ Event study plot → ./references/did.md + ./references/reporting.md
└─ Parallel trends assessment → ./references/did.md

"I need to choose standard errors"

What inference?
├─ Heteroskedasticity-robust (HC1) → ./references/standard-errors.md
├─ Clustered (one-way / two-way) → ./references/standard-errors.md
├─ Newey-West (HAC) → ./references/standard-errors.md
├─ Driscoll-Kraay (panel with cross-sect dependence) → ./references/standard-errors.md
├─ Conley spatial → ./references/standard-errors.md
└─ Small sample corrections (ssc) → ./references/standard-errors.md

"I need to present results"

Presenting results?
├─ Regression table (multiple models) → ./references/reporting.md
├─ Coefficient plot → ./references/reporting.md
├─ Event study plot → ./references/reporting.md
├─ LaTeX table output → ./references/reporting.md
└─ Extract fixed effects → ./references/reporting.md

"Something isn't working"

Having issues?
├─ Different results from old code → ./references/gotchas.md
├─ Singleton warnings → ./references/gotchas.md
├─ Poisson separation/convergence → ./references/gotchas.md
├─ Formula parsing errors → ./references/gotchas.md
├─ pyfixest vs fixest differences → ./references/gotchas.md
└─ Collinearity with FE → ./references/gotchas.md

File-First Execution in Research Workflows

Important: In DAAF research pipelines, fixest regressions are executed through script files, not interactively. This ensures auditability and reproducibility.

The pattern:

  1. Write regression code to scripts/stage8_analysis/{step}_{task-name}.R
  2. Execute via Bash with automatic output capture wrapper script
  3. Validation results get automatically embedded in scripts as comments
  4. If failed, create versioned copy for fixes

Closely read agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the mandatory file-first execution protocol covering complete code file writing, output capture, and file versioning rules. All regression scripts must follow the Inline Audit Trail (IAT) standard — see agent_reference/INLINE_AUDIT_TRAIL.md. For regression code, document model specification choices (why this estimator, why this clustering level, what identifying assumptions) with # INTENT:, # REASONING:, and # ASSUMES: comments.

See:

  • agent_reference/WORKFLOW_PHASE4_ANALYSIS.md — Stage 8 (Analysis & Visualization)
  • agent_reference/INLINE_AUDIT_TRAIL.md — IAT documentation standard

The examples below show fixest syntax. In research workflows, wrap them in scripts following the file-first pattern.


Quick Reference

Essential Setup

library(fixest)
library(arrow)  # For parquet I/O (DAAF convention)

Core Estimation Functions

FunctionPurpose
feols(y ~ x | fe, data)OLS with fixed effects
fepois(y ~ x | fe, data)Poisson with fixed effects
feglm(y ~ x | fe, data, family)GLM (logit, probit, etc.) with fixed effects
fenegbin(y ~ x | fe, data)Negative binomial with fixed effects
feNmlm(fml, data, family)Nonlinear models with fixed effects

Formula Syntax Quick Reference

PatternMeaningExample
y ~ x1 + x2No FEy ~ educ + exper
y ~ x | fe1 + fe2With FEy ~ educ | state + year
y ~ x | fe | x_endo ~ zFE + IVy ~ exper | state | educ ~ college_prox
i(factor, ref = val)Categorical with refy ~ i(year, ref = 2000) | state
sunab(cohort, period)Sun-Abraham DiDy ~ sunab(cohort, period) | id + period
sw(x1, x2)Stepwise alternativesy ~ sw(educ, exper) | state
csw0(x1, x2)Cumulative stepwisey ~ csw0(educ, exper) | state
c(y1, y2) ~ xMultiple outcomesc(wage, hours) ~ educ | state

Post-Estimation Essentials

fit <- feols(y ~ x1 + x2 | fe, data = df)

summary(fit)                             # Print results
summary(fit, vcov = "hetero")            # Re-estimate with robust SEs
summary(fit, vcov = ~state)              # Clustered SEs
coef(fit)                                # Named vector of coefficients
se(fit)                                  # Standard errors
confint(fit)                             # Confidence intervals
predict(fit)                             # Fitted values
resid(fit)                               # Residuals
fixef(fit)                               # List of FE estimates
r2(fit, type = "r2")                     # R-squared
r2(fit, type = "wr2")                    # Within R-squared
fitstat(fit, type = "ivf")               # First-stage F (IV only)

Reporting

etable(fit1, fit2, fit3)                # Console regression table
etable(fit1, fit2, tex = TRUE)          # LaTeX output
coefplot(fit1, fit2)                    # Coefficient plot
iplot(fit)                              # Event study / interaction plot

Topic Index

TopicReference File
First regression./references/quickstart.md
Formula syntax./references/quickstart.md
Multi-estimation (sw, csw, csw0)./references/quickstart.md
Multiple outcomes (c(y1,y2))./references/quickstart.md
Data requirements./references/quickstart.md
Multi-way fixed effects./references/fixed-effects.md
FE interactions (^)./references/fixed-effects.md
Varying slopes./references/fixed-effects.md
FE recovery (fixef)./references/fixed-effects.md
Singleton removal./references/fixed-effects.md
Clustered SEs./references/standard-errors.md
HC robust SEs./references/standard-errors.md
Two-way clustering./references/standard-errors.md
Newey-West (NW)./references/standard-errors.md
Driscoll-Kraay (DK)./references/standard-errors.md
Conley spatial./references/standard-errors.md
Small sample corrections (ssc)./references/standard-errors.md
IV formula syntax./references/iv.md
First-stage diagnostics./references/iv.md
Weak instrument tests./references/iv.md
TWFE DiD./references/did.md
Sun-Abraham (sunab)./references/did.md
Event study plots./references/did.md
Parallel trends./references/did.md
etable./references/reporting.md
coefplot./references/reporting.md
iplot./references/reporting.md
LaTeX output./references/reporting.md
Poisson (fepois)./references/models.md
GLM with FE (feglm)./references/models.md
Negative binomial (fenegbin)./references/models.md
Nonlinear (feNmlm)./references/models.md
Singleton observations./references/gotchas.md
Poisson separation./references/gotchas.md
Formula parsing pitfalls./references/gotchas.md
SE default changes./references/gotchas.md
pyfixest vs fixest differences./references/gotchas.md

Citation

When this library is used as a primary analytical tool, include in the report's Software & Tools references:

Berge, L. (2018). "Efficient estimation of maximum likelihood models with multiple fixed-effects: the R package FENmlm." CREA Discussion Paper 2018-13. Updated as: Berge, L. (2026). fixest: Fast Fixed-Effects Estimations [Computer software]. https://CRAN.R-project.org/package=fixest

Cite when: fixest is used for regression estimation (OLS, Poisson, GLM, IV) or difference-in-differences analysis. Do not cite when: Only loaded but no estimation performed.

For the arXiv methods paper:

Berge, L., Butts, K., & McDermott, G. (2026). "Fast and User-Friendly Econometrics Estimations: The R Package fixest." arXiv:2601.21749.

For method-specific citations (e.g., Sun-Abraham, individual DiD estimators), consult the reference files in this skill and agent_reference/CITATION_REFERENCE.md.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

Researcher-facing analytic triangulation ("creative verification") for stress-testing provisional findings and designing pre-specified challenges before an analysis runs. Turns a researcher's concern or focal claim into competing explanations, bounded discriminating tests, audited diagnostic artifacts, and evidence-calibrated interpretations in a hypothesis/evidence ledger — behavioral, output-level verification replacing line-by-line code review. Covers 12 challenge families organized by Shadish-Cook-Campbell validity type, named sensitivity statistics, pre-committed interpretation rules, anti-fishing guardrails, and interactive diagnostic-artifact QA. Use in Ad Hoc Collaboration to verify, challenge, or stress-test a result, or to design discriminating tests before an analysis runs. Not code-change verification (verify skill / code review) and not final adjudication or re-execution (data-verifier, Reproducibility Verification) — prospective, hypothesis-driven challenge design of analytic claims.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

In-situ smoke testing that verifies a LIVE DAAF deployment functions end-to-end in whatever provider route it is configured for. Auto-detects the active install route (anthropic-subscription, openrouter, chatgpt-subscription shim, openai-api shim) and runs tiered probes: Tier 0 free preflight (route/env coherence, hooks, statuslines, shim health); Tier 1 one live round-trip (~cents); Tier 2 a six-probe functional battery (dispatch, coding, web, skill loading, isolation-strip, nested-dispatch deny); Tier D a zero-cost deterministic battery (bats, Pester, lint, safety-hook tests). Use after install, after a rebuild or update, after any provider/config change (new API key, model remap, shim change), for pre-release validation, or when asked "is my install working" or to "smoke test the deployment/config." Requires the DAAF_DEV=1 dev image; a contributor tool, not end-user-facing. NOT DAAFBench (model behavioral-adherence evaluation under benchmarks/) and NOT scripts/smoke_tests/ (R/Python library-package smoke tests).

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

Operational framework for the DAAF orchestrator. Defines engagement modes, confirmation protocol, subagent dispatch, context budget, and reference-loading. Loaded exclusively by the orchestrator — not for subagents or user questions.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

Data science methodology and method-selection routing for quantitative research. Covers EDA, data validation, descriptive analysis, causal inference (IV, DiD, RD, synthetic control), clustering/PCA/UMAP, supervised ML, geospatial analysis, network analysis, and visualization design. Contains the canonical method-to-library routing tree, routed by execution language — Python: statsmodels (OLS/GLM/time series), pyfixest (FE/DiD), linearmodels (RE/GMM/SUR), svy (complex surveys), scikit-learn (clustering/prediction ML), geopandas (spatial), igraph (network analysis); R: r-stats (OLS/GLM/time series), fixest (FE/DiD), plm (panel/RE/IV), survey-r (complex surveys), tidymodels (ML), sf-terra (spatial), igraph-r (network analysis). Load the routed tool-specific skill before giving tool-specific advice or writing code — library skills encode environment constraints and curated caveats absent from general knowledge.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

Interpretation guidance for Urban Institute Education Data Portal datasets. The Portal is a curation layer over federal data: lowercase variable names, integer-encoded categoricals, standardized missing codes (-1 missing, -2 not applicable, -3 suppressed). Covers year definitions, grade encoding (grade=-1 is Pre-K, not missing), suppression rates, ODC-By licensing, and cross-source join identifiers. Load before analyzing any Portal data. Routes to source-specific deep-dive skills for individual datasets.

日本語の概要は準備中です。原文の説明を表示しています。

DAAF-Contribution-Community/daaf2382026年10月17日 更新

DAAF-Contribution-Community のスキルをすべて見る

このスキルの問題を報告する