Repository navigation
docs(tutorials): repair and conform the Fundamentals tutorials (01, 02, 03, 08, 09), with drift tests - #911
Conversation
…th outputs and a drift test
…, with a drift test
States and recovers the true effect path, replaces the removed
aggregate('event') and overall_att references, teaches simultaneous bands
instead of pointwise pass/fail pre-tests, and explains why Callaway-Sant'Anna
and Sun-Abraham coincide in this configuration.
…, with a drift test Corrects the time-weights explanation (fit on control units; degenerate on the last pre-period here), uses the shipped diagnostics instead of hand-rolled ones, explains which p-values are count-based, and logs the Frank-Wolfe convergence observations in TODO.md.
…ions, with a drift test Shows both plain DiDs missing the truth while the triple difference recovers it, states the staggered truth and covers it, explains the skipped-cell warning and the two overall summaries, and drops the migration notes.
…ntions, with a drift test Card-Krueger inference is clustered by restaurant (the conclusion about significance changes), the Castle doctrine TWFE vs Callaway-Sant'Anna gap is explained by the baseline period, its pre-treatment estimates are read as a warning, and the divorce panel's skipped cohort is explained. Adds the track's changelog fragment.
02: describe the never-treated and not-yet-treated comparison-group assumptions as Callaway and Sant'Anna (2021) do - what each restricts and when each is suggested - instead of asserting that neither is weaker. 03: state the placebo method's homoskedasticity-across-units assumption (Arkhangelsky et al. 2021, Section 5), especially for a single treated unit; describe the floored placebo p-value as a resolution limit; note that the pre-treatment-fit p-value ranks against only 20 placebo fits and varies with the seed. Seed the drift-test fixture accordingly. Also coalesce adjacent output chunks in the committed notebooks (no change to any output text).
Overall assessment: ✅ Looks goodNo unmitigated P0 or P1 findings identified. Executive summary
Methodology
No additional methodology findings identified within the reviewed changes. Code QualityNo findings. The added tests use public estimator APIs and check both numerical claims and committed notebook text. PerformanceNo findings. Expensive Synthetic DiD placebo tests carry the existing MaintainabilityNo findings. Removing the five convention allowlist entries appropriately prevents regression. Tech Debt
SecurityNo findings in the changed code or notebook content. Documentation/TestsNo additional findings. Static notebook checks, rendered-quote checks, Python syntax checks, and changelog validation passed. Numerical assertions and notebook re-execution remain unverified in this review environment. |
…ead of pinning tutorial 02's headings The search-excerpt smoke test hard-coded four section anchors and one legacy fragment from tutorial 02. Rewording those headings failed the Sphinx job for a reason unrelated to search. - Real pages: every section id in the built tutorials that is not a plain CSS identifier is discovered and checked for a section-scoped excerpt (122 anchors today, up from 4), with a guard that fails if discovery finds none. - Each CSS-special class (apostrophe, parentheses and comma, colon, legacy leading digit) stays covered by a synthetic page, independent of the tutorials' current headings. - The legacy-fragment redirect is exercised on a discovered anchor. - The jsdom CSS.escape stub emits the hex escape for "&": jsdom does not match the equally valid backslash form, which the wider coverage now reaches (four tutorial titles contain "&").
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks goodNo unmitigated P0 or P1 findings identified. The previous assessment stands. Executive summary
MethodologyReviewed DiD/TWFE, Callaway–Sant’Anna, Sun–Abraham, imputation DiD, Synthetic DiD, and triple-difference explanations.
No additional methodology findings. Code QualityNo findings. The search test explicitly fails when anchor discovery returns no cases, and its escape stub passes checks for apostrophes, parentheses, commas, colons, leading digits, and ampersands. PerformanceNo findings. Expensive placebo drift tests retain the MaintainabilityNo findings. Discovering anchors removes dependence on particular tutorial headings; removing the five convention exceptions prevents regression. Tech Debt
SecurityNo findings in the changed scripts, tests, or notebook content. Documentation/TestsNo findings. Convention checks, 76 literal rendered-text checks, nine surface-test methods, notebook-cell Python syntax, JavaScript syntax, and changelog validation passed. Full numerical and browser-behavior validation remains outstanding in this review environment. |
Summary
First of the per-track tutorial repair PRs that follow the tutorial conventions and guard merged in #906. It covers the Fundamentals track:
01_basic_did,02_staggered_did,03_synthetic_did,08_triple_diff,09_real_world_examples.Each notebook now opens with the question it answers and what the reader will learn, states its estimand and identifying assumptions before the first fit, checks estimates against a stated truth where the data is simulated, clusters panel fits at the unit, and is committed with executed outputs (Rust backend) and a drift test that pins the numbers its prose quotes. The five notebooks are removed from the convention guard's
KNOWN_VIOLATIONSallowlist.Corrections of substance:
aggregate("event"), which raises in 4.0, is gone; pre-treatment estimates are read with simultaneous bands instead of pointwise pass/fail; the Callaway-Sant'Anna vs Sun-Abraham "robustness check", which compared two identical numbers, is replaced by an explanation of why they coincide; the comparison-group assumptions are described as the paper states them; the bootstrap section points to the cluster jackknife for few clusters.One library observation found on the way is logged in
TODO.md(Synthetic DiD Frank-Wolfe convergence on an ordinary panel).Methodology references (required if estimator / math changes)
Validation
tests/test_t01_basic_did_drift.py,tests/test_t02_staggered_did_drift.py,tests/test_t03_synthetic_did_drift.py,tests/test_t08_triple_diff_drift.py,tests/test_t09_real_world_examples_drift.py(new);tests/test_tutorial_conventions.py(five allowlist entries removed).mainwith outputs identical to the committed ones. The drift tests pass on both backends, including the slow placebo tests.pytest --nbmakepasses for all five on the pure-Python backend, mirroring CI. The Card-Krueger and Castle doctrine pins skip when the loaders return their synthetic fallback.Security / privacy
Changelog