Repository navigation
fix(pretrends): seed NIS MVN integration and add tolerance to power_adequate - #921
Open
chenyangsu wants to merge 1 commit into
Open
chenyangsu wants to merge 1 commit into
chenyangsu wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Calling
PreTrendsPower().fit(results)withM=Noneandpretest_form="nis"callsscipy.stats.multivariate_normal.cdfwith unseeded QMC integration, so repeated calls return different MDV/power values (~1e-6 spread) and flippower_adequatebetweenTrueandFalseat the MDV (12/20 True on a 10-period staggered panel).Seeding the CDF call with
np.random.default_rng(0)when SciPy acceptsrngmakes NIS calls deterministic, and using the1e-5absepstolerance (1e-12for Wald) inpower_adequatekeeps at-MDV results consistent, resolving the openTODO.mditem. Happy to treatM=Noneas adequate by construction instead if you prefer.Methodology references (required if estimator / math changes)
TODO.mdActionable Backlogpower_adequatewith its1e-5absepstolerance.Validation
TestNISDeterminismAndPowerAdequateintests/test_pretrends.py(3 of 4 tests fail onmain, all 4 pass here).tests/test_t07_pretrends_power_drift.pypasses (13/13).Security / privacy
Changelog
changelog.d/20261126-pretrends-nis-determinism.mdTesting:
pytest tests/test_pretrends.py tests/test_methodology_pretrends.py tests/test_pretrends_event_study.py tests/test_t07_pretrends_power_drift.py tests/test_design_event_study.py tests/test_changelog_fragments.py(339 passed, 2 deselected);pytest tests/test_base_estimator.py tests/test_diagnostic_report.py(407 passed, 13 skipped);ruff check,black --check, andmypy diff_diffpass with zero errors.