Skip to content

Lock SDiD tau at zero for a constant gap and simplex time weights - #1209

Merged
drbenvincent merged 3 commits into
pymc6_and_pymcmarketing1_migrationfrom
feat/sdid-tau-constant-gap
Sep 26, 2026
Merged

drbenvincent merged 3 commits into
pymc6_and_pymcmarketing1_migrationfrom
feat/sdid-tau-constant-gap

Conversation

@drbenvincent

Copy link
Copy Markdown
Collaborator

Closes #1202

Summary

  • Add a regression test that a constant nonzero treated-minus-synthetic gap and simplex time weights produce tau 0.
  • The same constant gap with weights that sum to 0.5 produces tau 2, so the test is not the existing all-zero-gap case.
  • Leave _compute_tau unchanged.

Test plan

  • pytest causalpy/tests/test_sdid_helpers.py::TestComputeTau --no-cov

Made with Cursor

A zero-gap test does not exercise the cancellation that requires the weights to sum to one.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the bug Something isn't working label Sep 26, 2026

@drbenvincent drbenvincent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executive Summary

Recommendation: approve (posted as comment because GitHub blocks self-approval on this PR).

This PR meets issue #1202's definition of done: it adds a regression test that a constant nonzero treated-minus-synthetic gap with simplex time weights yields τ = 0, leaves _compute_tau untouched, and includes the non-simplex control probe so the case is not confusable with the existing all-zero-gap test.

Review focus

  • DoD vs issue #1202: constant gap 4, T_pre=5, T_post=3, simplex λ, plus off-simplex λ summing to 0.5 → expected τ 2.0. Matches the probe in the issue.
  • Math: for constant gap c, τ = c * (1 - sum(λ)). Simplex ⇒ 0; sum(λ)=0.5 ⇒ 4 * 0.5 = 2. Asserts are correct.
  • Scope: diff is test-only under TestComputeTau; production _compute_tau unchanged as required.
  • Local evidence: pytest causalpy/tests/test_sdid_helpers.py::TestComputeTau --no-cov → 3 passed.

Findings

None. No correctness bugs, contract violations, or DoD gaps.

Grouped by file: no issues in causalpy/tests/test_sdid_helpers.py (only changed file).

Merge readiness

Verdict: approve (content). Note the PR is still marked draft and remote CI was still pending at review time; mark ready for review / wait on green before merge. Another maintainer will need to click Approve if a formal approval is required (self-approval is disallowed).

What worked well

  • Explicit contrast with test_tau_is_zero_when_gaps_are_zero in the docstring (zero gaps make any weights give τ=0).
  • Off-simplex control assertion locks in that the cancellation depends on sum(λ)=1, not on a zero gap.

@drbenvincent
drbenvincent marked this pull request as ready for review September 26, 2026 14:28
@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.15%. Comparing base (a931037) to head (da4630f).

Additional details and impacted files
@@                         Coverage Diff                         @@
##           pymc6_and_pymcmarketing1_migration    #1209   +/-   ##
===================================================================
  Coverage                               97.14%   97.15%           
===================================================================
  Files                                     130      130           
  Lines                                   24033    24043   +10     
  Branches                                 1349     1349           
===================================================================
+ Hits                                    23348    23358   +10     
  Misses                                    477      477           
  Partials                                  208      208           

☔ 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 drbenvincent added tests Add or strengthen tests for behavior that is already correct and removed bug Something isn't working labels Sep 26, 2026
@daimon-pymclabs
daimon-pymclabs changed the base branch from main to pymc6_and_pymcmarketing1_migration September 26, 2026 16:01
…constant-gap

Bring the branch up to date after #1214 synced main into the migration branch.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #34779048 | 📁 Comparing da4630f against latest (89f18de)

  🔍 Preview build  

397 files changed · + 126 added · ± 251 modified · - 20 deleted

+ Added

± Modified

- Deleted

@drbenvincent
drbenvincent merged commit c0bba46 into pymc6_and_pymcmarketing1_migration Sep 26, 2026
16 checks passed
@drbenvincent
drbenvincent deleted the feat/sdid-tau-constant-gap branch September 26, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Add or strengthen tests for behavior that is already correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock SDiD tau at zero for a constant gap and simplex time weights

1 participant