pyfixest


Namepyfixest JSON
Version 0.27.0 PyPI version JSON
download
home_pageNone
SummaryFast high dimensional fixed effect estimation following syntax of the fixest R package.
upload_time2024-12-15 12:43:39
maintainerNone
docs_urlNone
authorStyfen SchΓ€r
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](figures/pyfixest-logo.png)

# PyFixest: Fast High-Dimensional Fixed Effects Regression in Python

[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyfixest.svg)
[![PyPI -Version](https://img.shields.io/pypi/v/pyfixest.svg)](https://pypi.org/project/pyfixest/)
[![image](https://codecov.io/gh/py-econometrics/pyfixest/branch/master/graph/badge.svg)](https://codecov.io/gh/py-econometrics/pyfixest)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pixi Badge][pixi-badge]][pixi-url]
[![All Contributors](https://img.shields.io/badge/all_contributors-18-green.svg?style=flat-square)](#contributors-)
[![Downloads](https://static.pepy.tech/badge/pyfixest)](https://pepy.tech/project/pyfixest)
[![Downloads](https://static.pepy.tech/badge/pyfixest/month)](https://pepy.tech/project/pyfixest)

[pixi-badge]:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square
[pixi-url]: https://pixi.sh

`PyFixest` is a Python implementation of the formidable [fixest](https://github.com/lrberge/fixest) package for fast high-dimensional fixed effects regression.

The package aims to mimic `fixest` syntax and functionality 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` - currently with only [one small exception](https://github.com/py-econometrics/pyfixest/issues/260).

Nevertheless, for a quick introduction, you can take a look at the [documentation](https://py-econometrics.github.io/pyfixest/pyfixest.html) or the regression chapter of [Arthur Turrell's](https://github.com/aeturrell) book on [Coding for Economists](https://aeturrell.github.io/coding-for-economists/econmt-regression.html#imports).

For questions on `PyFixest`, head on over to our [PyFixest Discourse forum](https://pyfixest.discourse.group/).

## Features

-   **OLS**, **WLS** and **IV** Regression
-   **Poisson Regression** following the [pplmhdfe algorithm](https://journals.sagepub.com/doi/full/10.1177/1536867X20909691)
-   Multiple Estimation Syntax
-   Several **Robust** and **Cluster Robust Variance-Covariance** Estimators
-   **Wild Cluster Bootstrap** Inference (via
    [wildboottest](https://github.com/py-econometrics/wildboottest))
-   **Difference-in-Differences** Estimators:
    -   The canonical Two-Way Fixed Effects Estimator
    -   [Gardner's two-stage
        ("`Did2s`")](https://jrgcmu.github.io/2sdd_current.pdf)
        estimator
    -   Basic Versions of the Local Projections estimator following
        [Dube et al (2023)](https://www.nber.org/papers/w31184)
- **Multiple Hypothesis Corrections** following the Procedure by [Romano and Wolf](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20976314) and **Simultaneous Confidence Intervals** using a **Multiplier Bootstrap**
- Fast **Randomization Inference** as in the [ritest Stata package](https://hesss.org/ritest.pdf)
- The **Causal Cluster Variance Estimator (CCV)** following [Abadie et al.](https://economics.mit.edu/sites/default/files/2022-09/When%20Should%20You%20Adjust%20Standard%20Errors%20for%20Clustering.pdf)
- Regression **Decomposition** following [Gelbach (2016)](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1425737)
- **Publication-ready tables** with [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) 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
```

## Benchmarks

All benchmarks follow the [fixest
benchmarks](https://github.com/lrberge/fixest/tree/master/_BENCHMARK).
All non-pyfixest timings are taken from the `fixest` benchmarks.

![](benchmarks/lets-plot-images/benchmarks_ols.svg)
![](benchmarks/lets-plot-images/benchmarks_poisson.svg)

## 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](https://aeturrell.github.io/coding-for-economists/econmt-regression.html#multiple-regression-models):



```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 |
    ---

## 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](alexander-fischer1801@t-online.de). 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](https://onlinelibrary.wiley.com/journal/14680262) =) We'd be more than happy to invest time to help you get started!

## Contributors ✨

Thanks goes to these wonderful people:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/styfenschaer"><img src="https://avatars.githubusercontent.com/u/79762922?v=4?s=100" width="100px;" alt="styfenschaer"/><br /><sub><b>styfenschaer</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=styfenschaer" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://www.nkeleher.com/"><img src="https://avatars.githubusercontent.com/u/5607589?v=4?s=100" width="100px;" alt="Niall Keleher"/><br /><sub><b>Niall Keleher</b></sub></a><br /><a href="#infra-NKeleher" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="https://github.com/py-econometrics/pyfixest/commits?author=NKeleher" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="http://wenzhi-ding.com"><img src="https://avatars.githubusercontent.com/u/30380959?v=4?s=100" width="100px;" alt="Wenzhi Ding"/><br /><sub><b>Wenzhi Ding</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=Wenzhi-Ding" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://apoorvalal.github.io/"><img src="https://avatars.githubusercontent.com/u/12086926?v=4?s=100" width="100px;" alt="Apoorva Lal"/><br /><sub><b>Apoorva Lal</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=apoorvalal" title="Code">πŸ’»</a> <a href="https://github.com/py-econometrics/pyfixest/issues?q=author%3Aapoorvalal" title="Bug reports">πŸ›</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://juanitorduz.github.io"><img src="https://avatars.githubusercontent.com/u/22996444?v=4?s=100" width="100px;" alt="Juan Orduz"/><br /><sub><b>Juan Orduz</b></sub></a><br /><a href="#infra-juanitorduz" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="https://github.com/py-econometrics/pyfixest/commits?author=juanitorduz" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://s3alfisc.github.io/"><img src="https://avatars.githubusercontent.com/u/19531450?v=4?s=100" width="100px;" alt="Alexander Fischer"/><br /><sub><b>Alexander Fischer</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=s3alfisc" title="Code">πŸ’»</a> <a href="#infra-s3alfisc" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a></td>
      <td align="center" valign="top" width="12.5%"><a href="http://www.aeturrell.com"><img src="https://avatars.githubusercontent.com/u/11294320?v=4?s=100" width="100px;" alt="aeturrell"/><br /><sub><b>aeturrell</b></sub></a><br /><a href="#tutorial-aeturrell" title="Tutorials">βœ…</a> <a href="https://github.com/py-econometrics/pyfixest/commits?author=aeturrell" title="Documentation">πŸ“–</a> <a href="#promotion-aeturrell" title="Promotion">πŸ“£</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/leostimpfle"><img src="https://avatars.githubusercontent.com/u/31652181?v=4?s=100" width="100px;" alt="leostimpfle"/><br /><sub><b>leostimpfle</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=leostimpfle" title="Code">πŸ’»</a> <a href="https://github.com/py-econometrics/pyfixest/issues?q=author%3Aleostimpfle" title="Bug reports">πŸ›</a></td>
    </tr>
    <tr>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/baggiponte"><img src="https://avatars.githubusercontent.com/u/57922983?v=4?s=100" width="100px;" alt="baggiponte"/><br /><sub><b>baggiponte</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=baggiponte" title="Documentation">πŸ“–</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/sanskriti2005"><img src="https://avatars.githubusercontent.com/u/150411024?v=4?s=100" width="100px;" alt="Sanskriti"/><br /><sub><b>Sanskriti</b></sub></a><br /><a href="#infra-sanskriti2005" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/Jayhyung"><img src="https://avatars.githubusercontent.com/u/40373774?v=4?s=100" width="100px;" alt="Jaehyung"/><br /><sub><b>Jaehyung</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=Jayhyung" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="http://alexstephenson.me"><img src="https://avatars.githubusercontent.com/u/24926205?v=4?s=100" width="100px;" alt="Alex"/><br /><sub><b>Alex</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=asteves" title="Documentation">πŸ“–</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/greenguy33"><img src="https://avatars.githubusercontent.com/u/8525718?v=4?s=100" width="100px;" alt="Hayden Freedman"/><br /><sub><b>Hayden Freedman</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=greenguy33" title="Code">πŸ’»</a> <a href="https://github.com/py-econometrics/pyfixest/commits?author=greenguy33" title="Documentation">πŸ“–</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/saidamir"><img src="https://avatars.githubusercontent.com/u/20246711?v=4?s=100" width="100px;" alt="Aziz Mamatov"/><br /><sub><b>Aziz Mamatov</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=saidamir" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/rafimikail"><img src="https://avatars.githubusercontent.com/u/61386867?v=4?s=100" width="100px;" alt="rafimikail"/><br /><sub><b>rafimikail</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=rafimikail" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://www.linkedin.com/in/benjamin-knight/"><img src="https://avatars.githubusercontent.com/u/12180931?v=4?s=100" width="100px;" alt="Benjamin Knight"/><br /><sub><b>Benjamin Knight</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=b-knight" title="Code">πŸ’»</a></td>
    </tr>
    <tr>
      <td align="center" valign="top" width="12.5%"><a href="https://dsliwka.github.io/"><img src="https://avatars.githubusercontent.com/u/49401450?v=4?s=100" width="100px;" alt="Dirk Sliwka"/><br /><sub><b>Dirk Sliwka</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=dsliwka" title="Code">πŸ’»</a> <a href="https://github.com/py-econometrics/pyfixest/commits?author=dsliwka" title="Documentation">πŸ“–</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/daltonm-bls"><img src="https://avatars.githubusercontent.com/u/78225214?v=4?s=100" width="100px;" alt="daltonm-bls"/><br /><sub><b>daltonm-bls</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/issues?q=author%3Adaltonm-bls" title="Bug reports">πŸ›</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/marcandre259"><img src="https://avatars.githubusercontent.com/u/19809475?v=4?s=100" width="100px;" alt="Marc-AndrΓ©"/><br /><sub><b>Marc-AndrΓ©</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=marcandre259" title="Code">πŸ’»</a> <a href="https://github.com/py-econometrics/pyfixest/issues?q=author%3Amarcandre259" title="Bug reports">πŸ›</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/kylebutts"><img src="https://avatars.githubusercontent.com/u/19961439?v=4?s=100" width="100px;" alt="Kyle F Butts"/><br /><sub><b>Kyle F Butts</b></sub></a><br /><a href="#data-kylebutts" title="Data">πŸ”£</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://fosstodon.org/@marcogorelli"><img src="https://avatars.githubusercontent.com/u/33491632?v=4?s=100" width="100px;" alt="Marco Edward Gorelli"/><br /><sub><b>Marco Edward Gorelli</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/pulls?q=is%3Apr+reviewed-by%3AMarcoGorelli" title="Reviewed Pull Requests">πŸ‘€</a></td>
      <td align="center" valign="top" width="12.5%"><a href="http://arelbundock.com"><img src="https://avatars.githubusercontent.com/u/987057?v=4?s=100" width="100px;" alt="Vincent Arel-Bundock"/><br /><sub><b>Vincent Arel-Bundock</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=vincentarelbundock" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/IshwaraHegde97"><img src="https://avatars.githubusercontent.com/u/187858441?v=4?s=100" width="100px;" alt="IshwaraHegde97"/><br /><sub><b>IshwaraHegde97</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=IshwaraHegde97" title="Code">πŸ’»</a></td>
      <td align="center" valign="top" width="12.5%"><a href="https://github.com/RoyalTS"><img src="https://avatars.githubusercontent.com/u/702580?v=4?s=100" width="100px;" alt="Tobias Schmidt"/><br /><sub><b>Tobias Schmidt</b></sub></a><br /><a href="https://github.com/py-econometrics/pyfixest/commits?author=RoyalTS" title="Documentation">πŸ“–</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyfixest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Styfen Sch\u00e4r",
    "author_email": "Alexander Fischer <alexander-fischer1801@t-online.de>",
    "download_url": "https://files.pythonhosted.org/packages/64/c8/8cd065e5e61709d1a4d34dd15d9d564e711f045d04bba032962aaaaaf469/pyfixest-0.27.0.tar.gz",
    "platform": null,
    "description": "![](figures/pyfixest-logo.png)\n\n# PyFixest: Fast High-Dimensional Fixed Effects Regression in Python\n\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyfixest.svg)\n[![PyPI -Version](https://img.shields.io/pypi/v/pyfixest.svg)](https://pypi.org/project/pyfixest/)\n[![image](https://codecov.io/gh/py-econometrics/pyfixest/branch/master/graph/badge.svg)](https://codecov.io/gh/py-econometrics/pyfixest)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Pixi Badge][pixi-badge]][pixi-url]\n[![All Contributors](https://img.shields.io/badge/all_contributors-18-green.svg?style=flat-square)](#contributors-)\n[![Downloads](https://static.pepy.tech/badge/pyfixest)](https://pepy.tech/project/pyfixest)\n[![Downloads](https://static.pepy.tech/badge/pyfixest/month)](https://pepy.tech/project/pyfixest)\n\n[pixi-badge]:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square\n[pixi-url]: https://pixi.sh\n\n`PyFixest` is a Python implementation of the formidable [fixest](https://github.com/lrberge/fixest) package for fast high-dimensional fixed effects regression.\n\nThe package aims to mimic `fixest` syntax and functionality 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` - currently with only [one small exception](https://github.com/py-econometrics/pyfixest/issues/260).\n\nNevertheless, for a quick introduction, you can take a look at the [documentation](https://py-econometrics.github.io/pyfixest/pyfixest.html) or the regression chapter of [Arthur Turrell's](https://github.com/aeturrell) book on [Coding for Economists](https://aeturrell.github.io/coding-for-economists/econmt-regression.html#imports).\n\nFor questions on `PyFixest`, head on over to our [PyFixest Discourse forum](https://pyfixest.discourse.group/).\n\n## Features\n\n-   **OLS**, **WLS** and **IV** Regression\n-   **Poisson Regression** following the [pplmhdfe algorithm](https://journals.sagepub.com/doi/full/10.1177/1536867X20909691)\n-   Multiple Estimation Syntax\n-   Several **Robust** and **Cluster Robust Variance-Covariance** Estimators\n-   **Wild Cluster Bootstrap** Inference (via\n    [wildboottest](https://github.com/py-econometrics/wildboottest))\n-   **Difference-in-Differences** Estimators:\n    -   The canonical Two-Way Fixed Effects Estimator\n    -   [Gardner's two-stage\n        (\"`Did2s`\")](https://jrgcmu.github.io/2sdd_current.pdf)\n        estimator\n    -   Basic Versions of the Local Projections estimator following\n        [Dube et al (2023)](https://www.nber.org/papers/w31184)\n- **Multiple Hypothesis Corrections** following the Procedure by [Romano and Wolf](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20976314) and **Simultaneous Confidence Intervals** using a **Multiplier Bootstrap**\n- Fast **Randomization Inference** as in the [ritest Stata package](https://hesss.org/ritest.pdf)\n- The **Causal Cluster Variance Estimator (CCV)** following [Abadie et al.](https://economics.mit.edu/sites/default/files/2022-09/When%20Should%20You%20Adjust%20Standard%20Errors%20for%20Clustering.pdf)\n- Regression **Decomposition** following [Gelbach (2016)](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1425737)\n- **Publication-ready tables** with [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) or LaTex booktabs\n\n\n## Installation\n\nYou can install the release version from `PyPI` by running\n\n```py\n# inside an active virtual environment\npython -m pip install pyfixest\n```\n\nor the development version from github by running\n\n```py\npython -m pip install git+https://github.com/py-econometrics/pyfixest\n```\n\n## Benchmarks\n\nAll benchmarks follow the [fixest\nbenchmarks](https://github.com/lrberge/fixest/tree/master/_BENCHMARK).\nAll non-pyfixest timings are taken from the `fixest` benchmarks.\n\n![](benchmarks/lets-plot-images/benchmarks_ols.svg)\n![](benchmarks/lets-plot-images/benchmarks_poisson.svg)\n\n## Quickstart\n\n\n```python\nimport pyfixest as pf\n\ndata = pf.get_data()\npf.feols(\"Y ~ X1 | f1 + f2\", data=data).summary()\n```\n\n    ###\n\n    Estimation:  OLS\n    Dep. var.: Y, Fixed effects: f1+f2\n    Inference:  CRV1\n    Observations:  997\n\n    | Coefficient   |   Estimate |   Std. Error |   t value |   Pr(>|t|) |   2.5% |   97.5% |\n    |:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|\n    | X1            |     -0.919 |        0.065 |   -14.057 |      0.000 | -1.053 |  -0.786 |\n    ---\n    RMSE: 1.441   R2: 0.609   R2 Within: 0.2\n\n\n### Multiple Estimation\n\nYou can estimate multiple models at once by using [multiple estimation\nsyntax](https://aeturrell.github.io/coding-for-economists/econmt-regression.html#multiple-regression-models):\n\n\n\n```python\n# OLS Estimation: estimate multiple models at once\nfit = pf.feols(\"Y + Y2 ~X1 | csw0(f1, f2)\", data = data, vcov = {'CRV1':'group_id'})\n# Print the results\nfit.etable()\n```\n\n                               est1               est2               est3               est4               est5               est6\n    ------------  -----------------  -----------------  -----------------  -----------------  -----------------  -----------------\n    depvar                        Y                 Y2                  Y                 Y2                  Y                 Y2\n    ------------------------------------------------------------------------------------------------------------------------------\n    Intercept      0.919*** (0.121)   1.064*** (0.232)\n    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)\n    ------------------------------------------------------------------------------------------------------------------------------\n    f2                            -                  -                  -                  -                  x                  x\n    f1                            -                  -                  x                  x                  x                  x\n    ------------------------------------------------------------------------------------------------------------------------------\n    R2                        0.123              0.037              0.437              0.115              0.609              0.168\n    S.E. type          by: group_id       by: group_id       by: group_id       by: group_id       by: group_id       by: group_id\n    Observations                998                999                997                998                997                998\n    ------------------------------------------------------------------------------------------------------------------------------\n    Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001\n    Format of coefficient cell:\n    Coefficient (Std. Error)\n\n\n\n\n### Adjust Standard Errors \"on-the-fly\"\n\nStandard Errors can be adjusted after estimation, \"on-the-fly\":\n\n\n```python\nfit1 = fit.fetch_model(0)\nfit1.vcov(\"hetero\").summary()\n```\n\n    Model:  Y~X1\n    ###\n\n    Estimation:  OLS\n    Dep. var.: Y\n    Inference:  hetero\n    Observations:  998\n\n    | Coefficient   |   Estimate |   Std. Error |   t value |   Pr(>|t|) |   2.5% |   97.5% |\n    |:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|\n    | Intercept     |      0.919 |        0.112 |     8.223 |      0.000 |  0.699 |   1.138 |\n    | X1            |     -1.000 |        0.082 |   -12.134 |      0.000 | -1.162 |  -0.838 |\n    ---\n    RMSE: 2.158   R2: 0.123\n\n\n### Poisson Regression via `fepois()`\n\nYou can estimate Poisson Regressions via the `fepois()` function:\n\n\n```python\npoisson_data = pf.get_data(model = \"Fepois\")\npf.fepois(\"Y ~ X1 + X2 | f1 + f2\", data = poisson_data).summary()\n```\n\n    ###\n\n    Estimation:  Poisson\n    Dep. var.: Y, Fixed effects: f1+f2\n    Inference:  CRV1\n    Observations:  997\n\n    | Coefficient   |   Estimate |   Std. Error |   t value |   Pr(>|t|) |   2.5% |   97.5% |\n    |:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|\n    | X1            |     -0.007 |        0.035 |    -0.190 |      0.850 | -0.075 |   0.062 |\n    | X2            |     -0.015 |        0.010 |    -1.449 |      0.147 | -0.035 |   0.005 |\n    ---\n    Deviance: 1068.169\n\n\n### IV Estimation via three-part formulas\n\nLast, `PyFixest` also supports IV estimation via three part formula\nsyntax:\n\n\n```python\nfit_iv = pf.feols(\"Y ~ 1 | f1 | X1 ~ Z1\", data = data)\nfit_iv.summary()\n```\n\n    ###\n\n    Estimation:  IV\n    Dep. var.: Y, Fixed effects: f1\n    Inference:  CRV1\n    Observations:  997\n\n    | Coefficient   |   Estimate |   Std. Error |   t value |   Pr(>|t|) |   2.5% |   97.5% |\n    |:--------------|-----------:|-------------:|----------:|-----------:|-------:|--------:|\n    | X1            |     -1.025 |        0.115 |    -8.930 |      0.000 | -1.259 |  -0.790 |\n    ---\n\n## Call for Contributions\n\nThanks for showing interest in contributing to `pyfixest`! We appreciate all\ncontributions and constructive feedback, whether that be reporting bugs, requesting\nnew features, or suggesting improvements to documentation.\n\nIf you'd like to get involved, but are not yet sure how, please feel free to send us an [email](alexander-fischer1801@t-online.de). Some familiarity with\neither Python or econometrics will help, but you really don't need to be a `numpy` core developer or have published in [Econometrica](https://onlinelibrary.wiley.com/journal/14680262) =) We'd be more than happy to invest time to help you get started!\n\n## Contributors \u2728\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/styfenschaer\"><img src=\"https://avatars.githubusercontent.com/u/79762922?v=4?s=100\" width=\"100px;\" alt=\"styfenschaer\"/><br /><sub><b>styfenschaer</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=styfenschaer\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://www.nkeleher.com/\"><img src=\"https://avatars.githubusercontent.com/u/5607589?v=4?s=100\" width=\"100px;\" alt=\"Niall Keleher\"/><br /><sub><b>Niall Keleher</b></sub></a><br /><a href=\"#infra-NKeleher\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">\ud83d\ude87</a> <a href=\"https://github.com/py-econometrics/pyfixest/commits?author=NKeleher\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"http://wenzhi-ding.com\"><img src=\"https://avatars.githubusercontent.com/u/30380959?v=4?s=100\" width=\"100px;\" alt=\"Wenzhi Ding\"/><br /><sub><b>Wenzhi Ding</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=Wenzhi-Ding\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://apoorvalal.github.io/\"><img src=\"https://avatars.githubusercontent.com/u/12086926?v=4?s=100\" width=\"100px;\" alt=\"Apoorva Lal\"/><br /><sub><b>Apoorva Lal</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=apoorvalal\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/py-econometrics/pyfixest/issues?q=author%3Aapoorvalal\" title=\"Bug reports\">\ud83d\udc1b</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://juanitorduz.github.io\"><img src=\"https://avatars.githubusercontent.com/u/22996444?v=4?s=100\" width=\"100px;\" alt=\"Juan Orduz\"/><br /><sub><b>Juan Orduz</b></sub></a><br /><a href=\"#infra-juanitorduz\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">\ud83d\ude87</a> <a href=\"https://github.com/py-econometrics/pyfixest/commits?author=juanitorduz\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://s3alfisc.github.io/\"><img src=\"https://avatars.githubusercontent.com/u/19531450?v=4?s=100\" width=\"100px;\" alt=\"Alexander Fischer\"/><br /><sub><b>Alexander Fischer</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=s3alfisc\" title=\"Code\">\ud83d\udcbb</a> <a href=\"#infra-s3alfisc\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">\ud83d\ude87</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"http://www.aeturrell.com\"><img src=\"https://avatars.githubusercontent.com/u/11294320?v=4?s=100\" width=\"100px;\" alt=\"aeturrell\"/><br /><sub><b>aeturrell</b></sub></a><br /><a href=\"#tutorial-aeturrell\" title=\"Tutorials\">\u2705</a> <a href=\"https://github.com/py-econometrics/pyfixest/commits?author=aeturrell\" title=\"Documentation\">\ud83d\udcd6</a> <a href=\"#promotion-aeturrell\" title=\"Promotion\">\ud83d\udce3</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/leostimpfle\"><img src=\"https://avatars.githubusercontent.com/u/31652181?v=4?s=100\" width=\"100px;\" alt=\"leostimpfle\"/><br /><sub><b>leostimpfle</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=leostimpfle\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/py-econometrics/pyfixest/issues?q=author%3Aleostimpfle\" title=\"Bug reports\">\ud83d\udc1b</a></td>\n    </tr>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/baggiponte\"><img src=\"https://avatars.githubusercontent.com/u/57922983?v=4?s=100\" width=\"100px;\" alt=\"baggiponte\"/><br /><sub><b>baggiponte</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=baggiponte\" title=\"Documentation\">\ud83d\udcd6</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/sanskriti2005\"><img src=\"https://avatars.githubusercontent.com/u/150411024?v=4?s=100\" width=\"100px;\" alt=\"Sanskriti\"/><br /><sub><b>Sanskriti</b></sub></a><br /><a href=\"#infra-sanskriti2005\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">\ud83d\ude87</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/Jayhyung\"><img src=\"https://avatars.githubusercontent.com/u/40373774?v=4?s=100\" width=\"100px;\" alt=\"Jaehyung\"/><br /><sub><b>Jaehyung</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=Jayhyung\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"http://alexstephenson.me\"><img src=\"https://avatars.githubusercontent.com/u/24926205?v=4?s=100\" width=\"100px;\" alt=\"Alex\"/><br /><sub><b>Alex</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=asteves\" title=\"Documentation\">\ud83d\udcd6</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/greenguy33\"><img src=\"https://avatars.githubusercontent.com/u/8525718?v=4?s=100\" width=\"100px;\" alt=\"Hayden Freedman\"/><br /><sub><b>Hayden Freedman</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=greenguy33\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/py-econometrics/pyfixest/commits?author=greenguy33\" title=\"Documentation\">\ud83d\udcd6</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/saidamir\"><img src=\"https://avatars.githubusercontent.com/u/20246711?v=4?s=100\" width=\"100px;\" alt=\"Aziz Mamatov\"/><br /><sub><b>Aziz Mamatov</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=saidamir\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/rafimikail\"><img src=\"https://avatars.githubusercontent.com/u/61386867?v=4?s=100\" width=\"100px;\" alt=\"rafimikail\"/><br /><sub><b>rafimikail</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=rafimikail\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://www.linkedin.com/in/benjamin-knight/\"><img src=\"https://avatars.githubusercontent.com/u/12180931?v=4?s=100\" width=\"100px;\" alt=\"Benjamin Knight\"/><br /><sub><b>Benjamin Knight</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=b-knight\" title=\"Code\">\ud83d\udcbb</a></td>\n    </tr>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://dsliwka.github.io/\"><img src=\"https://avatars.githubusercontent.com/u/49401450?v=4?s=100\" width=\"100px;\" alt=\"Dirk Sliwka\"/><br /><sub><b>Dirk Sliwka</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=dsliwka\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/py-econometrics/pyfixest/commits?author=dsliwka\" title=\"Documentation\">\ud83d\udcd6</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/daltonm-bls\"><img src=\"https://avatars.githubusercontent.com/u/78225214?v=4?s=100\" width=\"100px;\" alt=\"daltonm-bls\"/><br /><sub><b>daltonm-bls</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/issues?q=author%3Adaltonm-bls\" title=\"Bug reports\">\ud83d\udc1b</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/marcandre259\"><img src=\"https://avatars.githubusercontent.com/u/19809475?v=4?s=100\" width=\"100px;\" alt=\"Marc-Andr\u00e9\"/><br /><sub><b>Marc-Andr\u00e9</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=marcandre259\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/py-econometrics/pyfixest/issues?q=author%3Amarcandre259\" title=\"Bug reports\">\ud83d\udc1b</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/kylebutts\"><img src=\"https://avatars.githubusercontent.com/u/19961439?v=4?s=100\" width=\"100px;\" alt=\"Kyle F Butts\"/><br /><sub><b>Kyle F Butts</b></sub></a><br /><a href=\"#data-kylebutts\" title=\"Data\">\ud83d\udd23</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://fosstodon.org/@marcogorelli\"><img src=\"https://avatars.githubusercontent.com/u/33491632?v=4?s=100\" width=\"100px;\" alt=\"Marco Edward Gorelli\"/><br /><sub><b>Marco Edward Gorelli</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/pulls?q=is%3Apr+reviewed-by%3AMarcoGorelli\" title=\"Reviewed Pull Requests\">\ud83d\udc40</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"http://arelbundock.com\"><img src=\"https://avatars.githubusercontent.com/u/987057?v=4?s=100\" width=\"100px;\" alt=\"Vincent Arel-Bundock\"/><br /><sub><b>Vincent Arel-Bundock</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=vincentarelbundock\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/IshwaraHegde97\"><img src=\"https://avatars.githubusercontent.com/u/187858441?v=4?s=100\" width=\"100px;\" alt=\"IshwaraHegde97\"/><br /><sub><b>IshwaraHegde97</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=IshwaraHegde97\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"12.5%\"><a href=\"https://github.com/RoyalTS\"><img src=\"https://avatars.githubusercontent.com/u/702580?v=4?s=100\" width=\"100px;\" alt=\"Tobias Schmidt\"/><br /><sub><b>Tobias Schmidt</b></sub></a><br /><a href=\"https://github.com/py-econometrics/pyfixest/commits?author=RoyalTS\" title=\"Documentation\">\ud83d\udcd6</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Fast high dimensional fixed effect estimation following syntax of the fixest R package.",
    "version": "0.27.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e728268ba70bbb8accaa3f7cca978baddc0243083c4d7328f283a55c7099a55a",
                "md5": "0ce358470f31b2a699c0365f4361f0ff",
                "sha256": "8fefe2b1ecda4f7780a9e3c77aa53fd56ad6e6ab7287090e0fbeaee436e3e92d"
            },
            "downloads": -1,
            "filename": "pyfixest-0.27.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0ce358470f31b2a699c0365f4361f0ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 2191421,
            "upload_time": "2024-12-15T12:43:34",
            "upload_time_iso_8601": "2024-12-15T12:43:34.295570Z",
            "url": "https://files.pythonhosted.org/packages/e7/28/268ba70bbb8accaa3f7cca978baddc0243083c4d7328f283a55c7099a55a/pyfixest-0.27.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64c88cd065e5e61709d1a4d34dd15d9d564e711f045d04bba032962aaaaaf469",
                "md5": "4bbf9d5a1adc1132cc48b50beb8689b4",
                "sha256": "e038fb4e5c9dcc1da813c5f1215902bdcd9b13b179bd9adacb0b183698566dbe"
            },
            "downloads": -1,
            "filename": "pyfixest-0.27.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4bbf9d5a1adc1132cc48b50beb8689b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8515716,
            "upload_time": "2024-12-15T12:43:39",
            "upload_time_iso_8601": "2024-12-15T12:43:39.019162Z",
            "url": "https://files.pythonhosted.org/packages/64/c8/8cd065e5e61709d1a4d34dd15d9d564e711f045d04bba032962aaaaaf469/pyfixest-0.27.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-15 12:43:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyfixest"
}
        
Elapsed time: 0.61539s