Releases: py-econometrics/pyfixest
PyFixest 0.12.0
Enhancements:
- Good performance improvements for singleton fixed effects detection. Thanks to @styfenschaer for the PR! See #229.
- Uses the r2u project for installing R and R packages on github actions, with great performance improvements.
- Allows to pass
polars
data frames tofeols()
,fepois()
andpredict()
. #232. Thanks to @vincentarelbundock for the suggestion!
Bug Fixes:
- Missing variables in features were not always handled correctly in
predict()
withnewdata
notNone
in the presence of missing data, which would lead to an error. See #246 for details. - Categorical variables were not always handled correctly in
predict()
withnewdata
notNone
, because the number of fixed effects levels innewdata
might be smaller than indata
. In consequence, some levels were not found, which lead to an error. See #245 for details. Thanks to @jiafengkevinchen for the pointer! - Multicollinearity checks for over-identified IV was not implemented correctly, which lead to a dimension error. See #236 for details. Thanks to @jiafengkevinchen for the pointer!
- The number of degrees of freedom
k
was computed incorrectly if columns were dropped from the design matrixX
in the presence of multicollinearity. See #235 for details. Thanks to @jiafengkevinchen for the pointer! - If all variables were dropped due to multicollinearity, an unclear and imprecise error message was produced. See #228 for details. Thanks to @manferdinig for the pointer!
- If selection
fixef_rm = 'singleton'
,feols()
andfepois()
would fail, which has been fixed. #192
Dependency Requirements:
- For now, sets
formulaic
versions to be0.6.6
or lower as version1.0.0
seems to have introduced a problem with thei()
operator, See #244 for details. - Drops dependency on
pyhdfe
.
PyFixest 0.11.0
- Significant speedups for CRV1 inference thanks to help by @styfenschaer.
- Addition of
fixest
style benchmarks for OLS and Poisson Regression.
PyFixest 0.10.12
Fixes a bug with the separation check for poisson regression #138.
PyFixest 0.10.11
- Fixes bugs with
i(var1, var2)
syntax introduced withPyFixest
0.10.10
.
PyFixest 0.10.10
Fixes a bug with variable interactions via i(var)
syntax. See issue #221 for details.
PyFixest 0.10.9
PyFixest 0.10.8.1
PyFixest 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 R package.
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")
PyFixest 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 =)
%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
PyFixest 0.10.6
New Feature
Adds etable()
, a function to quickly compare different models:
%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
PyFixest 0.10.5
- Fixes a bug in IV estimation that triggered an error. See #197 for details. Thanks to @aeturrell for reporting!