Pyfixest

Latest version: v0.28.0

Safety actively analyzes 723158 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 11

0.10.10

Fixes a bug with variable interactions via `i(var)` syntax. See [issue 221](https://github.com/s3alfisc/pyfixest/issues/211) for details.

0.10.9

Makes`etable()` prettier & more informative. See 196 and 210 .

0.10.8.1

Breaking changes

Reference levels for the `i()` formula syntax can no longer be set within the formula, but need to be specified via the `i_ref1` function argument to either `feols()` and `fepois()`.

New feature

A `dids2()` function is added, which implements the 2-stage difference-in-differences procedure à la Gardner and follows the syntax of kylebutts [did2s](https://github.com/kylebutts/did2s) R package.

py
from pyfixest.experimental.did import did2s
from pyfixest.estimation import feols
from pyfixest.visualize import iplot
import pandas as pd
import numpy as np

df_het = pd.read_csv("https://raw.githubusercontent.com/s3alfisc/pyfixest/master/pyfixest/experimental/data/df_het.csv")

fit = did2s(
df_het,
yname = "dep_var",
first_stage = "~ 0 | state + year",
second_stage = "~i(rel_year)",
treatment = "treat",
cluster = "state",
i_ref1 = [-1.0, np.inf],
)

fit_twfe = feols(
"dep_var ~ i(rel_year) | state + year",
df_het,
i_ref1 = [-1.0, np.inf]
)

iplot([fit, fit_twfe], coord_flip=False, figsize = (900, 400), title = "TWFE vs DID2S")

![image](https://github.com/s3alfisc/pyfixest/assets/19531450/3e490100-1e70-4714-8ef7-f86a7696d4ad)

0.10.7

Adds basic support for event study estimation via two-way fixed effects and Gardner's two-stage "Did2s" approach. This is a beta version and experimental. Further updates (i.e. proper event studies vs "only" ATTs) and a more flexible did2s front end will follow in a release in the near future =)

py
%load_ext autoreload
%autoreload 2

from pyfixest.experimental.did import event_study
from pyfixest.summarize import etable
import pandas as pd
df_het = pd.read_csv("pyfixest/experimental/data/df_het.csv")

fit_twfe = event_study(
data = df_het,
yname = "dep_var",
idname= "state",
tname = "year",
gname = "g",
estimator = "twfe"
)

fit_did2s = event_study(
data = df_het,
yname = "dep_var",
idname= "state",
tname = "year",
gname = "g",
estimator = "did2s"
)

etable([fit_twfe, fit_did2s])
| Coefficient | est1 | est2 |
|:--------------|:-----------------|:-----------------|
| ATT | 2.135*** (0.044) | 2.152*** (0.048) |
Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001

0.10.6

New Feature

Adds `etable()`, a function to quickly compare different models:

python
%load_ext autoreload
%autoreload 2

from pyfixest.estimation import feols
from pyfixest.utils import get_data
from pyfixest.summarize import etable
import pandas as pd

data = get_data()
fit1 = feols("Y ~ X1", data = data)
fit2 = feols("Y ~ X1 + X2", data = data)
fit3 = feols("Y ~ X2", data = data)

etable([fit1, fit2, fit3])

| Coefficient | est1 | est2 | est3 |
|:--------------|:----------------|:-----------------|:-----------------|
| Intercept | 2.349*** (0.09) | 2.35*** (0.09) | 2.587*** (0.056) |
| X1 | 0.221** (0.069) | 0.228** (0.068) | |
| X2 | | 0.071*** (0.018) | 0.069*** (0.018) |
Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001

0.10.5

- Fixes a bug in IV estimation that triggered an error. See 197 for details. Thanks to aeturrell for reporting!

Page 7 of 11

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.