pymc-labs / CausalPy

A Python package for causal inference in quasi-experimental settings
https://causalpy.readthedocs.io
Apache License 2.0
829 stars 53 forks source link

Add propensity weighting schemes and covariate balance plot functionality #311

Closed NathanielF closed 1 month ago

NathanielF commented 3 months ago

In relation to this issue: https://github.com/pymc-labs/CausalPy/issues/303

I'm opening the PR which includes functionality for fitting a propensity score model and analysing the experimental outcomes under different re-weighting schemes.

I've added the relevant classes to and models. I've also demonstrated their use an example notebook with a parameter recovery exercise and an application to real data.

I've added two plotting functions to experiment class to both analyse covariate balance and plot the overlap of the propensity scores and the uncertainty in the estimation of causal effects.

review-notebook-app[bot] commented 3 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 95.65217% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 80.09%. Comparing base (3dc2ffe) to head (0a54532). Report is 14 commits behind head on main.

Files Patch % Lines
causalpy/pymc_experiments.py 95.31% 9 Missing :warning:
causalpy/data_validation.py 81.81% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #311 +/- ## ========================================== + Coverage 77.27% 80.09% +2.82% ========================================== Files 21 21 Lines 1395 1648 +253 ========================================== + Hits 1078 1320 +242 - Misses 317 328 +11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

drbenvincent commented 3 months ago

Sory, not had time to look at this yet I'm afraid - a combination of work + illness. I might also not get time to look next week because of a deadline on a client project. Looking forward to when I can dive into this đź‘Ť

Because this will be a new feature addition, and probably trigger a minor version bump (semantic versioning), I'll ask for at least one other review.

NathanielF commented 3 months ago

No worries.

AlexAndorra commented 2 months ago

FYI, I'll review this next week @NathanielF -- made space for it

review-notebook-app[bot] commented 2 months ago

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2024-04-08T16:53:44Z ----------------------------------------------------------------

Link to Hernan's book


NathanielF commented on 2024-04-14T19:12:04Z ----------------------------------------------------------------

Done