Repository navigation
ss: confidence intervals work when a group is constant - #187
Closed
gitRasheed wants to merge 1 commit into
Closed
gitRasheed wants to merge 1 commit into
gitRasheed wants to merge 1 commit into
Conversation
…-group)
Mirrors R NNS.SS (OVVO-Financial/NNS ss-constant-group). With
confidence_interval=True each group is bootstrapped with NNS.meboot, which
cannot rescale a constant series, so nns_ss raised ("function cannot be
evaluated at initial parameters") whenever one group was constant. A
constant group's bootstrap is now the constant itself, repeated reps times.
Non-constant groups use the same seeds and NNS.meboot calls as before.
Before -> after (= R main):
nns_ss(rep(1, 30), rep(c(0, 1), 15), confidence_interval=TRUE)
ValueError -> p_star 0.75 inside [lower, upper]
nns_ss(rep(2, 10), rep(1, 15), confidence_interval=TRUE)
ValueError -> lower = upper = 1
nns_ss(rep(1, 10), rep(1, 15), confidence_interval=TRUE)
ValueError -> lower = upper = 0.5
The invariant test that expected the error now checks the degenerate
interval. No cache entry moves.
Contributor
|
Incorporated through NNS R 14.0 integration #192, merged as |
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.
R's
NNS.SSwithconfidence.interval = TRUEbootstraps each group withNNS.meboot, which cannot rescale a constant series, so it failed whenever one group was constant. OVVO-Financial/NNS#148 (merged) uses the constant itself as that group's bootstrap. This slice mirrors it.Stacked on #186; merge with a merge commit.
Changes
nns_ss(stochastic_superiority.py) tiles a constant grouprepstimes instead of callingnns_meboot. Non-constant groups use the same derived seeds andnns_mebootcalls as before, so their intervals don't change.nns_ss(rep(1, 30), rep(c(0, 1), 15), confidence_interval=TRUE)raised "function cannot be evaluated at initial parameters" and now gives p_star 0.75 inside [lower, upper]. Two constant groups give lower = upper = p_star (1 for 2 vs 1, 0.5 for 1 vs 1).Tests
NNS.mebootwith R's RNG stream; here the existing seeded parity tests cover that and still pass.NNS_DISABLE_NATIVE=1: 2913 passed, 29 skipped, 2 xpassed. The 3 xfails are mode: break tied discrete modes by gravity, not their mean (mirrors R #111) #178's strict ones and the 2 xpasses the existing non-strict live-R VAR xfails. tests/parity/test_practical_examples.py against the usual R library: 9 passed, 2 xfailed, as on mode: break tied discrete modes by gravity, not their mean (mirrors R #111) #178. ruff check is clean on every changed file.Review
GPT-6.1 Sol reviewed the #146, #147 and #148 mirrors together: SHIP.
Mirrors OVVO-Financial/NNS#148