Skip to content
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

[WIP] Bugfix for 5.19-5.22 #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

oadams
Copy link

@oadams oadams commented Sep 6, 2021

I spotted what I think is a bug in the Chapter 5 notebook. In the book, sections 5.19-5.22 do counterfactual modeling with a model where A -> M and A -> D <- M. The predictor A is tweaked and the total effect on D is observed. This total effect comes from the direct link between A and D, but is also mediated by an indirect link via M. That is, values of M need to be simulated as well and their effect on D.

The bug was that it appeared as though the values for M were not being simulated. The difference in the resulting plots in 5.22 is small, but from a modeling perspective it's quite distinct.

This PR isn't quite ready for merge, because my changes break subsequent code from 5.23 onwards. But I am putting the PR up now in the hope of getting feedback on whether I'm doing it the correct way before changing the subsequent code.

Note I haven't run pre-commit checks yet, so don't merge in current state.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant