py-econometrics / pyfixest

Fast High-Dimensional Fixed Effects Regression in Python following fixest-syntax
https://py-econometrics.github.io/pyfixest/
MIT License
176 stars 35 forks source link

Csdid Front End via event_study() #690

Open s3alfisc opened 3 weeks ago

s3alfisc commented 3 weeks ago

PyFixest supports a unified front end for three did estimators - twfe, did2s, and linear projections. It would be cool to allow for other estimators, potentially implemented in outside/ standalone packages.

For example, csdid by @alexanderquispe implements the C&S estimator and looks high quality.

We could add csdid as an optional dependency and allow users to call it via the event_study frontend.

@alexanderquispe what would you think about this?

Also @rafimikail fyi

Jayhyung commented 4 days ago

Hi @s3alfisc! I personally want to tackle this issue as I've been through Callaway and Sant’Anna 2021 and their package. Did anyone pick this up already(I'm okay to pick other issues If @rafimikail already took this)? Just for the record, are we adding this csdid package as a dependency for pyfixest? Thanks always!

s3alfisc commented 4 days ago

Hi @Jayhyung, @rafimikail hasn't started on this, so I would happily assign it to you =) The idea was to add csdid as an optional runtime dependency so that users do not have to install the package if they don't need it. As a mid-term goal, I was thinking of moving the did module out of pyfixest into a standalone package that functions as a wrapper / API to multiple did implementations. The counterargument against doing all of this is that we are risking pyfixest to get quite bloated. Not sure what is best. Maybe you have any thoughts on this @Jayhyung?

Jayhyung commented 2 days ago

My guess is that it would be certainly better to spin off did part as a different package, as users who are interested in did module will be the different group of the users. Also with the current pyfixest, we cannot implement CS estimator, as this estimator requires covariate adjustment step using IPW or DR for estimating each group-time ATT, so we also need separate methods(maybe a package or module for this?) for doing this step. Actually csdid package imports drdid to do this. I guess embedding IPW or DR to the current pyfixest codebase will be a bit weird ;). This will be my first time making a standalone package, so let me check on this and study further. So please assign this issue to me and I will bring a bit more concrete plan before I start coding. Thanks!

bernardodionisi commented 2 days ago

Or just use differences, which is a fast, scalable, and feature-rich implementation of the various estimation methods discussed in Callaway and Sant'Anna and other papers with that flavor.

By the way, I am also happy to add other methods to differences if you guys are interested in working toward that goal!

Jayhyung commented 2 days ago

Hi @bernardodionisi ! This is a great package! I will look into this. Thanks!

s3alfisc commented 1 day ago

By the way, I am also happy to add other methods to differences if you guys are interested in working toward that goal!

Yep, building around differences might also be a good option! We should definitely discuss this =)