pyfixest
Fast High-Dimensional Fixed Effects Regression in Python following fixest-syntax
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: sciencedirect.com, wiley.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.8%) to scientific vocabulary
Repository
Fast High-Dimensional Fixed Effects Regression in Python following fixest-syntax
Basic Info
- Host: GitHub
- Owner: py-econometrics
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://py-econometrics.github.io/pyfixest/pyfixest.html
- Size: 137 MB
Statistics
- Stars: 256
- Watchers: 4
- Forks: 60
- Open Issues: 140
- Releases: 54
Metadata Files
README.md

PyFixest: Fast High-Dimensional Fixed Effects Regression in Python
PyFixest is a Python package for fast high-dimensional fixed effects regression.
The package aims to mimic the syntax and functionality of the formidable fixest package as closely as Python allows: if you know fixest well, the goal is that you won't have to read the docs to get started! In particular, this means that all of fixest's defaults are mirrored by PyFixest.
For a quick introduction, you can take a look at the quickstart or the regression chapter of Arthur Turrell's book on Coding for Economists. You can find documentation of all user facing functions in the Function Reference section of the documentation.
For questions on PyFixest, head on over to our github discussions, or (more informally) join our Discord server.
Support PyFixest
If you enjoy using PyFixest, please consider donating to GiveDirectly and dedicating your donation to pyfixest.dev@gmail.com.
You can also leave a message through the donation form - your support and encouragement mean a lot to the developers!
Features
- OLS, WLS and IV Regression with Fixed-Effects Demeaning via Frisch-Waugh-Lovell
- Poisson Regression following the pplmhdfe algorithm
- Probit, Logit and Gaussian Family GLMs (currently without fixed effects demeaning, this is WIP)
- Quantile Regression using an Interior Point Solver
- Multiple Estimation Syntax
- Several Robust and Cluster Robust Variance-Covariance Estimators
- Wild Cluster Bootstrap Inference (via wildboottest)
- Difference-in-Differences Estimators:
- The canonical Two-Way Fixed Effects Estimator
- Gardner's two-stage
("
Did2s") estimator - Basic Versions of the Local Projections estimator following Dube et al (2023)
- The fully saturated Event-Study estimator following Sun & Abraham (2021)
- Multiple Hypothesis Corrections following the Procedure by Romano and Wolf and Simultaneous Confidence Intervals using a Multiplier Bootstrap
- Fast Randomization Inference as in the ritest Stata package
- The Causal Cluster Variance Estimator (CCV) following Abadie et al.
- Regression Decomposition following Gelbach (2016)
- Publication-ready tables with Great Tables or LaTex booktabs
Installation
You can install the release version from PyPI by running
```py
inside an active virtual environment
python -m pip install pyfixest ```
or the development version from github by running
py
python -m pip install git+https://github.com/py-econometrics/pyfixest
For visualization features using the lets-plot backend, install the optional dependency:
py
python -m pip install pyfixest[plots]
Note that matplotlib is included by default, so you can always use the matplotlib backend for plotting even without installing the optional lets-plot dependency.
Benchmarks
All benchmarks follow the fixest
benchmarks.
All non-pyfixest timings are taken from the fixest benchmarks.

Quickstart
```python import pyfixest as pf
data = pf.get_data() pf.feols("Y ~ X1 | f1 + f2", data=data).summary() ```
###
Estimation: OLS
Dep. var.: Y, Fixed effects: f1+f2
Inference: CRV1
Observations: 997
| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5% | 97.5% |
|:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|
| X1 | -0.919 | 0.065 | -14.057 | 0.000 | -1.053 | -0.786 |
---
RMSE: 1.441 R2: 0.609 R2 Within: 0.2
Multiple Estimation
You can estimate multiple models at once by using multiple estimation syntax:
```python
OLS Estimation: estimate multiple models at once
fit = pf.feols("Y + Y2 ~X1 | csw0(f1, f2)", data = data, vcov = {'CRV1':'group_id'})
Print the results
fit.etable() ```
est1 est2 est3 est4 est5 est6
------------ ----------------- ----------------- ----------------- ----------------- ----------------- -----------------
depvar Y Y2 Y Y2 Y Y2
------------------------------------------------------------------------------------------------------------------------------
Intercept 0.919*** (0.121) 1.064*** (0.232)
X1 -1.000*** (0.117) -1.322*** (0.211) -0.949*** (0.087) -1.266*** (0.212) -0.919*** (0.069) -1.228*** (0.194)
------------------------------------------------------------------------------------------------------------------------------
f2 - - - - x x
f1 - - x x x x
------------------------------------------------------------------------------------------------------------------------------
R2 0.123 0.037 0.437 0.115 0.609 0.168
S.E. type by: group_id by: group_id by: group_id by: group_id by: group_id by: group_id
Observations 998 999 997 998 997 998
------------------------------------------------------------------------------------------------------------------------------
Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001
Format of coefficient cell:
Coefficient (Std. Error)
Adjust Standard Errors "on-the-fly"
Standard Errors can be adjusted after estimation, "on-the-fly":
python
fit1 = fit.fetch_model(0)
fit1.vcov("hetero").summary()
Model: Y~X1
###
Estimation: OLS
Dep. var.: Y
Inference: hetero
Observations: 998
| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5% | 97.5% |
|:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|
| Intercept | 0.919 | 0.112 | 8.223 | 0.000 | 0.699 | 1.138 |
| X1 | -1.000 | 0.082 | -12.134 | 0.000 | -1.162 | -0.838 |
---
RMSE: 2.158 R2: 0.123
Poisson Regression via fepois()
You can estimate Poisson Regressions via the fepois() function:
python
poisson_data = pf.get_data(model = "Fepois")
pf.fepois("Y ~ X1 + X2 | f1 + f2", data = poisson_data).summary()
###
Estimation: Poisson
Dep. var.: Y, Fixed effects: f1+f2
Inference: CRV1
Observations: 997
| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5% | 97.5% |
|:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|
| X1 | -0.007 | 0.035 | -0.190 | 0.850 | -0.075 | 0.062 |
| X2 | -0.015 | 0.010 | -1.449 | 0.147 | -0.035 | 0.005 |
---
Deviance: 1068.169
IV Estimation via three-part formulas
Last, PyFixest also supports IV estimation via three part formula
syntax:
python
fit_iv = pf.feols("Y ~ 1 | f1 | X1 ~ Z1", data = data)
fit_iv.summary()
###
Estimation: IV
Dep. var.: Y, Fixed effects: f1
Inference: CRV1
Observations: 997
| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5% | 97.5% |
|:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|
| X1 | -1.025 | 0.115 | -8.930 | 0.000 | -1.259 | -0.790 |
---
Quantile Regression via pf.quantreg
python
fit_qr = pf.quantreg("Y ~ X1 + X2", data = data, quantile = 0.5)
Call for Contributions
Thanks for showing interest in contributing to pyfixest! We appreciate all
contributions and constructive feedback, whether that be reporting bugs, requesting
new features, or suggesting improvements to documentation.
If you'd like to get involved, but are not yet sure how, please feel free to send us an email. Some familiarity with
either Python or econometrics will help, but you really don't need to be a numpy core developer or have published in Econometrica =) We'd be more than happy to invest time to help you get started!
Contributors ✨
Thanks goes to these wonderful people:
This project follows the all-contributors specification. Contributions of any kind welcome!
Acknowledgements
We thank all institutions that have funded or supported work on PyFixest!
How to Cite
If you want to cite PyFixest, you can use the following BibTeX entry:
bibtex
@software{pyfixest,
author = {{The PyFixest Authors}},
title = {{pyfixest: Fast high-dimensional fixed effect estimation in Python}},
year = {2025},
url = {https://github.com/py-econometrics/pyfixest}
}
Owner
- Name: py-econometrics
- Login: py-econometrics
- Kind: organization
- Repositories: 8
- Profile: https://github.com/py-econometrics
Tools for Applied Econometrics in Python
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use pyfixest in your research, please cite it as below." title: "pyfixest: Fast high-dimensional fixed effect estimation in Python" type: software authors: - name: "The PyFixest Authors" repository-code: 'https://github.com/py-econometrics/pyfixest' url: 'https://py-econometrics.github.io/pyfixest/pyfixest.html' abstract: "A Python package for fast high-dimensional fixed effect estimation, inspired by the syntax of the popular R package `fixest`. It provides a familiar and intuitive interface for economists and other social scientists to estimate complex regression models with multiple fixed effects efficiently." keywords: - 'fixed effects' - 'panel data' - 'econometrics' - 'statistics' - 'causal inference' - 'regression' - 'python' license: MIT
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 168
- Total pull requests: 331
- Average time to close issues: about 1 month
- Average time to close pull requests: 6 days
- Total issue authors: 39
- Total pull request authors: 40
- Average comments per issue: 1.23
- Average comments per pull request: 1.85
- Merged pull requests: 228
- Bot issues: 2
- Bot pull requests: 75
Past Year
- Issues: 105
- Pull requests: 226
- Average time to close issues: 7 days
- Average time to close pull requests: 3 days
- Issue authors: 28
- Pull request authors: 31
- Average comments per issue: 0.77
- Average comments per pull request: 1.68
- Merged pull requests: 152
- Bot issues: 2
- Bot pull requests: 56
Top Authors
Issue Authors
- s3alfisc (106)
- escherpf (7)
- apoorvalal (4)
- leostimpfle (4)
- juanitorduz (4)
- marcandre259 (3)
- Jayhyung (3)
- albepal (2)
- greenguy33 (2)
- asteves (2)
- cytwill (2)
- FuZhiyu (2)
- MaxTemmerman (1)
- pre-commit-ci[bot] (1)
- jestover (1)
Pull Request Authors
- s3alfisc (162)
- allcontributors[bot] (36)
- pre-commit-ci[bot] (35)
- juanitorduz (10)
- dsliwka (10)
- apoorvalal (9)
- Jayhyung (8)
- leostimpfle (7)
- dependabot[bot] (4)
- marcandre259 (4)
- rafimikail (4)
- greenguy33 (3)
- b-knight (3)
- AronNemeth (3)
- schroedk (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 8,323 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 74
- Total maintainers: 1
pypi.org: pyfixest
Fast high dimensional fixed effect estimation following syntax of the fixest R package.
- Documentation: https://pyfixest.readthedocs.io/
- License: MIT
-
Latest release: 0.30.2
published 8 months ago