Docs Β· Quickstart Β· Function & API Reference Β· DeepWiki Β· Benchmarks Β· Contributing Β· Changelog
PyFixest is a Python package for fast high-dimensional fixed effects regression.
The package aims to mimic the syntax and functionality of Laurent BergΓ©'s 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 questions on PyFixest, head over to our GitHub discussions, or join our Discord server.
- Estimation
- OLS, WLS, IV, and GLMs (Poisson, logit, probit, gaussian) with high-dimensional fixed effects
- Different demeaning backends (MAP, within, LSMR) on CPU and GPU
- Fast quantile regression via an interior-point solver
- Difference-in-differences estimators, including TWFE,
Did2s, local projections, and Sun-Abraham event studies - Regression decomposition following Gelbach (2016)
- Multiple estimation syntax
- Inference
- Several robust, cluster-robust, and HAC variance-covariance estimators
- Wild cluster bootstrap inference via wildboottest
- Multiple hypothesis corrections and simultaneous confidence intervals
- Fast randomization inference
- The causal cluster variance estimator (CCV)
- Post-Estimation & Reporting
- Publication-ready tables with Great Tables or LaTeX booktabs via the maketables library
You can install the release version from PyPI by running
# inside an active virtual environment
python -m pip install pyfixestor the development version from github by running
python -m pip install git+https://github.com/py-econometrics/pyfixestOptional dependencies
For visualization features using the lets-plot backend, install:
python -m pip install pyfixest[plots]matplotlib is included by default, so plotting works without this extra.
For GPU-accelerated fixed-effects demeaning via CuPy, install the build matching your CUDA version:
pip install cupy-cuda11x
pip install cupy-cuda12x
pip install cupy-cuda13xThen use the typed demeaner API for GPU execution:
pf.feols(
"Y ~ X1 | f1 + f2",
data=data,
demeaner=pf.LsmrDemeaner(backend="cupy", precision="float32"),
)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
PyFixest also supports multiple estimation syntax:
fit = pf.feols("Y + Y2 ~ X1 | csw0(f1, f2)", data=data, vcov={"CRV1": "group_id"})
fit.etable()For more examples, see the quickstart, the formula syntax tutorial, and the Poisson & GLMs tutorial.
All benchmarks follow the fixest benchmarks. All non-PyFixest timings are taken from the fixest benchmarks.
For the full benchmark suite, see the benchmarks/ directory and the note on difficult fixed effects problems.
- Quickstart
- Function & API Reference
- Difference-in-Differences
- Quantile Regression
- Changelog
- Contributing
First and foremost, we want to acknowledge Laurent BergΓ©'s formidable fixest, which is so good we decided to stick to its API and conventions as closely as Python allows. Without fixest, PyFixest likely wouldn't exist - or at the very least, it would look very different.
For a full list of software packages and papers that have influenced PyFixest, please take a look at the Acknowledgements page.
We thank all institutions that have funded or supported work on PyFixest!
If you want to cite PyFixest, you can use the following BibTeX entry:
@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}
}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.
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!
Thanks goes to these wonderful people:
This project follows the all-contributors specification. Contributions of any kind welcome!
