Skip to content

Hold the odds calculator's error bar to the width it claims - #146

Merged
will-lamerton merged 4 commits into
mainfrom
guard-the-odds-band
Sep 15, 2026
Merged

will-lamerton merged 4 commits into
mainfrom
guard-the-odds-band

Conversation

@pip-robot

@pip-robot pip-robot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

The calculator prints a 95% band on every sampled answer. Until now the tests only asked whether the answer landed inside that band. A band twice as wide as it should be passes that check and every check like it, while telling the reader the calculator is half as good as it is.

tests/oddsQuote.test.ts now measures the estimator's spread across 60 fixed seeds at 1,500 iterations and compares it to the standard error the printed band claims. 90,000 showdowns, 6.8s, deterministic.

scripts/odds-band-coverage.ts (pnpm odds-band-coverage) is the full sweep: 100 runs at each of 1,500, 5,000 and 20,000 against an enumerated ground truth. It stays a script rather than a test because 100 runs puts a +/-4.3 point band on a coverage rate, so an assertion on the rate either flakes or passes with a badly broken band.

What the gate covered. pnpm test:all green, 682 tests. Three mutants killed: band doubled (caught, 0.56x), band halved (caught, 2.23x), and estimateEquity silently doing a quarter of the showdowns it reports while the band stays correct (caught at 2.24x, and this is the only one the existing width tests miss).

What it did not cover. No UI. Nothing on /poker-odds-calculator changed.

A measurement, for the record. Running the sweep found no defect: the ratio of measured spread to claimed standard error is 1.03 at 500 iterations, 1.11 at 1,500, 1.05 at 5,000 and 0.92 at 20,000, all inside the +/-9% precision 60 seeds buy. Bias against the enumerated truth is at most 0.12 points at every size. The band is the right width.

pip-robot Bot added 2 commits September 14, 2026 13:36
The containment check only asks whether the sampled answer lands inside the band. A band twice as wide as it should be passes that and every check like it, while telling the reader the calculator is half as good as it is.

24 seeded runs at 1,500 iterations, spread measured against the standard error the printed band claims. 36,000 showdowns, 4.5s, deterministic.

scripts/odds-band-coverage.ts is the full sweep behind the published coverage table: 100 runs at each of 1,500, 5,000 and 20,000 against an enumerated ground truth.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 14, 2026

Copy link
Copy Markdown

Deploying pip-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8545026
Status: ✅  Deploy successful!
Preview URL: https://8d255736.pip-web-9oj.pages.dev
Branch Preview URL: https://guard-the-odds-band.pip-web-9oj.pages.dev

View logs

pip-robot Bot added 2 commits September 15, 2026 12:19
The comment justifying the 0.7 and 1.4 bounds said all four measured ratios were inside the +/-9% that 60 seeds buy. 1.11 is not: 1/sqrt(2(n-1)) is 9.2% and that is one standard error, so 1.11 is 1.2 of them out. The 95% interval is 0.82 to 1.18, which every row is inside, so the conclusion holds and the sentence did not.
@pip-robot

pip-robot Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Ready. Gate green on 0efc5c7.

One commit added since the first review: the comment justifying the 0.7 and 1.4 bounds said all four measured ratios were inside the ±9% that 60 seeds buy. 1.11 is not. 1/sqrt(2(n-1)) is 9.2% and that is one standard error on a standard deviation, not an interval, so the right sentence is the 95% interval, 0.82 to 1.18, which every row is inside. Bounds unchanged, conclusion unchanged.

The gate covers the new test and the script's types. It does not cover anything on a page: no component, route or string changed.

@will-lamerton

@will-lamerton
will-lamerton merged commit 7c6347c into main Sep 15, 2026
2 checks passed
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