Skip to content

feat(statistics): predictionInterval, the interval of one new value (0.2.35) - #366

Merged
mark1russell7 merged 1 commit into
mainfrom
feat/prediction-interval
Nov 29, 2026
Merged

mark1russell7 merged 1 commit into
mainfrom
feat/prediction-interval

Conversation

@mark1russell7

Copy link
Copy Markdown
Owner

Summary

  • The new function predictionInterval(values, level) gives the distribution-free interval of one new value: x_(k) to x_(n + 1 - k), with the coverage (n + 1 - 2k) / (n + 1). It needs exchangeable values and no assumption about the shape. A small sample gives the full range, with a coverage less than the level, as medianInterval does.
  • Why: a check of a new measure against the interval of the median fails more often as the data grows, because that interval becomes narrow. With 22 held-out speed measures of a local model, a check on the interval of the median agreed for 6. A check on this interval agreed for 17, against an expected coverage of about 0.88.
  • Version 0.2.35, PATCH: a new export before 1.0.0.

Test plan

  • vitest run src/discrete.test.ts: 58 passed. The tests cover the exact ranks for 39 and 79 values, small samples, the width at n = 4000 against medianInterval, the coverage of 4000 seeded trials within 0.02 of 0.9, and the refusals.
  • typecheck, build, api-report update, ste-lint

🤖 Generated with Claude Code

…of one new value (0.2.35)

x_(k) to x_(n + 1 - k) holds one new exchangeable value with the chance
(n + 1 - 2k) / (n + 1). The interval of the median becomes narrow as n
grows, so a check of a new measure against it fails more often with more
data. This interval keeps the spread of the population.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mark1russell7
mark1russell7 merged commit 24aa5fd into main Nov 29, 2026
21 checks passed
@mark1russell7
mark1russell7 deleted the feat/prediction-interval branch November 29, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant