Add LPDiD R-parity validation harness (Dube et al. 2025), Phase B2#583
Merged
Conversation
…e B2 Pin the absorbing LPDiD estimator against the method authors' own R recipes (danielegirardi/lpdid) with an alexCardazzi/lpdid cross-check gate: - benchmarks/R/generate_lpdid_golden.R: in-R panel (+ interior-gap unit) and 6 variants (variance-weighted, reweight, pmd, direct-covariate, pooled, RA-point); writes committed lpdid_test_panel.csv + lpdid_golden.json. - tests/test_methodology_lpdid.py: skip-guarded parity (att/se to ~1e-12, cross-platform asserted at 1e-6/1e-7). - benchmarks/python/coverage_lpdid_ra.py + lpdid_ra_coverage.json: ungated Monte-Carlo study validating the RA influence-function SE calibration (~0.95). Resolves the two provisional REGISTRY deviation notes in the library's favour with no estimator change: the RA SE matches the Stata teffects convention (point-anchored, SE pinned + coverage-validated; no R-package analogue), and the pooled estimand matches the authors' fixed-composition recipe (correcting the prior "horizon-stacked" wording). no_composition documented as more paper-faithful than the R packages (B1-tested). Ticks the REGISTRY B2 checklist box. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Overall Assessment✅ Looks good — no unmitigated P0/P1 findings. Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation / Tests
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase B2 of the LPDiD initiative: a self-generated R-parity validation harness for the
absorbing
LPDiDestimator (shipped in 3.6.0). No estimator code changes — averify-and-document PR.
benchmarks/R/generate_lpdid_golden.R— in-R panel (staggered absorbing, ~63% never-treated,heterogeneous, + an interior-gap unit) and 6 golden variants computed from the method authors'
own R recipes (
danielegirardi/lpdidevent-study / reweight / premean / pooledfixest::feolsspecifications), with an
alexCardazzi/lpdidcross-check gate (pinned commitba64563,fail-closed). Writes committed
lpdid_test_panel.csv+lpdid_golden.json.tests/test_methodology_lpdid.py— skip-guarded parity (matching thedidimputationprecedent):variance-weighted / reweight / pmd / direct-covariate / pooled / RA-point match to ~1e-12
(asserted at 1e-6/1e-7 for cross-platform robustness, green on both Python and Rust backends);
RA influence-function SE pinned (event-study + headline pooled).
benchmarks/python/coverage_lpdid_ra.py+lpdid_ra_coverage.json— ungated Monte-Carlocoverage study (mirrors
coverage_sdid.py) validating the RA SE: ≈0.95 empirical coverage ofboth the event-study horizons and the headline pooled-row RA CI across cluster counts
G ∈ {30, 100, 300}.
fixed-composition estimand) in the library's favour; documents
no_compositionas morepaper-faithful than the R packages (Prepare v0.2.0 release #7); ticks the REGISTRY B2 checklist box.
Methodology references
40(5):741-758, https://doi.org/10.1002/jae.70000. Reference software: the authors'
danielegirardi/lpdid(R + Stata) and the third-partyalexCardazzi/lpdid(pinnedba64563).docs/methodology/REGISTRY.md## LPDiD):carries no finite-sample factor — matching the authors' canonical Stata
teffects ra ... atet vce(cluster)convention (their.dodof comments). No R packagecomputes this SE, so the RA point is R-anchored (~1e-12) and the SE is pinned +
Monte-Carlo-coverage-validated; a tracked
TODO.mdfollow-up is to contribute a runnable R RAreference (only trusted once cross-checked vs Stata
teffects).authors' R pooled recipe to ~1e-13 (corrects the prior "horizon-stacked" wording).
alexCardazzi's pooled uses a laxer clean-control window (recorded inmeta, not gated).packages (fixes the realized sample across all post horizons) → no exact R anchor; validated
by the pure-Python B1 tests in
tests/test_lpdid.py.Validation
tests/test_methodology_lpdid.py(8 tests; skip-guarded R-parity, green onPython + Rust backends). Regenerate goldens via
Rscript benchmarks/R/generate_lpdid_golden.R.benchmarks/python/coverage_lpdid_ra.py→benchmarks/data/lpdid_ra_coverage.json(RA SE empirical coverage ≈0.95).Security / privacy
Generated with Claude Code