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
Mediation analysis #2352
Mediation analysis #2352
Conversation
A notebook illustrating the mediation procedure: http://nbviewer.ipython.org/urls/umich.box.com/shared/static/jpmd9y99259u6dv0rj6p46993981m7zm.ipynb |
just some general comments: I looked at the reference briefly after you submitted the PR. I understand the basic idea but haven't figured out the assumptions yet. Overall I'm far behind in my readings about the differences of "causality" between statistics and econometrics, mainly Imbens and Rubin articles (and a new book). Essentially, the direction that we have been and are going is that additional functionality in statistics are your area in statsmodels and I try to keep up enough to help with the integration into statsmodels. One question here is where to put it. Should we create a new subdirectory Similar question for propensity score matching, regression discontinuity design, and whatever else will come into statsmodels in future. |
Thanks for the comments. I don't have a strong opinion about where to put it, your suggestions are all fine with me. I've been using this in a project and it holds up pretty well. I used to just use the simple method of multiplying coefficients but was never sure if that was meaningful outside of linear models. This approach seems more correct for generic use. |
Line 351 of mediation.py: index = ["ACME (control)", "ACME (treated)", "ADE (control)", "ADE (treated)", Seems like self.ADE_tx and self.ADE_ctrl should be switched on line 356? |
@sjgiorgi yes, you appear to be correct. I have fixed it. Thanks. Any other comments are very welcome. |
self.ACME_ctrl = indirect_effects_avg[0] | ||
self.ACME_tx = indirect_effects_avg[1] | ||
self.ADE_ctrl = direct_effects_avg[0] | ||
self.ADE_tx = direct_effects_avg[1] |
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.
since these are user facing attributes, longer more descriptive names would be usefull
Looks good based on skimming the code incomplete docstrings, needs eventually some standardized naming with treatment effects, and can go into new folder I did a bit of background reading and opened #2627 for a possible second approach. |
I'm merging this, naming convention might and location will still change before 0.8 release |
Thanks @kshedden As I mentioned, I started to read to catch up with the topic but I'm still far behind. |
This is an implementation of mediation analysis following the approach of Imai and collaborators.