Skip to content

Commit a6f11d8

Browse files
igerberclaude
andcommitted
Address R16 polish (2 P3-informational, 2 no-action) on PreTrendsPower
R16 verdict was ✅ Looks good (6th overall ✅), with all findings classified P3-informational. Two of the four findings ("None in this PR" / "TODO rows are correct") required no action; addressing the two with concrete polish suggestions. - P3 helper docstring: `compute_pretrends_power` and `compute_mdv` both accept `violation_type` but don't accept `violation_weights`, so `violation_type="custom"` is unusable from either helper today. Added an explicit Note in the `violation_type` docstring entry of both convenience functions pointing users to instantiate `PreTrendsPower` directly for custom weights, and cross-referencing the TODO row that tracks the helper-extension follow-up. - P3 METHODOLOGY_REVIEW.md "four power calculations" target: now reads "at a pinned revision" with cross-reference to the TODO row that tracks the R-package revision pin. Until that lands, the R-package surface claims in the paper review remain provisional. Pyright diagnostics in pretrends.py (matplotlib import, numpy/list type conflicts, ndarray-to-tuple coercion) are pre-existing in code I did not touch; my edits are docstring-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9185204 commit a6f11d8

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

METHODOLOGY_REVIEW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ and covariate-adjusted specifications.)
10571057

10581058
**Outstanding for promotion:**
10591059
- Dedicated `tests/test_methodology_pretrends.py` with paper-equation-numbered Verified Components walk-through
1060-
- R parity fixture against the `pretrends` R package (the four power calculations: linear, constant, last-period, custom). Note that `compute_pretrends_power` does not accept `violation_weights` today, so `"custom"` parity has to run through `PreTrendsPower(..., violation_weights=...)` directly until the helper is extended (TODO.md tracks the helper-extension follow-up); helper-only parity is limited to `linear` / `constant` / `last_period`.
1060+
- R parity fixture against the `pretrends` R package at a **pinned revision** (TODO.md tracks the revision-pin follow-up; until that lands, the R-package surface claims in `docs/methodology/papers/roth-2022-review.md` are provisional). Covers the four power calculations: linear, constant, last-period, custom. Note that `compute_pretrends_power` does not accept `violation_weights` today, so `"custom"` parity has to run through `PreTrendsPower(..., violation_weights=...)` directly until the helper is extended (TODO.md tracks the helper-extension follow-up); helper-only parity is limited to `linear` / `constant` / `last_period`.
10611061
- Verify the REGISTRY Implementation Checklist (all four items currently unchecked)
10621062

10631063
---

diff_diff/pretrends.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,12 @@ def compute_pretrends_power(
10671067
target_power : float, default=0.80
10681068
Target power for MDV calculation.
10691069
violation_type : str, default='linear'
1070-
Type of violation pattern.
1070+
Type of violation pattern. Note: this convenience helper does NOT
1071+
accept ``violation_weights``, so ``violation_type='custom'`` is
1072+
unusable from the helper (only ``linear`` / ``constant`` /
1073+
``last_period`` are supported here). For custom weights, instantiate
1074+
``PreTrendsPower(..., violation_weights=...)`` directly. Tracked in
1075+
TODO.md as a planned helper extension.
10711076
pre_periods : list of int, optional
10721077
Explicit list of pre-treatment periods. If None, attempts to infer
10731078
from results. Use when you've estimated all periods as post_periods.
@@ -1114,7 +1119,12 @@ def compute_mdv(
11141119
target_power : float, default=0.80
11151120
Target power for MDV calculation.
11161121
violation_type : str, default='linear'
1117-
Type of violation pattern.
1122+
Type of violation pattern. Note: this convenience helper does NOT
1123+
accept ``violation_weights``, so ``violation_type='custom'`` is
1124+
unusable from the helper (only ``linear`` / ``constant`` /
1125+
``last_period`` are supported here). For custom weights, instantiate
1126+
``PreTrendsPower(..., violation_weights=...)`` directly. Tracked in
1127+
TODO.md as a planned helper extension.
11181128
pre_periods : list of int, optional
11191129
Explicit list of pre-treatment periods. If None, attempts to infer
11201130
from results. Use when you've estimated all periods as post_periods.

0 commit comments

Comments
 (0)