@mark1russell7/layout-contract 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +6 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +52 -261
- package/build/index.js.map +1 -1
- package/package.json +4 -3
- package/src/hash.ts +7 -68
- package/src/random.ts +4 -7
- package/src/verdict.ts +26 -72
- package/src/utf8.ts +0 -51
package/build/index.d.ts
CHANGED
|
@@ -447,8 +447,8 @@ export interface StrategyInfo<O = unknown, S extends Supports = Supports> {
|
|
|
447
447
|
*/
|
|
448
448
|
export declare function mulberry32(seed: number): () => number;
|
|
449
449
|
/**
|
|
450
|
-
* This function gives the FNV-1a hash of 32 bits of the UTF-8 bytes of a string.
|
|
451
|
-
*
|
|
450
|
+
* This function gives the FNV-1a hash of 32 bits of the UTF-8 bytes of a string. A lone surrogate gives the 3 bytes of its code.
|
|
451
|
+
* Its home is `fnv1a32` of `@mark1russell7/rigor-generators`, with the option `input: "wtf8"`. This function keeps the name and the signature of the API.
|
|
452
452
|
*/
|
|
453
453
|
export declare function fnv1a32(text: string): number;
|
|
454
454
|
/** This function gives the generator of one step of a seeded generator: `mulberry32(fnv1a32("<seed>:<step>"))`. */
|
|
@@ -503,13 +503,15 @@ export declare function edgeStep(input: LayoutInput, params: EdgeStepParams, see
|
|
|
503
503
|
*/
|
|
504
504
|
export declare function edgeKeyStep(input: LayoutInput, params: EdgeKeyParams, seed?: number): LayoutInput;
|
|
505
505
|
/**
|
|
506
|
-
* This function gives the SHA-256 digest of the
|
|
507
|
-
*
|
|
506
|
+
* This function gives the SHA-256 digest of the bytes of a string, as 64 lowercase hex characters. A lone surrogate gives the 3 bytes of its code.
|
|
507
|
+
* Its home is `sha256Hex` of `@mark1russell7/rigor-generators`, with the option `input: "wtf8"`. This function keeps the name and the signature of the API.
|
|
508
508
|
*/
|
|
509
509
|
export declare function sha256Hex(text: string): string;
|
|
510
510
|
/**
|
|
511
511
|
* This function gives the canonical form of a value: sorted keys and no whitespace, with the numbers of `JSON.stringify`.
|
|
512
512
|
* A key with the value `undefined` is not in the form. An `undefined` in an array becomes `null`.
|
|
513
|
+
* Its home is `canonicalJson` of `@mark1russell7/rigor-generators`, with the option `form: "json"`.
|
|
514
|
+
* So a value with a method `toJSON`, for example a `Date`, gives the form of the result of that method. A function, a symbol and a cycle cause a `TypeError`.
|
|
513
515
|
*/
|
|
514
516
|
export declare function canonicalJson(value: unknown): string;
|
|
515
517
|
/** The options of `outputHash` and `documentHash`. */
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId;WACN,qBAAqB;;WAErB;;WAEA;aAAiB;aAAoB;;;WAErC;aAA2B;aAAqB;aAAoB;;WACpE,iBAAiB;;;;;;;wBAQZ,UAAU,OAAO,aAAa,QAAQ,aAAa;;YC/BvD;;iBAGK;WACN;WACA,OAAO;WACP;WACA;;WAEA,SAAS,SAAS;WAClB;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA,kBAAkB;;WAElB,UAAU,SAAS;;WAEnB,MAAM,SAAS;;WAEf,YAAY,SAAS,QAAQ;;WAE7B;;;;;;;WAOA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA,MAAM;;WAEN;WACA;;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AAO,aAAa,QAAQ,YAAY,oBAA+C,UAAS,gBAAqB;;;;;;;wBAmC9H,WAAW,OAAO;;wBC3lBlB,SAAS,MAAM,OAAO;;wBAKtB,UAAU,WAAW,WAAW;;;;;;wBAShC,SAAS,MAAM,MAAM,YAAY;;wBAajC,WAAW,QAAQ,SAAS;;wBAO5B,WAAW,QAAQ,QAAQ,YAAY;;wBAkBvC,QAAQ,KAAK,YAAY;;iBC1DxB,kBAAkB;WACxB;;;iBAIM;;WAEN;;WAEA;;WAEA,MAAM,SAAS,OAAO;;WAEtB;;;qBAIE;;YAGD;;qBAYC,mCAAmC;;;;;;wBA+BhC,YAAY,gBAAgB;;;;;;wBA2B5B,UAAU,gBAAgB,QAAQ,WAAW,OAAO;;iBAoDnD;;WAEN;;WAEA;;;;;;;wBAQK,aAAa,eAAe,aAAa,eAAe,aAAa,SAAS;;;;;wBAwC9E,UAAU,cAAc,iBAAiB;;wBAOzC,gBAAgB,kBAAkB,OAAO,GAAG,SAAS,UAAU,UAAU,KAAK;;;;;wBAc9E,oBAAoB,kBAAkB,OAAO,aAAa,eAAe,KAAK;;;;;iBCtN7E,aAAa,aAAa,UAAU,WAAW;;WAErD;;WAEA;;WAEA;;WAEA,UAAU;;WAEV,UAAU;;WAEV;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId;WACN,qBAAqB;;WAErB;;WAEA;aAAiB;aAAo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1
|
+
import { canonicalJson as canonicalJson$1, deriveSeed, fnv1a32 as fnv1a32$1, mulberry32 as mulberry32$1, sha256Hex as sha256Hex$1 } from "@mark1russell7/rigor-generators";
|
|
2
|
+
import { bootstrap, bootstrapStrata, signFlipTest, signTest } from "@mark1russell7/rigor-statistics";
|
|
2
3
|
// src/geometry.ts
|
|
3
4
|
/** The sides in clockwise order, from the top. */
|
|
4
5
|
const SIDES = [
|
|
@@ -1929,57 +1930,6 @@ function balanceMeasureSpecs(stage) {
|
|
|
1929
1930
|
}
|
|
1930
1931
|
]);
|
|
1931
1932
|
}
|
|
1932
|
-
// src/utf8.ts
|
|
1933
|
-
/**
|
|
1934
|
-
* This function writes the UTF-8 bytes of a string into `out`, from the index `at`, and gives the index after the last byte.
|
|
1935
|
-
* With no `out`, it writes nothing and gives the count of the bytes. A lone surrogate gives the 3 bytes of its code.
|
|
1936
|
-
* It reads the UTF-16 code units, so it makes no string for each character (L81: `sha256Hex` allocated 2 GB in one pair).
|
|
1937
|
-
*/
|
|
1938
|
-
function utf8Write(text, out, at = 0) {
|
|
1939
|
-
let n = at;
|
|
1940
|
-
for (let i = 0; i < text.length; i++) {
|
|
1941
|
-
let c = text.charCodeAt(i);
|
|
1942
|
-
if (c >= 55296 && c < 56320 && i + 1 < text.length) {
|
|
1943
|
-
const low = text.charCodeAt(i + 1);
|
|
1944
|
-
if (low >= 56320 && low < 57344) {
|
|
1945
|
-
c = 65536 + (c - 55296 << 10) + (low - 56320);
|
|
1946
|
-
i++;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
if (c < 128) {
|
|
1950
|
-
if (out !== void 0) out[n] = c;
|
|
1951
|
-
n += 1;
|
|
1952
|
-
} else if (c < 2048) {
|
|
1953
|
-
if (out !== void 0) {
|
|
1954
|
-
out[n] = 192 | c >> 6;
|
|
1955
|
-
out[n + 1] = 128 | c & 63;
|
|
1956
|
-
}
|
|
1957
|
-
n += 2;
|
|
1958
|
-
} else if (c < 65536) {
|
|
1959
|
-
if (out !== void 0) {
|
|
1960
|
-
out[n] = 224 | c >> 12;
|
|
1961
|
-
out[n + 1] = 128 | c >> 6 & 63;
|
|
1962
|
-
out[n + 2] = 128 | c & 63;
|
|
1963
|
-
}
|
|
1964
|
-
n += 3;
|
|
1965
|
-
} else {
|
|
1966
|
-
if (out !== void 0) {
|
|
1967
|
-
out[n] = 240 | c >> 18;
|
|
1968
|
-
out[n + 1] = 128 | c >> 12 & 63;
|
|
1969
|
-
out[n + 2] = 128 | c >> 6 & 63;
|
|
1970
|
-
out[n + 3] = 128 | c & 63;
|
|
1971
|
-
}
|
|
1972
|
-
n += 4;
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
return n;
|
|
1976
|
-
}
|
|
1977
|
-
/** This function gives the UTF-8 bytes of a string. It does not use `TextEncoder`, because `TextEncoder` encodes a lone surrogate as U+FFFD. */
|
|
1978
|
-
function utf8(text) {
|
|
1979
|
-
const bytes = new Uint8Array(utf8Write(text));
|
|
1980
|
-
utf8Write(text, bytes);
|
|
1981
|
-
return bytes;
|
|
1982
|
-
}
|
|
1983
1933
|
// src/random.ts
|
|
1984
1934
|
/**
|
|
1985
1935
|
* This function gives a generator of random numbers in [0, 1). It is `mulberry32`, as in `docs/FORMAT.md` of `packing`.
|
|
@@ -1989,13 +1939,11 @@ function mulberry32(seed) {
|
|
|
1989
1939
|
return mulberry32$1(seed);
|
|
1990
1940
|
}
|
|
1991
1941
|
/**
|
|
1992
|
-
* This function gives the FNV-1a hash of 32 bits of the UTF-8 bytes of a string.
|
|
1993
|
-
*
|
|
1942
|
+
* This function gives the FNV-1a hash of 32 bits of the UTF-8 bytes of a string. A lone surrogate gives the 3 bytes of its code.
|
|
1943
|
+
* Its home is `fnv1a32` of `@mark1russell7/rigor-generators`, with the option `input: "wtf8"`. This function keeps the name and the signature of the API.
|
|
1994
1944
|
*/
|
|
1995
1945
|
function fnv1a32(text) {
|
|
1996
|
-
|
|
1997
|
-
for (const b of utf8(text)) h = Math.imul(h ^ b, 16777619) >>> 0;
|
|
1998
|
-
return h;
|
|
1946
|
+
return fnv1a32$1(text, { input: "wtf8" });
|
|
1999
1947
|
}
|
|
2000
1948
|
/** This function gives the generator of one step of a seeded generator: `mulberry32(fnv1a32("<seed>:<step>"))`. */
|
|
2001
1949
|
function stepRandom(seed, step) {
|
|
@@ -2262,143 +2210,21 @@ function edgeKeyStep(input, params, seed = input.seed ?? 0) {
|
|
|
2262
2210
|
};
|
|
2263
2211
|
}
|
|
2264
2212
|
// src/hash.ts
|
|
2265
|
-
/** The round constants of SHA-256. */
|
|
2266
|
-
const K = [
|
|
2267
|
-
1116352408,
|
|
2268
|
-
1899447441,
|
|
2269
|
-
3049323471,
|
|
2270
|
-
3921009573,
|
|
2271
|
-
961987163,
|
|
2272
|
-
1508970993,
|
|
2273
|
-
2453635748,
|
|
2274
|
-
2870763221,
|
|
2275
|
-
3624381080,
|
|
2276
|
-
310598401,
|
|
2277
|
-
607225278,
|
|
2278
|
-
1426881987,
|
|
2279
|
-
1925078388,
|
|
2280
|
-
2162078206,
|
|
2281
|
-
2614888103,
|
|
2282
|
-
3248222580,
|
|
2283
|
-
3835390401,
|
|
2284
|
-
4022224774,
|
|
2285
|
-
264347078,
|
|
2286
|
-
604807628,
|
|
2287
|
-
770255983,
|
|
2288
|
-
1249150122,
|
|
2289
|
-
1555081692,
|
|
2290
|
-
1996064986,
|
|
2291
|
-
2554220882,
|
|
2292
|
-
2821834349,
|
|
2293
|
-
2952996808,
|
|
2294
|
-
3210313671,
|
|
2295
|
-
3336571891,
|
|
2296
|
-
3584528711,
|
|
2297
|
-
113926993,
|
|
2298
|
-
338241895,
|
|
2299
|
-
666307205,
|
|
2300
|
-
773529912,
|
|
2301
|
-
1294757372,
|
|
2302
|
-
1396182291,
|
|
2303
|
-
1695183700,
|
|
2304
|
-
1986661051,
|
|
2305
|
-
2177026350,
|
|
2306
|
-
2456956037,
|
|
2307
|
-
2730485921,
|
|
2308
|
-
2820302411,
|
|
2309
|
-
3259730800,
|
|
2310
|
-
3345764771,
|
|
2311
|
-
3516065817,
|
|
2312
|
-
3600352804,
|
|
2313
|
-
4094571909,
|
|
2314
|
-
275423344,
|
|
2315
|
-
430227734,
|
|
2316
|
-
506948616,
|
|
2317
|
-
659060556,
|
|
2318
|
-
883997877,
|
|
2319
|
-
958139571,
|
|
2320
|
-
1322822218,
|
|
2321
|
-
1537002063,
|
|
2322
|
-
1747873779,
|
|
2323
|
-
1955562222,
|
|
2324
|
-
2024104815,
|
|
2325
|
-
2227730452,
|
|
2326
|
-
2361852424,
|
|
2327
|
-
2428436474,
|
|
2328
|
-
2756734187,
|
|
2329
|
-
3204031479,
|
|
2330
|
-
3329325298
|
|
2331
|
-
];
|
|
2332
2213
|
/**
|
|
2333
|
-
* This function gives the SHA-256 digest of the
|
|
2334
|
-
*
|
|
2214
|
+
* This function gives the SHA-256 digest of the bytes of a string, as 64 lowercase hex characters. A lone surrogate gives the 3 bytes of its code.
|
|
2215
|
+
* Its home is `sha256Hex` of `@mark1russell7/rigor-generators`, with the option `input: "wtf8"`. This function keeps the name and the signature of the API.
|
|
2335
2216
|
*/
|
|
2336
2217
|
function sha256Hex(text) {
|
|
2337
|
-
|
|
2338
|
-
const bits = length * 8;
|
|
2339
|
-
const total = Math.ceil((length + 9) / 64) * 64;
|
|
2340
|
-
const data = new Uint8Array(total);
|
|
2341
|
-
utf8Write(text, data);
|
|
2342
|
-
data[length] = 128;
|
|
2343
|
-
const view = new DataView(data.buffer);
|
|
2344
|
-
view.setUint32(total - 8, Math.floor(bits / 4294967296));
|
|
2345
|
-
view.setUint32(total - 4, bits >>> 0);
|
|
2346
|
-
const h = [
|
|
2347
|
-
1779033703,
|
|
2348
|
-
3144134277,
|
|
2349
|
-
1013904242,
|
|
2350
|
-
2773480762,
|
|
2351
|
-
1359893119,
|
|
2352
|
-
2600822924,
|
|
2353
|
-
528734635,
|
|
2354
|
-
1541459225
|
|
2355
|
-
];
|
|
2356
|
-
const w = /* @__PURE__ */ new Uint32Array(64);
|
|
2357
|
-
const rotr = (x, n) => x >>> n | x << 32 - n;
|
|
2358
|
-
for (let off = 0; off < total; off += 64) {
|
|
2359
|
-
for (let i = 0; i < 16; i++) w[i] = view.getUint32(off + 4 * i);
|
|
2360
|
-
for (let i = 16; i < 64; i++) {
|
|
2361
|
-
const a = w[i - 15];
|
|
2362
|
-
const b = w[i - 2];
|
|
2363
|
-
const s0 = rotr(a, 7) ^ rotr(a, 18) ^ a >>> 3;
|
|
2364
|
-
const s1 = rotr(b, 17) ^ rotr(b, 19) ^ b >>> 10;
|
|
2365
|
-
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
2366
|
-
}
|
|
2367
|
-
let [a, b, c, d, e, f, g, k] = h;
|
|
2368
|
-
for (let i = 0; i < 64; i++) {
|
|
2369
|
-
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
2370
|
-
const ch = e & f ^ ~e & g;
|
|
2371
|
-
const t1 = k + s1 + ch + K[i] + w[i] >>> 0;
|
|
2372
|
-
const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
|
|
2373
|
-
k = g;
|
|
2374
|
-
g = f;
|
|
2375
|
-
f = e;
|
|
2376
|
-
e = d + t1 >>> 0;
|
|
2377
|
-
d = c;
|
|
2378
|
-
c = b;
|
|
2379
|
-
b = a;
|
|
2380
|
-
a = t1 + t2 >>> 0;
|
|
2381
|
-
}
|
|
2382
|
-
h[0] = h[0] + a >>> 0;
|
|
2383
|
-
h[1] = h[1] + b >>> 0;
|
|
2384
|
-
h[2] = h[2] + c >>> 0;
|
|
2385
|
-
h[3] = h[3] + d >>> 0;
|
|
2386
|
-
h[4] = h[4] + e >>> 0;
|
|
2387
|
-
h[5] = h[5] + f >>> 0;
|
|
2388
|
-
h[6] = h[6] + g >>> 0;
|
|
2389
|
-
h[7] = h[7] + k >>> 0;
|
|
2390
|
-
}
|
|
2391
|
-
return h.map((x) => x.toString(16).padStart(8, "0")).join("");
|
|
2218
|
+
return sha256Hex$1(text, { input: "wtf8" });
|
|
2392
2219
|
}
|
|
2393
2220
|
/**
|
|
2394
2221
|
* This function gives the canonical form of a value: sorted keys and no whitespace, with the numbers of `JSON.stringify`.
|
|
2395
2222
|
* A key with the value `undefined` is not in the form. An `undefined` in an array becomes `null`.
|
|
2223
|
+
* Its home is `canonicalJson` of `@mark1russell7/rigor-generators`, with the option `form: "json"`.
|
|
2224
|
+
* So a value with a method `toJSON`, for example a `Date`, gives the form of the result of that method. A function, a symbol and a cycle cause a `TypeError`.
|
|
2396
2225
|
*/
|
|
2397
2226
|
function canonicalJson(value) {
|
|
2398
|
-
|
|
2399
|
-
if (Array.isArray(value)) return `[${value.map((v) => v === void 0 ? "null" : canonicalJson(v)).join(",")}]`;
|
|
2400
|
-
const o = value;
|
|
2401
|
-
return `{${Object.keys(o).filter((k) => o[k] !== void 0).sort().map((k) => `${JSON.stringify(k)}:${canonicalJson(o[k])}`).join(",")}}`;
|
|
2227
|
+
return canonicalJson$1(value, { form: "json" });
|
|
2402
2228
|
}
|
|
2403
2229
|
/** This function gives the factor of a grid: `1 / grid`, or `undefined` for the exact numbers. */
|
|
2404
2230
|
function gridFactor(options) {
|
|
@@ -5214,37 +5040,26 @@ const VERDICT_DRAWS = 2e4;
|
|
|
5214
5040
|
const VERDICT_SEED = 1;
|
|
5215
5041
|
/** This function gives the mean of a list that is not empty. */
|
|
5216
5042
|
const meanOf = (values) => values.reduce((s, v) => s + v, 0) / values.length;
|
|
5217
|
-
/** This function gives the
|
|
5218
|
-
function
|
|
5219
|
-
|
|
5220
|
-
const
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
return
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5043
|
+
/** This function gives the mean of a sample of the differences, in the order of the sample. */
|
|
5044
|
+
function sampleMean(list) {
|
|
5045
|
+
let s = 0;
|
|
5046
|
+
for (const d of list) s += d;
|
|
5047
|
+
return s / list.length;
|
|
5048
|
+
}
|
|
5049
|
+
/** This function gives the mean of the means of the samples of the families. */
|
|
5050
|
+
function meanOfMeans(lists) {
|
|
5051
|
+
let sum = 0;
|
|
5052
|
+
for (const list of lists) sum += sampleMean(list);
|
|
5053
|
+
return sum / lists.length;
|
|
5054
|
+
}
|
|
5055
|
+
/** This function gives the interval of a bootstrap, with the mean of the data. */
|
|
5056
|
+
const intervalOf = (mean, i) => ({
|
|
5057
|
+
mean,
|
|
5058
|
+
lo: i.low,
|
|
5059
|
+
hi: i.high
|
|
5060
|
+
});
|
|
5233
5061
|
/** This function tells if an interval is clear of 0 on the side of the sign `sign`. */
|
|
5234
5062
|
const clearOn = (i, sign) => sign > 0 ? i.lo > 0 : sign < 0 ? i.hi < 0 : false;
|
|
5235
|
-
/** This function gives the two-sided p of the exact binomial sign test, with `p = 0.5`. No count gives 1. */
|
|
5236
|
-
function signP(wins, losses) {
|
|
5237
|
-
const n = wins + losses;
|
|
5238
|
-
if (n === 0) return 1;
|
|
5239
|
-
const k = Math.min(wins, losses);
|
|
5240
|
-
let tail = 0;
|
|
5241
|
-
let c = 1;
|
|
5242
|
-
for (let i = 0; i <= k; i++) {
|
|
5243
|
-
tail += c;
|
|
5244
|
-
c = c * (n - i) / (i + 1);
|
|
5245
|
-
}
|
|
5246
|
-
return Math.min(1, 2 * tail / 2 ** n);
|
|
5247
|
-
}
|
|
5248
5063
|
/** This function gives the breadth of a verdict with the side `side`: 1, -1, or 0 for no side. */
|
|
5249
5064
|
function breadthOf(families, side) {
|
|
5250
5065
|
const ties = families.filter((f) => f.sign === 0).length;
|
|
@@ -5356,63 +5171,39 @@ function verdict(records, options) {
|
|
|
5356
5171
|
sign: verdictOf === "better" ? 1 : verdictOf === "worse" ? -1 : 0
|
|
5357
5172
|
};
|
|
5358
5173
|
});
|
|
5174
|
+
const ends = [level / 2, 1 - level / 2];
|
|
5175
|
+
const diffs = lists.map((list) => list.map((p) => p.d));
|
|
5359
5176
|
const stratMean = meanOf(families.map((f) => f.mean));
|
|
5360
|
-
const
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
let s = 0;
|
|
5366
|
-
for (let j = 0; j < list.length; j++) s += list[Math.floor(rs() * list.length)].d;
|
|
5367
|
-
sum += s / list.length;
|
|
5368
|
-
}
|
|
5369
|
-
stratSamples.push(sum / lists.length);
|
|
5370
|
-
}
|
|
5371
|
-
const stratified = intervalOf(stratMean, stratSamples, level);
|
|
5177
|
+
const stratified = intervalOf(stratMean, bootstrapStrata(diffs, meanOfMeans, {
|
|
5178
|
+
runs,
|
|
5179
|
+
ends,
|
|
5180
|
+
seed: deriveSeed(seed, "verdict.stratified")
|
|
5181
|
+
}));
|
|
5372
5182
|
const pooledMean = meanOf(pairs.map((p) => p.d));
|
|
5373
|
-
const
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
pooledSamples.push(s / n);
|
|
5379
|
-
}
|
|
5380
|
-
const pooled = intervalOf(pooledMean, pooledSamples, level);
|
|
5183
|
+
const pooled = intervalOf(pooledMean, bootstrap(diffs.flat(), sampleMean, {
|
|
5184
|
+
runs,
|
|
5185
|
+
ends,
|
|
5186
|
+
seed: deriveSeed(seed, "verdict.pooled")
|
|
5187
|
+
}));
|
|
5381
5188
|
const terms = lists.flatMap((list) => list.map((p) => p.d / (lists.length * list.length)));
|
|
5382
|
-
const
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
if (exact) {
|
|
5388
|
-
total = 2 ** n;
|
|
5389
|
-
for (let mask = 0; mask < total; mask++) {
|
|
5390
|
-
let t = 0;
|
|
5391
|
-
for (let i = 0; i < n; i++) t += mask & 1 << i ? -terms[i] : terms[i];
|
|
5392
|
-
if (Math.abs(t) >= observed - slack) hits++;
|
|
5393
|
-
}
|
|
5394
|
-
} else {
|
|
5395
|
-
total = draws;
|
|
5396
|
-
const rf = stepRandom(seed, "verdict.permutation");
|
|
5397
|
-
for (let k = 0; k < draws; k++) {
|
|
5398
|
-
let t = 0;
|
|
5399
|
-
for (let i = 0; i < n; i++) t += rf() < .5 ? -terms[i] : terms[i];
|
|
5400
|
-
if (Math.abs(t) >= observed - slack) hits++;
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5189
|
+
const flips = signFlipTest(terms, {
|
|
5190
|
+
exactMax,
|
|
5191
|
+
runs: draws,
|
|
5192
|
+
seed: deriveSeed(seed, "verdict.permutation")
|
|
5193
|
+
});
|
|
5403
5194
|
const permutation = {
|
|
5404
|
-
p:
|
|
5405
|
-
exact,
|
|
5406
|
-
draws:
|
|
5195
|
+
p: flips.p,
|
|
5196
|
+
exact: flips.exact,
|
|
5197
|
+
draws: flips.runs,
|
|
5407
5198
|
seed
|
|
5408
5199
|
};
|
|
5409
5200
|
const wins = families.filter((f) => f.sign === 1).length;
|
|
5410
5201
|
const losses = families.filter((f) => f.sign === -1).length;
|
|
5411
|
-
const
|
|
5202
|
+
const signs = {
|
|
5412
5203
|
wins,
|
|
5413
5204
|
losses,
|
|
5414
5205
|
ties: families.length - wins - losses,
|
|
5415
|
-
p:
|
|
5206
|
+
p: signTest(wins, losses, 2)
|
|
5416
5207
|
};
|
|
5417
5208
|
const sign = Math.sign(stratified.mean);
|
|
5418
5209
|
const agree = sign !== 0 && sign === Math.sign(pooled.mean) && clearOn(stratified, sign) && clearOn(pooled, sign) && permutation.p < level;
|
|
@@ -5426,7 +5217,7 @@ function verdict(records, options) {
|
|
|
5426
5217
|
pooled,
|
|
5427
5218
|
permutation,
|
|
5428
5219
|
families,
|
|
5429
|
-
signTest,
|
|
5220
|
+
signTest: signs,
|
|
5430
5221
|
agree,
|
|
5431
5222
|
label,
|
|
5432
5223
|
scope: "these families",
|