Commit 8838303
Address thirty-seventh round of CI review findings on PR #318
P1 methodology (StaggeredTripleDiff never_treated surfaced
composite total as control). ``_extract_sample`` swapped to
``n_never_enabled`` only inside the dynamic ``notyettreated``
branch; under ``control_group="never_treated"`` it left
``n_control = n_control_units``. But
``staggered_triple_diff.py:384`` and REGISTRY.md §StaggeredTriple-
Difference (line 1730) define ``n_control_units`` as a composite
total that also includes eligibility-denied / larger-cohort
cells — the valid fixed comparison is only the never-enabled
cohort. BR's schema / ``summary()`` / ``full_report()`` therefore
misrepresented the comparison count on the ``nevertreated`` path.
Added a dedicated branch that fires whenever the canonical
control is ``nevertreated`` on ``StaggeredTripleDiffResults`` and
surfaces ``n_never_enabled`` as the fixed comparison tally
(``n_control`` set to None), regardless of whether the
``is_dynamic_control`` branch runs.
P1 code quality (broken CI clause on undefined inference).
``_render_headline_sentence`` gated CI rendering on
``isinstance(lo, (int, float))`` — which accepts ``NaN`` because
``NaN`` is a float — so a fit with a finite point estimate but
undefined CI endpoints (survey-df collapse, zero effective
clusters, ...) rendered
``(... 95% CI: undefined to undefined)`` in both ``summary()`` and
``full_report()``. DR's own headline renderer already gated on
``np.isfinite`` (round-36 fix); BR now mirrors that:
* both CI bounds finite -> usual ``(ci_level% CI: lo to hi)``;
* at least one bound supplied but not finite -> explicit
``(inference unavailable: confidence interval is undefined for
this fit)`` trailer;
* bounds absent -> no trailer.
Tests: 5 new regressions across two classes.
* ``TestStaggeredTripleDiffNeverTreatedFixedComparison``
(2 tests): schema-level ``n_control is None`` /
``n_never_enabled == 300`` on the ``never_treated`` mode, plus
a prose assertion that the composite 500 does not appear as
"500 control" in ``summary()``;
* ``TestBRHeadlineOmitsBrokenCIOnUndefinedInference`` (2 tests):
NaN-CI stub renders ``summary()`` and ``full_report()``
without "undefined to undefined" / "CI: nan" fragments and
with explicit "inference unavailable" language.
278 BR / DR / practitioner tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6b251af commit 8838303
2 files changed
Lines changed: 145 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
571 | 585 | | |
572 | 586 | | |
573 | 587 | | |
| |||
1661 | 1675 | | |
1662 | 1676 | | |
1663 | 1677 | | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1664 | 1686 | | |
1665 | | - | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
1666 | 1694 | | |
1667 | 1695 | | |
1668 | 1696 | | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1669 | 1703 | | |
1670 | 1704 | | |
1671 | 1705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
1291 | 1401 | | |
1292 | 1402 | | |
1293 | 1403 | | |
| |||
0 commit comments