-
Notifications
You must be signed in to change notification settings - Fork 78
Propensity score Joint Estimation Versus 2 stage Estimation #500
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
Propensity score Joint Estimation Versus 2 stage Estimation #500
Conversation
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #500 +/- ##
=======================================
Coverage ? 95.15%
=======================================
Files ? 28
Lines ? 2435
Branches ? 0
=======================================
Hits ? 2317
Misses ? 118
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:09Z Can you briefly describe what you want to compare, just to keep the storyline flow? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:10Z Can you please remove this output ? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:11Z @NathanielF Thank you for this simulation! I wanted to do this for years, and this makes everything very clear! |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:11Z Could you please add an explanation for this section? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:12Z Can you please add explanation on what these numbers represent (again, for the non-expert users) |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:12Z can you please remove this output? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:13Z Can you add explanation of this model comparison |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:13Z Again, can you please add some explanatory test here? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:14Z Can you please remove this output? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2025-07-12T08:29:14Z Can you please remove this output? |
added a box to this effect View entire conversation on ReviewNB |
Left this as it was. Seemed overkill View entire conversation on ReviewNB |
added dims View entire conversation on ReviewNB |
added a box to highlight.
Re: IV models. I think it's different the equations aren't directly influencing one another. The outcomes of the two equations in the IV are being modelled in the likelihood as a bivariate potentially correlated pair. I think an instrument plays a different role than a propensity score and the modularity isn't required in the same way. View entire conversation on ReviewNB |
renamed View entire conversation on ReviewNB |
I.E. one prediction doesn't feed into the next, we just allow that there maybe some correlation between both predictions View entire conversation on ReviewNB |
I've added the Fan li reference throughout. It's mainly her talk and paper that i'm referring to here. Added again in the conclusion, rather than here because it's more likely to spur follow up there. View entire conversation on ReviewNB |
Added View entire conversation on ReviewNB |
used item accessor to tidy View entire conversation on ReviewNB |
used item accessor to tidy View entire conversation on ReviewNB |
Fixed View entire conversation on ReviewNB |
hidden View entire conversation on ReviewNB |
added. View entire conversation on ReviewNB |
added reference to Hernan's book here. View entire conversation on ReviewNB |
hidden View entire conversation on ReviewNB |
added more citations View entire conversation on ReviewNB |
hidden View entire conversation on ReviewNB |
added a spline plot and admonition box explaining the idea View entire conversation on ReviewNB |
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Maybe try this https://stackoverflow.com/questions/18632781/how-to-make-an-internal-link-to-a-heading-in-sphinx-restructuredtext-without-cre Otherwise don't worry about it. View entire conversation on ReviewNB |
Weird, I don't need to do that on my Mac. No matter View entire conversation on ReviewNB |
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.
- Thanks for adding in references and the glossary term. And the video.
- Typo in the notebook title, "Pardox" -> "Paradox"
- "Can we not simple estimate" -> "simply"
- "No we define" -> "Now"
- There are quite a lot of subheadings that appear in the right hand bar in the rendered doc. Could maybe impose a little more structure by modifying the example sections to be "Example 1: mosquito nets", etc. Might be micromanaging, but could potentially have a new section "Specifying the models" and then lower level headings for the joint, 2 stage, and simple regression models? Feel free to ignore though.
- Deal with this warning
Data is now always mutable. Specifying the
mutablekwarg will raise an error in a future release
- I left another few comments in the nbreview. See how you get on. Otherwise this is good to go.
Will preemptively approve. Feel free to merge when you think it's done :)
@@ -44,3 +44,10 @@ | |||
<div class="video-container"> | |||
<iframe width="560" height="315" src="https://www.youtube.com/embed/QAzAFess1AA?si=zD6PrljOFUyvjm1I" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> | |||
</div> | |||
|
|||
|
|||
## Uncertainty and Causal Inference in Python with CausalPy |
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.
Nice to add this :)
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
Working on a draft PR to improve or augment the existing propensity scoring weighting implementation. In particular to make it a bit faster and more "Bayesian". As it currently stands we are performing a two-step strategy where we fit a propensity score model and then push the values of the posterior estimate for the propensity score through a re-weighting routine to estimate the causal contrast.
But we could try and explore a more properly Bayesian model where we fit the propensity score outcome and the model outcome at once in the same model context. This more properly Bayesian and a good bit faster.
See for instance, work here: https://github.com/ajnafa/Latent-Bayesian-MSM by Jordan Nafa and Andrew Heiss
---- EDIT ----
So i think i've finally understood the role of the propensity score in Bayesian estimation and I demonstrate that the two-stage method is what we actually want. The changes i've made are actually quite small. I've added a function to the PyMC model associated with the inverse propensity experiment class.
But in the notebook example i show why this two-stage process is to be preferred over the joint fit model.
📚 Documentation preview 📚: https://causalpy--500.org.readthedocs.build/en/500/