Skip to content

Commit f381ed5

Browse files
igerberclaude
andcommitted
Address PR #353 CI review round 6 (1 P3)
P3 - stute_joint_pretest docstring drift: The Raises block still listed `G < _MIN_G_STUTE` as a ValueError condition, but R5 converted that branch to a UserWarning + full-NaN StuteJointResult return to match single-horizon stute_test and keep the event-study workflow from crashing on staggered-filtered small panels. Fix: rewrote the Returns and Raises docstring blocks to describe the actual contract. Returns now enumerates the three NaN-result branches (small G, constant dose, any-NaN residuals / fitted) with their warning behavior. Raises is narrowed to the genuinely-raising conditions: empty input, key-mismatch, str-label collision, shape mismatch, negative doses, too-few bootstrap replicates, invalid alpha. Explicitly notes that small-G does NOT raise. No code changes; docstring-only edit. 126 tests still pass; black/ruff/mypy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e3f7450 commit f381ed5

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

diff_diff/had_pretests.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,13 +1961,25 @@ def stute_joint_pretest(
19611961
Returns
19621962
-------
19631963
StuteJointResult
1964+
On the common path, a populated result with bootstrap-based
1965+
``p_value`` and ``cvm_stat_joint``. On the small-sample branch
1966+
(``G < _MIN_G_STUTE``), constant-dose branch
1967+
(``np.ptp(doses) <= 0``), or any-NaN branch in the input
1968+
residuals / fitted arrays, returns an all-NaN result (with
1969+
``reject=False`` and the full ``per_horizon_stats`` dict keyed
1970+
by the validated horizon labels) and emits a ``UserWarning``
1971+
for the first two branches. Mirrors the single-horizon
1972+
:func:`stute_test` contract so event-study workflows on small
1973+
or staggered-filtered panels surface an inconclusive report
1974+
rather than crashing.
19641975
19651976
Raises
19661977
------
19671978
ValueError
1968-
On empty input, key-mismatch, shape-mismatch, ``doses``
1969-
containing negative values, ``G < _MIN_G_STUTE``, or
1970-
``n_bootstrap < _MIN_N_BOOTSTRAP``.
1979+
On empty input, key-mismatch, stringified-label collisions
1980+
between distinct raw keys, shape-mismatch, ``doses`` containing
1981+
negative values, ``n_bootstrap < _MIN_N_BOOTSTRAP``, or invalid
1982+
``alpha``. ``G < _MIN_G_STUTE`` does NOT raise; see Returns.
19711983
"""
19721984
if not isinstance(residuals_by_horizon, dict) or not isinstance(fitted_by_horizon, dict):
19731985
raise ValueError(

0 commit comments

Comments
 (0)