-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterative rectifier #534
Iterative rectifier #534
Conversation
For reference, here's the code snippet I used to run the additional test cases:
|
Wow, super cool, thank you Leo (@leostimpfle)! Did not expect this PR to come so soon =) I'll take a first look tonight, but I think reviewing the algos more carefully will take me until this weekend. Thank you! =) |
Thanks @s3alfisc ! No rush, happy to have a chat to run through the code if helpful. In the meantime I will try to review the failed checks. It looks like I did something wrong with the typed arguments. |
Codecov ReportAttention: Patch coverage is
|
My initial implementation didn't account for complex formulae such as In the latest version, @s3alfisc Please let me know any thoughts (appreciate it may not be the most elegant solution). |
This weekend I will review your PR @leostimpfle! Sorry about the long delay :-/ |
Hi @leostimpfle , finally got around to taking a look at the algo in more detail. Looks good to me! I merged the master branch into the PR and did the required updates. I have one minor question: Currently, fepois only checks for separation when there are fixed effects. There is this line pyfixest/pyfixest/estimation/fepois_.py Line 132 in a0c67cc
If you have the time, it would also be awesome if we could implement a few more tests against Best, Alex |
Hi @s3alfisc ! In principle, the iterative rectifier should work without fixed effects but I think it's fine to only run it if fixed effects are included in the specification. It's been a while since I looked at it but I'll have a closer look at it over the next week. Will also implement further tests against |
Very cool, thanks Leo! =) |
Hi @s3alfisc , I have updated Let me know any feedback! |
Hi @leostimpfle , this should be good to merge after we fix the merge conflicts as far as I can see, do you agree? If yes I can fix the conflicts and merge later =) |
Sorry, accidentally merged to master. Will open a new PR based on this branch! |
This PR implements the iterative rectifier algorithm by Correia et al. (2021, http://arxiv.org/abs/1903.01633). This is the first step of issue #457 .
Updates
The main updates are:
_check_for_separation
is now a wrapper calling the individual methods specified via the optionalmethods
arguments. By default all methods are executed_check_for_separation_fe
and_check_for_separation_ir
_check_for_separation_ir
is the newly implemented iterative rectifier checkseparation_methods
that allows the user to specify which separation checks to run (and defaults to all methods)Tests
I have updated
test_poisson
with an additional very basic example of separation that only works with the iterative rectifier.The
ppmlhdfe
package contains many additional test cases here and I have tested my implementation against these cases. All cases work apart02.csv
,03.csv
,04.csv
,12.csv
,13.csv
):ppmlhdfe
allows empty regressors whilepyfixest
does not (i.e., formulae of the formy | fe1 + fe2
)07.csv
: runningfpeois
on this dataset throwsValueError: Demeaning failed after 100_000 iterations.
This dataset is also excludedppmlhdfe
's separation tests invalidate_tagsep.do
and I have therefore not further investigated the cause.If useful, I can extend
test_poisson
to include further test cases frompalmhdfe
?