Skip to content

docs: ITS sensitivity walkthrough (#788)#821

Open
drbenvincent wants to merge 2 commits into
mainfrom
issue-788-its-sensitivity-walkthrough
Open

docs: ITS sensitivity walkthrough (#788)#821
drbenvincent wants to merge 2 commits into
mainfrom
issue-788-its-sensitivity-walkthrough

Conversation

@drbenvincent

@drbenvincent drbenvincent commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #788. Delivers the focused ITS sensitivity walkthrough requested as a follow-up to #749, scoped under #785.

Summary

docs/source/notebooks/its_post_intervention_analysis.ipynb (commit 10d2210)

  • Rewrite the fixed-period ITS notebook opening around a concrete marketing-campaign question and add a clearer reader roadmap.
  • Streamline the persistence walkthrough so the main results and sensitivity sections build on each other instead of repeating the same ideas.
  • Reframe the placebo and persistence checks around learner-facing questions, then end with takeaways and a reflection prompt.
  • Adds a worked Pipeline example combining the default PlaceboInTime check (via cp.SensitivityAnalysis.default_for(cp.InterruptedTimeSeries)) with a custom PersistenceCheck, plus a "What to do when a check looks weak" interpretation section.

Cross-linking polish (commit babdd2a)

  • docs/source/notebooks/sensitivity_checks.md: add the walkthrough under both PlaceboInTime and PersistenceCheck in the "Where examples already exist" list, plus the closing :::{seealso} block.
  • docs/source/notebooks/its_pymc.ipynb: add a closing "Going further: sensitivity checks" section pointing readers to the central guide and the new walkthrough.

Scope decision

After discussion on #788, we deliberately did not propagate the full sensitivity walkthrough to every ITS variant (its_pymc, its_covid, its_lift_test, its_pymc_comparative, piecewise_its_pymc, its_skl). Reasons:

  • Avoid the "duplicated check boilerplate" anti-pattern called out in Expand docs coverage for pipeline sensitivity checks #785.
  • Several variants (notably its_skl.ipynb) can't run the PyMC-only checks at all.
  • A single canonical walkthrough plus discoverable links from the central guide and its_pymc.ipynb covers the use case without diluting the pedagogy of each method-specific notebook.

Test plan

  • prek run --all-files
  • make html
  • its_post_intervention_analysis.ipynb executed end-to-end in the CausalPy env
  • its_pymc.ipynb re-executed end-to-end in the CausalPy env so committed outputs reflect the new "Going further" section
  • CI green on this PR (note: check-environment-yml failure is an unrelated upstream pyproject2conda regression, fixed by ci: pin pyproject2conda==0.22.1 to work around 0.23.0 regression #878)
  • RTD preview spot-check: notebooks/its_post_intervention_analysis.html shows the new pipeline + persistence narrative; notebooks/its_pymc.html ends with the "Going further" seealso block; notebooks/sensitivity_checks.html lists the walkthrough under PlaceboInTime and PersistenceCheck

@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 commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator Author

TODO

  • Add plot output for PlaceboInTime results
  • Add plot output for PersistenceCheck results

I believe this plot functionality is being worked on in PR #819

@read-the-docs-community

read-the-docs-community Bot commented Apr 3, 2026

Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #32485220 | 📁 Comparing 4c023ef against latest (deb8774)

  🔍 Preview build  

4 files changed
± 404.html
± notebooks/its_post_intervention_analysis.html
± notebooks/its_pymc.html
± notebooks/sensitivity_checks.html

@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.59%. Comparing base (2ff6b7b) to head (4c023ef).
⚠️ Report is 48 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #821   +/-   ##
=======================================
  Coverage   94.59%   94.59%           
=======================================
  Files          80       80           
  Lines       12764    12764           
  Branches      770      770           
=======================================
  Hits        12074    12074           
  Misses        486      486           
  Partials      204      204           

☔ View full report in Codecov by Harness.
📢 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.

@drbenvincent

Copy link
Copy Markdown
Collaborator Author

Note: this PR is not a duplicate of #806. Both are follow-ups from #749, but they target different methods and different notebooks:

No overlap in files or content.

@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
drbenvincent added a commit that referenced this pull request Apr 30, 2026
Two small follow-ups to PR #821 to improve discoverability of the
ITS sensitivity walkthrough now hosted in
its_post_intervention_analysis.ipynb:

- sensitivity_checks.md: add the walkthrough to the "Where examples
  already exist" list (PlaceboInTime + PersistenceCheck) and to the
  bottom :::{seealso} block.
- its_pymc.ipynb: add a closing "Going further: sensitivity checks"
  section pointing to the central guide and the worked walkthrough.

Re-executed its_pymc.ipynb in the CausalPy env so committed outputs
reflect the new structure.

Refs #788

Made-with: Cursor
@drbenvincent

Copy link
Copy Markdown
Collaborator Author

Failing CI check unrelated to this PR. Fix in flight #878

@drbenvincent drbenvincent changed the title Clarify fixed-period ITS walkthrough narrative docs: ITS sensitivity walkthrough (#788) Apr 30, 2026
@drbenvincent

Copy link
Copy Markdown
Collaborator Author

Heads-up for reviewers: the failing check-environment-yml job is not caused by this PR. It's an upstream regression in pyproject2conda 0.23.0 that hits all currently-open PRs; #878 pins it back to 0.22.1 and will resolve it once merged + this branch is updated from main.

Rework the notebook so readers can follow the example, persistence analysis, and sensitivity checks without prior ITS context. This keeps the focus on learner-facing questions instead of pipeline implementation details.

Made-with: Cursor
Two small follow-ups to PR #821 to improve discoverability of the
ITS sensitivity walkthrough now hosted in
its_post_intervention_analysis.ipynb:

- sensitivity_checks.md: add the walkthrough to the "Where examples
  already exist" list (PlaceboInTime + PersistenceCheck) and to the
  bottom :::{seealso} block.
- its_pymc.ipynb: add a closing "Going further: sensitivity checks"
  section pointing to the central guide and the worked walkthrough.

Re-executed its_pymc.ipynb in the CausalPy env so committed outputs
reflect the new structure.

Refs #788

Made-with: Cursor
@drbenvincent drbenvincent force-pushed the issue-788-its-sensitivity-walkthrough branch from babdd2a to 4c023ef Compare April 30, 2026 14:03
@review-notebook-app

review-notebook-app Bot commented May 2, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

cetagostini commented on 2026-05-02T02:54:35Z
----------------------------------------------------------------

Line #5.        formula="y ~ 1 + t + C(month, levels=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])",

Worth explain the formula, mostly the levels part. You can have people not familiar, at least say what numbers represent other parts are more intuitive.


@review-notebook-app

review-notebook-app Bot commented May 2, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

cetagostini commented on 2026-05-02T02:54:36Z
----------------------------------------------------------------

During the during intervention?


@review-notebook-app

review-notebook-app Bot commented May 2, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

cetagostini commented on 2026-05-02T02:54:37Z
----------------------------------------------------------------

I think this conclusion will change given the updates and corrections in the class, during my PR #826.


@review-notebook-app

review-notebook-app Bot commented May 2, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

cetagostini commented on 2026-05-02T02:54:37Z
----------------------------------------------------------------

During the persistent check are we checking all the remaining time series or the N weeks defined above? This was not very clear to me during the reading.


@review-notebook-app

review-notebook-app Bot commented May 2, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

cetagostini commented on 2026-05-02T02:54:38Z
----------------------------------------------------------------

Good, I like it


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 ITS sensitivity checks walkthrough (follow-up #749)

1 participant