MCPcopy Create free account
hub / github.com/adobe/react-spectrum / binomialTail

Function binomialTail

perf/report.mjs:175–185  ·  view source on GitHub ↗
(observed, total, p)

Source from the content-addressed store, hash-verified

173
174// Probability of at least `observed` successes in `total` trials with success rate p.
175export function binomialTail(observed, total, p) {
176 let probability = (1 - p) ** total;
177 let tail = 0;
178 for (let k = 0; k <= total; k++) {
179 if (k >= observed) {
180 tail += probability;
181 }
182 probability *= ((total - k) / (k + 1)) * (p / (1 - p));
183 }
184 return Math.min(1, tail);
185}
186
187export function compare(samples, metric, options = {}) {
188 if (!samples.length) {

Callers 2

validateFunction · 0.90
report.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected