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

Function signedRankInterval

perf/report.mjs:155–172  ·  view source on GitHub ↗
(deltas, confidence = 0.95)

Source from the content-addressed store, hash-verified

153// the smallest exact confidence level at or above the requested one; fewer than six
154// blocks cannot reach 95%, so they get no interval.
155export function signedRankInterval(deltas, confidence = 0.95) {
156 let walsh = deltas.flatMap((a, i) => deltas.slice(i).map(b => (a + b) / 2));
157 let estimate = percentile(walsh, 0.5);
158 walsh.sort((a, b) => a - b);
159 let cdf = signedRankCdf(deltas.length);
160 let trim = 0;
161 while (cdf[trim] <= (1 - confidence) / 2) {
162 trim++;
163 }
164 if (!trim) {
165 return {estimate, interval: null, confidence: null};
166 }
167 return {
168 estimate,
169 interval: [walsh[trim - 1], walsh[walsh.length - trim]],
170 confidence: 1 - 2 * cdf[trim - 1]
171 };
172}
173
174// Probability of at least `observed` successes in `total` trials with success rate p.
175export function binomialTail(observed, total, p) {

Callers 2

report.test.mjsFile · 0.90
compareFunction · 0.85

Calls 4

percentileFunction · 0.85
signedRankCdfFunction · 0.85
sliceMethod · 0.80
sortMethod · 0.65

Tested by

no test coverage detected