Skip to content

Docs: Add Synthetic Control sensitivity checks walkthrough (port of #871) - #1190

Merged
cetagostini merged 1 commit into
pymc6_and_pymcmarketing1_migrationfrom
migration/871-sc-sensitivity
Sep 18, 2026
Merged

cetagostini merged 1 commit into
pymc6_and_pymcmarketing1_migrationfrom
migration/871-sc-sensitivity

Conversation

@cetagostini

Copy link
Copy Markdown
Collaborator

Summary

Fresh re-implementation of the essence of #871 (labeled migration:needs-port) on the migration branch — no commits ported. #871 targets sc_pymc.ipynb; the walkthrough is re-applied to the branch's synthetic-control-pymc.ipynb against the current pipeline and check APIs.

Added ## Sensitivity analysis section (before References)

  • Related checks for synthetic control: PlaceboInTime (default), ConvexHullCheck, LeaveOneOut, PlaceboInSpace, PriorSensitivity — each with the vulnerability it targets; notes which checks are not applicable.
  • Placebo-in-time check: mechanics (hierarchical status-quo null), 4-step walkthrough, CheckResult metadata map (null_samples, fold_results), interpretation of pass / fail / INCONCLUSIVE.
  • If this check fails: 5-step diagnostic path (fold summaries, donor pool, complementary SC checks, convex hull, prior sensitivity).
  • Pipeline cell: EstimateEffect(cp.SyntheticControl) → SensitivityAnalysis(PlaceboInTime) → GenerateReport + HTML report iframe.

Re-executed with the pymc 6 env (scripts/run_notebooks/runner.py --full): both folds complete, verdict SUPPORTED — P(actual outside null) = 0.999, actual cumulative impact ≈ −37.4.

Adaptations to the branch state

  1. Stale limitations note dropped. PR Docs: Add Synthetic Control sensitivity checks walkthrough #871 carried a "Known limitations being tracked" note for PlaceboInTime: guard against placebo folds with insufficient pre-period #875 (placebo folds landing with too-short pre-periods) and PlaceboInTime: end-to-end reproducibility — seed posterior predictive and unify seed surface #876 (unseeded posterior predictive drifting the verdict). Both issues are closed and fixed on this branch: PlaceboInTime accepts an explicit intervention_length, and theta_new sampling is seeded end-to-end. Porting the note verbatim would have documented bugs that no longer exist.
  2. The PlaceboInTime: guard against placebo folds with insufficient pre-period #875 remedy is now the worked example. With the default derived window length, fold 1 on this short series is skipped and the check reports INCONCLUSIVE. The cell passes intervention_length=20 (the documented fix), both folds fit, and the seeded run is deterministic. The narrative explains the trade-off the check records in comparison_window (20-observation placebo windows vs the 30-observation actual post period) and why the separation probability reads as an upper bound — matching the check's own UserWarning in the output.
  3. Glossary term uses branch spelling {term}\Synthetic control`; docnames adapted (pipeline-workflow); citations abadie2010synthetic, abadie2021using, reichardt2019quasiverified against branchreferences.bib`.

Verification

  • prek run green (Validate notebooks, codespell, PyMarkdown, gallery/rediraffe).
  • Notebook executed end-to-end; no errors, no stray backend warnings.

Part of the #1048 migration effort. Supersedes #871 once the migration branch lands.

Redo the essence of #871 on the migration branch notebook. #871 predates the
hyphen-case notebook renames, so the walkthrough is re-applied to
synthetic-control-pymc.ipynb against the current pipeline and check APIs.

Adds the 'Sensitivity analysis' section before References:
- Related checks for synthetic control: PlaceboInTime (default),
  ConvexHullCheck, LeaveOneOut, PlaceboInSpace, PriorSensitivity.
- Placebo-in-time check mechanics, walkthrough, interpretation guidance
  (pass / fail / INCONCLUSIVE verdicts), and a five-step 'If this check fails'
  diagnostic path.
- Pipeline cell: EstimateEffect(cp.SyntheticControl) -> SensitivityAnalysis
  (PlaceboInTime) -> GenerateReport, plus the HTML report iframe.
Re-executed with the pymc 6 env via scripts/run_notebooks/runner.py.

Adaptations to the branch state:
- The PR-era 'Known limitations being tracked' note (#875 short fold
  pre-periods, #876 unseeded posterior predictive) is dropped: both issues
  are fixed on this branch. PlaceboInTime now accepts an explicit
  intervention_length and seeds theta_new end-to-end.
- The walkthrough instead demonstrates the #875 remedy directly:
  intervention_length=20 keeps both folds eligible on this short series, and
  the seeded run yields a deterministic SUPPORTED verdict
  (P(actual outside null) = 0.999), with the comparison-window caveat
  (20-observation placebo windows vs 30-observation actual post period)
  explained in the narrative and surfaced by the check's own warning.
- Glossary term uses the branch spelling {term}`Synthetic control`; docnames
  adapted (pipeline-workflow, sensitivity_checks); citations verified against
  branch references.bib.
@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

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #34633884 | 📁 Comparing 79325bf against latest (654313d)

  🔍 Preview build  

392 files changed · + 123 added · ± 249 modified · - 20 deleted

+ Added

± Modified

- Deleted

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.24%. Comparing base (0c17458) to head (79325bf).

Additional details and impacted files
@@                         Coverage Diff                         @@
##           pymc6_and_pymcmarketing1_migration    #1190   +/-   ##
===================================================================
  Coverage                               97.24%   97.24%           
===================================================================
  Files                                     129      129           
  Lines                                   23553    23553           
  Branches                                 1318     1318           
===================================================================
  Hits                                    22904    22904           
  Misses                                    440      440           
  Partials                                  209      209           

☔ 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.

@cetagostini
cetagostini merged commit 84f8ef8 into pymc6_and_pymcmarketing1_migration Sep 18, 2026
16 checks passed
@cetagostini
cetagostini deleted the migration/871-sc-sensitivity branch September 18, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant