Skip to content

Conversation

@s3alfisc
Copy link
Member

Add support for GLMs with fixed effects.

import numpy as np
import pandas as pd
import pyfixest as pf

data = pf.get_data(N=500, seed=42)
data["Y_binary"] = np.where(data["Y"] > 0, 1, 0)
data = data.dropna()

fit_fe = pf.feglm("Y_binary ~ X1 + X2 | f1", data=data, family="logit", vcov="hetero", ssc = pf.ssc(k_adj = False, G_adj = False))
fit_C = pf.feglm("Y_binary ~ X1 + X2 + C(f1)", data=data, family="logit", vcov="hetero", ssc = pf.ssc(k_adj = False, G_adj = False))

pf.etable([fit_fe, fit_C], keep = ["X1", "X2"], digits = 6)
image

To be tackled in separate PRs:

  • accelerations as described in the ppmlhdfe paper
  • unification of the Fepois and GLM.Poisson classes
  • refactoring of the weighing logic - separate weights and irls weights, never pre-multiply Y, X as this is not explicit / confusing

@Dpananos @leostimpfle FYI (have a great start into the new year!)

@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

❌ Patch coverage is 6.75676% with 69 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pyfixest/estimation/feglm_.py 3.07% 63 Missing ⚠️
pyfixest/estimation/feols_.py 0.00% 3 Missing ⚠️
pyfixest/did/lpdid.py 0.00% 2 Missing ⚠️
pyfixest/estimation/FixestMulti_.py 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (d83e15b) and HEAD (926ff4a). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (d83e15b) HEAD (926ff4a)
core-tests 2 0
tests-extended 1 0
Flag Coverage Δ
core-tests ?
tests-extended ?
tests-vs-r 16.90% <6.75%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pyfixest/estimation/estimation.py 9.30% <ø> (-81.40%) ⬇️
pyfixest/estimation/fegaussian_.py 61.29% <100.00%> (-25.38%) ⬇️
pyfixest/estimation/felogit_.py 54.28% <100.00%> (-33.95%) ⬇️
pyfixest/estimation/feprobit_.py 50.00% <100.00%> (-40.25%) ⬇️
pyfixest/estimation/FixestMulti_.py 18.08% <0.00%> (-60.11%) ⬇️
pyfixest/did/lpdid.py 18.27% <0.00%> (-76.35%) ⬇️
pyfixest/estimation/feols_.py 7.85% <0.00%> (-83.54%) ⬇️
pyfixest/estimation/feglm_.py 22.22% <3.07%> (-56.95%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants