Commit 959f84e
Address third round of CI review findings on PR #318
P0 fix:
* **Alpha override was inference-contract-blind.** Previously, whenever
the caller's ``alpha`` differed from the result's, BR recomputed the
displayed CI via ``safe_inference(att, se, alpha=alpha)`` with no
``df`` and no bootstrap handling — silently discarding the
``bootstrap_distribution`` / finite-df inference contracts used by
TROP, ContinuousDiD, dCDH-bootstrap, survey fits, SDiD jackknife,
etc. BR now detects bootstrap-backed (``inference_method='bootstrap'``
or non-None ``bootstrap_distribution`` or ``variance_method in
{bootstrap, jackknife, placebo}``) and finite-df (``df_survey > 0``)
inference paths and preserves the fitted CI at its native level in
those cases, recording an informational caveat noting that the
caller's alpha still drives phrasing but the native interval is
shown. Regressions in ``TestAlphaOverrideBootstrapAndFiniteDF``
cover both the bootstrap and finite-df survey paths.
P1 fixes:
* **``pretrends_power`` over-broad applicability.** The matrix had
marked the check applicable for ImputationDiD, TwoStage, Stacked,
EfficientDiD, StaggeredTripleDiff, Wooldridge, and dCDH, but
``compute_pretrends_power`` only has adapters for MultiPeriod, CS,
and SA; the other families were landing in ``error``. Narrowed the
applicability matrix to match the real helper support.
* **``sensitivity`` over-broad applicability.** HonestDiD only adapts
MultiPeriod, CS, and dCDH (via ``placebo_event_study``). The matrix
had also included SA / Imputation / Stacked / EfficientDiD /
StaggeredTripleDiff / Wooldridge. Narrowed to the supported set. The
dCDH-specific instance gate now checks ``placebo_event_study`` rather
than the generic ``event_study_effects`` so HonestDiD's dCDH branch
is reached instead of the generic event-study collector.
* **``n_obs == 0`` reference-marker filter.** Stacked / TwoStage /
Imputation emit synthetic reference-period markers using ``n_obs=0``
rather than CS / SA's ``n_groups=0`` flag. ``_collect_pre_period_coefs``
now drops rows with either sentinel so the Bonferroni denominator
and joint-Wald index are not inflated by non-informative rows.
P2 fix:
* **``placebo`` schema inconsistency.** ``REPORTING.md`` said
``placebo`` is always rendered as ``{"status": "skipped"}`` in MVP,
but no result type had ``placebo`` in its applicability frozenset, so
implementation fell through to ``"not_applicable"``. Now every
DiagnosticReport.to_dict() returns ``placebo`` with ``status="skipped"``
regardless of estimator, matching the stated contract.
Regression tests for each finding added in
``TestNarrowedApplicabilityAndPlaceboSchema`` and
``TestAlphaOverrideBootstrapAndFiniteDF``. 146 targeted tests pass;
black, ruff, mypy clean on the new modules.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 989f71a commit 959f84e
4 files changed
Lines changed: 275 additions & 45 deletions
File tree
- diff_diff
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
341 | 352 | | |
342 | 353 | | |
343 | 354 | | |
| |||
346 | 357 | | |
347 | 358 | | |
348 | 359 | | |
349 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
350 | 388 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
356 | 394 | | |
357 | 395 | | |
358 | 396 | | |
| |||
382 | 420 | | |
383 | 421 | | |
384 | 422 | | |
| 423 | + | |
| 424 | + | |
385 | 425 | | |
386 | 426 | | |
387 | 427 | | |
| |||
623 | 663 | | |
624 | 664 | | |
625 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
626 | 677 | | |
627 | 678 | | |
628 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
92 | | - | |
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
| |||
98 | 109 | | |
99 | 110 | | |
100 | 111 | | |
101 | | - | |
102 | | - | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
| |||
108 | 117 | | |
109 | 118 | | |
110 | 119 | | |
111 | | - | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
| |||
117 | 125 | | |
118 | 126 | | |
119 | 127 | | |
120 | | - | |
121 | | - | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | | - | |
143 | | - | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
152 | | - | |
153 | | - | |
154 | | - | |
| 156 | + | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
158 | | - | |
159 | | - | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
| |||
432 | 431 | | |
433 | 432 | | |
434 | 433 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
| |||
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
507 | 519 | | |
508 | 520 | | |
509 | 521 | | |
| |||
1728 | 1740 | | |
1729 | 1741 | | |
1730 | 1742 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
1737 | 1751 | | |
1738 | 1752 | | |
1739 | 1753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
523 | 609 | | |
524 | 610 | | |
525 | 611 | | |
| |||
0 commit comments