Skip to content

Add RD/RKink sensitivity-checks walkthrough#872

Open
drbenvincent wants to merge 2 commits into
mainfrom
fix/790-rd-rkink-sensitivity-docs
Open

Add RD/RKink sensitivity-checks walkthrough#872
drbenvincent wants to merge 2 commits into
mainfrom
fix/790-rd-rkink-sensitivity-docs

Conversation

@drbenvincent
Copy link
Copy Markdown
Collaborator

Closes #790

Summary

Follow-up to #785: documents how to use the pipeline-style sensitivity checks for {term}`Regression discontinuity design` and {term}`Regression kink design` workflows, mirroring the staggered-DiD walkthrough that landed in `staggered_did_pymc.ipynb`.

  • New Sensitivity analysis section in `rd_pymc.ipynb` with a Related-checks summary, numbered walkthrough, executed pipeline cell running `BandwidthSensitivity` + `McCraryDensityTest`, an HTML-report iframe, pass/fail interpretation, and an If these checks fail troubleshooting block.
  • Refresh of the existing sensitivity section in `rkink_pymc.ipynb` with the same structure: links to `pipeline_workflow` and the central `sensitivity_checks` guide, a Related-checks block clarifying that `McCraryDensityTest`, `PlaceboInTime`, `LeaveOneOut`, and `PlaceboInSpace` are not applicable to RKink, a numbered walkthrough, pass/fail interpretation, and an If this check fails troubleshooting block.
  • Docs only — no code changes.

Notes

  • The bandwidth sweep in `rd_pymc.ipynb` uses the linear interaction formula `y ~ 1 + x + treated + x:treated` rather than basis splines, with an inline note explaining why: `bs(x, df=6)` bakes its knots into the full data and patsy raises an error if a narrower bandwidth subset asks the model to evaluate observations that fall outside those baked-in outer knots.
  • The McCrary check fails on the bundled `rd` dataset purely because the running variable spans `[-1, 1]` while the threshold sits at `0.5`. The notebook flags this explicitly so readers don't read the failure as evidence of manipulation in the example data.

Test plan

  • `prek run --all-files` passes (notebook schema, ruff format, codespell, mypy, BibTeX, etc.)
  • Both notebooks validate with `nbformat.validate`
  • `rd_pymc.ipynb` sensitivity pipeline cell executes successfully (real outputs committed)
  • CI passes on this PR
  • Visual review of the rendered docs page

Made with Cursor

Follow-up to #785: extend rd_pymc.ipynb with a new "Sensitivity analysis"
section that runs `BandwidthSensitivity` + `McCraryDensityTest` via the
pipeline API, and refresh rkink_pymc.ipynb's existing sensitivity section
to match the style established by staggered_did_pymc.ipynb (related
checks, numbered walkthrough, pass/fail interpretation, troubleshooting).
Both notebooks now link back to `pipeline_workflow` and the central
`sensitivity_checks` guide. Docs only; no code changes.

Closes #790

Made-with: Cursor
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@drbenvincent drbenvincent added documentation Improvements or additions to documentation OSS_PRODUCT OSS_PRODUCT project priorities. Labs members should get approval before logging hours. labels Apr 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.59%. Comparing base (deb8774) to head (1444e3f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #872      +/-   ##
==========================================
- Coverage   94.60%   94.59%   -0.02%     
==========================================
  Files          80       80              
  Lines       12764    12764              
  Branches      770      770              
==========================================
- Hits        12076    12074       -2     
- Misses        485      486       +1     
- Partials      203      204       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Remove two trailing empty code cells from rd_pymc.ipynb and a duplicated
"Interpreting pass and fail" markdown cell from rkink_pymc.ipynb so the
rendered docs do not show blank input prompts or repeated content. No
output changes; existing executed outputs are preserved.

Made-with: Cursor
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #32485165 | 📁 Comparing 1444e3f against latest (deb8774)

  🔍 Preview build  

3 files changed
± 404.html
± notebooks/rd_pymc.html
± notebooks/rkink_pymc.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation OSS_PRODUCT OSS_PRODUCT project priorities. Labs members should get approval before logging hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Add RD/RKink sensitivity checks walkthrough (follow-up #749)

1 participant