-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add Notebook on Stargazer
and pymarginaleffects
support to the docs
#473
Conversation
Stargazer
support to the docsStargazer
and pymarginaleffects
support to the docs
Cool PR! The error from the CI looks weird. ____________________ ERROR collecting tests/test_confint.py ____________________
ImportError while importing test module '/home/runner/work/pyfixest/pyfixest/tests/test_confint.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_confint.py:1: in <module>
import doubleml as dml
../../../.cache/pypoetry/virtualenvs/pyfixest-va_uSH9_-py3.12/lib/python3.12/site-packages/doubleml/__init__.py:1: in <module>
from pkg_resources import get_distribution
E ModuleNotFoundError: No module named 'pkg_resources' I have seen DoubleML does not support python 3.12 https://github.com/DoubleML/doubleml-for-py/blob/main/setup.py Maybe see https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources |
Thanks for taking a look at the error! DoubelML is only used for testing simultaneous confidence intervals - I think I should just rework the tests to only run the DoubleML implementation once and then save it to a file that the tests can read from. This way, there's less room for error! Btw, I am very excited about Stargazer support, I think that it produces very pretty tables =) |
This PR adds an internal import pyfixest as pf
fit = pf.feols("Y ~ X1 | csw(f1, f2)"
Stargazer(fit.to_list()) will return a Stargazer table including info on the employed fixed effects. @aeturrell, are there any other utility functions you'd like to see? E.g. we could add methods to easily add randomization inference / bootstrap p-values, but given that |
Juan (@juanitorduz ) - is it considered bad practice to exclude dev dependencies from the pyproject.toml? If no, I would just drop |
This sounds like a hack 😄. What about just keeping it in and skipping the tests for the specific Python version using |
tests/test_confint.py
Outdated
@@ -47,6 +50,7 @@ def test_confint(): | |||
assert np.all(confint1 != confint3) | |||
|
|||
|
|||
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python3.11 or lower.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you import doubleml
inside the test test_against_doubleml
so that it does not get imported globally? I think the error is even at import time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked 🎉!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Was just about to comment 😀 thanks for your help! Now I need to work towards acceptance of the stargazer pr. Do you have any feedback on the content of the new notebooks? Both of them might need some polish here and there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I manly looked into the CI issue. I can take a look into the notebooks themselves either today or tomorrow :)
@s3alfisc did you remove the ReviewNB app? |
Oh wow, this is so cool! The only other metrics I can think of that you sometimes see on these tables is the BIC and the pseudo or adjusted R2. Though the latter sometimes replaces R2. But agree with your instinct that if it's easy to add extra lines then it's not something I'd worry too much about. Once this is merged in and released, let me know, and I will make sure I (eventually!) update Coding for Economists to show how stargazer and pymarginaleffects can be used with pyfixest. |
I was wondering about this as well - I think it didn't survive the migration to py-econometrics. Will fix this after work! |
Yes, that was it - you can take a look at the notebooks here.
None of these are implemented yet, unfortunately 😅 I was thinking that it could be a nice add-on if |
@s3alfisc This week I am swamped with work 😢 . Fel free to merge this one as it overall looks good! I can take a better look next week and open a PR if necessary :) (when ReviewNB is back XD ) |
No worries! I agree that both should be fine =) Btw, the notebooks are back, it was indeed the package migration. |
@@ -0,0 +1,371 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the non-expert readers, I suggest you explain how you reach this conclusion from the table :) For example, is it the -0.81?
Reply via ReviewNB
@s3alfisc Apologies for the late review! I did not know about this integration with the py-marginal effects package! Super useful! I just added some suggestions to make the content more welcoming, especially for new users who are not familiar with the topic 💪 Other than that I think we should share this to the (Python) world :D |
Thanks Juan! No worries at all - last week, it was me who was really swamped with work, so I can very much relate! I'll tackle your comments throughout the week =)
Yes, we should! I thing that |
Yes! PLease do so! I want to explore the package integration further and most likely expand the examples :) |
When this is merged and out, will give it a boost so people are aware. Very cool. |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@s3alfisc I think the notebooks look good! I would suggest we take an iterative approach and merge -> collect feedback -> iterate :) I think many people would just benefit by knowing we can integrate pyfixest and marginal effects |
Thanks for your feedback Juan! I agree that an iterative approach is the most reasonable one here =) will merge now! |
Add jupyter notebooks that shows how to use
Stargazer
andmarginaleffects
with pyfixest.