Add Donut Regression Discontinuity functionality#610
Add Donut Regression Discontinuity functionality#610drbenvincent wants to merge 12 commits intomainfrom
Conversation
Introduces a donut_hole parameter to RegressionDiscontinuity, allowing exclusion of observations within a specified distance from the treatment threshold for robustness against manipulation or heaping. Updates plotting, summary, and input validation to support donut RDD, adds comprehensive tests for donut_hole behavior and validation, expands glossary with donut RDD concepts, and provides a new notebook demonstrating donut RDD usage. References on donut RDD, manipulation, and heaping are added to the bibliography.
|
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 #610 +/- ##
==========================================
+ Coverage 94.35% 94.42% +0.06%
==========================================
Files 44 44
Lines 7517 7626 +109
Branches 456 466 +10
==========================================
+ Hits 7093 7201 +108
Misses 262 262
- Partials 162 163 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Raised the number of generated observations from 500 to 1000 and increased manipulation parameters to better demonstrate the donut RDD approach. Updated output and data table examples to reflect the new data generation settings.
Added tests for warnings when bandwidth or donut_hole filters leave few datapoints, for unrecognized model types, and for donut hole boundary lines in OLS and Bayesian plots. Also updated interrogate badge coverage from 96.3% to 96.4%.
- Conditional two-layer scatter: only show excluded/fit data distinction when data is actually excluded; default case shows single "data" layer - Fix Bayesian plot legend to include all labeled artists (donut boundaries, threshold, scatter labels) instead of only posterior mean - Fix malformed warning when filter_desc is empty on small datasets - Use ValueError instead of DataException for donut_hole param validation - Update tests to expect ValueError for donut_hole validation Co-authored-by: Cursor <cursoragent@cursor.com>
Review fixes (d69f1ff)Addressed four issues identified during review: 1. Conditional scatter plots (was: misleading labels when
|
Documentation build overview
Show files changed (12 files in total): 📝 11 modified | ➕ 1 added | ➖ 0 deleted
|
Closes #609
This pull request adds support for "donut" regression discontinuity designs (RDD), a robustness technique that excludes data near the treatment threshold to mitigate issues like manipulation or heaping. The changes introduce a new
donut_holeparameter to theRegressionDiscontinuityclass, update data filtering logic, enhance plotting and summary outputs, extend input validation, and provide comprehensive tests and documentation for the new feature.Regression Discontinuity Model Enhancements
donut_holeparameter toRegressionDiscontinuity, allowing exclusion of observations within a specified distance from the treatment threshold. Data filtering now respects both bandwidth and donut hole constraints.donut_holeis non-negative and less than bandwidth, raising errors for invalid configurations.User Interface and Visualization
Testing and Documentation
References
📚 Documentation preview 📚: https://causalpy--610.org.readthedocs.build/en/610/