-
Notifications
You must be signed in to change notification settings - Fork 77
Enable multiple treated units in synthetic control quasi experiments #494
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #494 +/- ##
==========================================
+ Coverage 94.59% 95.13% +0.54%
==========================================
Files 28 28
Lines 2053 2384 +331
==========================================
+ Hits 1942 2268 +326
- Misses 111 116 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…to multicell geolift notebook
Note to selfRelatively happy with where this is at now. I should do more manual inspection of the tests (which were vibe coded). There is definitely scope to remove some conditional branching if we set the likelihood of all models to be 1 dimensions. So it would change from |
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.
Pull Request Overview
This PR enables handling multiple treated units throughout the synthetic control workflow by updating documentation, extending the PyMC models, and adding comprehensive multi-unit tests.
- Added
sphinx-togglebutton
for interactive docs - Extended
PyMCModel
andWeightedSumFitter
to accept and process multiple treated units - Updated
SyntheticControl
class and added end-to-end tests for multi-unit scenarios
Reviewed Changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
pyproject.toml | Added sphinx-togglebutton to docs dependencies |
docs/source/conf.py | Registered sphinx_togglebutton extension |
causalpy/tests/test_pymc_models.py | Added fixtures and tests for multi-unit WeightedSumFitter |
causalpy/tests/test_integration_pymc_examples.py | Added fixtures and integration tests for multi-unit SyntheticControl |
causalpy/pymc_models.py | Updated _data_setter , predict , score , and coefficient printing to support multi-unit |
causalpy/experiments/synthetic_control.py | Renamed dims (control_units → coeffs ), parameterized plots and data getters for treated units |
The likelihood of all models is now 2 dimensional. This means we don't have to do conditional branching for single vs multiple treatment units. So we've been able to remove a lot of the code in PyMCModel. This has touched a number of experiment classes which are not related to synthetic control.
That last commit was quite a big one. Model likelihoods are now 2-dimensional. This means we can avoid a lot of conditional branching based on single vs multiple treated unit situations. |
Closes #456
📚 Documentation preview 📚: https://causalpy--494.org.readthedocs.build/en/494/