Commit 55d7a27
Fix docs/choosing_estimator.rst HAD snippet (block7) for CI
The HeterogeneousAdoptionDiD example snippet in choosing_estimator.rst
failed the Pure Python Fallback CI job (test_doc_snippets.py
::test_doc_snippet[choosing_estimator:block7]) due to three latent
drift bugs from PR igerber#389 (docs-rtd-audit):
1. Missing aggregate='event_study' on both did_had_pretest_workflow
and HAD.fit calls — default aggregate='overall' requires exactly 2
periods, but the doc-snippet test framework's namespace `data`
(built via generate_staggered_data) has 10 periods.
2. Used the namespace's generic `data` variable, which has nonzero
dose in every period (rng.choice from {0.0, 0.5, 1.0, 2.0}). HAD
requires D=0 for all units in at least one pre-period.
3. `print(f"Estimate: {results.att:.3f}")` formatted att as a scalar,
but under aggregate='event_study' results.att is a numpy array.
Fix: rewrite the snippet to construct its own HAD-shape panel inline
(mirrors how block6 handles ContinuousDiD with its own data
generator); thread aggregate='event_study' through both calls;
iterate the per-horizon att array for output.
Pre-existing on origin/main; surfaced on this PR's CI re-run after
the rebase. Other failing snippets (troubleshooting:block18, :block20,
r_comparison:block6, :block7) are also pre-existing on main but are
out of scope for this PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fc436a5 commit 55d7a27
1 file changed
Lines changed: 25 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
395 | 397 | | |
396 | 398 | | |
397 | | - | |
398 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
399 | 416 | | |
400 | 417 | | |
401 | | - | |
402 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
403 | 421 | | |
404 | | - | |
405 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
406 | 425 | | |
407 | 426 | | |
408 | 427 | | |
| |||
0 commit comments