py-econometrics / pyfixest

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

Panelview Function #481

Open s3alfisc opened 3 weeks ago

s3alfisc commented 3 weeks ago

Code by @apoorvalal .

I have slightly renamed function arguments, added docstrings & type hinting, and a very basic API test.

This also took me twice because I forgot to check out the dev branch 😅

@apoorvalal , do you think there would be value in adding this function as a post-estimation method to the DiD estimators?

apoorvalal commented 3 weeks ago

looks good; can also add as a method attached to the DiD estimator classes but I like the idea of having it free-standing because ideally you make this plot before running any regressions since it should inform your choice of estimator (e.g. if all treatment is in one cohort, 2WFE doesn't have negative weighting problems).

I will clone this and develop it a bit further (e.g. collapse the data by some level, e.g. state) before plotting

s3alfisc commented 3 weeks ago

I like the idea of having it free-standing because ideally you make this plot before running any regressions

I agree 👍 to clarify my suggestion, it would have been to keep it as a standalone function, but to also add it as a post-estimation method, purely as convenience for users who might want to check post hoc. But maybe we shouldn't incentivize poor research practices so happy to drop the post-estimation method idea.

s3alfisc commented 3 weeks ago

On the point of setting a good example - it would be to add an example of the function at the beginning of the DiD notebook =)