Skip to content

Releases: py-econometrics/pyfixest

PyFixest 0.12.0

31 Dec 15:07
Compare
Choose a tag to compare

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 to feols(), fepois() and predict(). #232. Thanks to @vincentarelbundock for the suggestion!

Bug Fixes:

  • Missing variables in features were not always handled correctly in predict() with newdata not None 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() with newdata not None, because the number of fixed effects levels in newdata might be smaller than in data. 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 matrix X 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() and fepois() would fail, which has been fixed. #192

Dependency Requirements:

  • For now, sets formulaic versions to be 0.6.6 or lower as version 1.0.0 seems to have introduced a problem with the i() operator, See #244 for details.
  • Drops dependency on pyhdfe.

PyFixest 0.11.0

23 Nov 08:39
3f14be7
Compare
Choose a tag to compare
  • Significant speedups for CRV1 inference thanks to help by @styfenschaer.
  • Addition of fixest style benchmarks for OLS and Poisson Regression.
    image

PyFixest 0.10.12

16 Nov 20:36
6bb8d7b
Compare
Choose a tag to compare

Fixes a bug with the separation check for poisson regression #138.

PyFixest 0.10.11

13 Nov 22:52
Compare
Choose a tag to compare
  • Fixes bugs with i(var1, var2) syntax introduced with PyFixest 0.10.10.

PyFixest 0.10.10

10 Nov 19:14
c683dd2
Compare
Choose a tag to compare

Fixes a bug with variable interactions via i(var) syntax. See issue #221 for details.

PyFixest 0.10.9

07 Nov 19:15
0116ada
Compare
Choose a tag to compare

Makesetable() prettier & more informative. See #196 and #210 .

PyFixest 0.10.8.1

05 Nov 18:06
b5d37d7
Compare
Choose a tag to compare

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")

image

PyFixest 0.10.7

01 Nov 14:16
dccce10
Compare
Choose a tag to compare

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

29 Oct 13:33
0c3b162
Compare
Choose a tag to compare

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

28 Oct 19:43
992865f
Compare
Choose a tag to compare
  • Fixes a bug in IV estimation that triggered an error. See #197 for details. Thanks to @aeturrell for reporting!