pragmastat 11.1.0 → 12.0.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/README.md +15 -15
- package/dist/compare.d.ts +70 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +278 -0
- package/dist/compare.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Install from npm:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm i pragmastat@
|
|
6
|
+
npm i pragmastat@12.0.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Source code: https://github.com/AndreyAkinshin/pragmastat/tree/
|
|
9
|
+
Source code: https://github.com/AndreyAkinshin/pragmastat/tree/v12.0.0/ts
|
|
10
10
|
|
|
11
11
|
Pragmastat on npm: https://www.npmjs.com/package/pragmastat
|
|
12
12
|
|
|
@@ -36,24 +36,24 @@ import {
|
|
|
36
36
|
function main(): void {
|
|
37
37
|
// --- One-Sample ---
|
|
38
38
|
|
|
39
|
-
let sx = Sample.of(Array.from({ length:
|
|
39
|
+
let sx = Sample.of(Array.from({ length: 200 }, (_, i) => i + 1));
|
|
40
40
|
|
|
41
|
-
console.log(center(sx).value); //
|
|
42
|
-
console.log(centerBounds(sx, 1e-3)); // { lower:
|
|
43
|
-
console.log(spread(sx).value); //
|
|
44
|
-
console.log(spreadBounds(sx, 1e-3, 'demo')); // { lower:
|
|
41
|
+
console.log(center(sx).value); // 100.5
|
|
42
|
+
console.log(centerBounds(sx, 1e-3)); // { lower: 86, upper: 115, unit: ... }
|
|
43
|
+
console.log(spread(sx).value); // 59
|
|
44
|
+
console.log(spreadBounds(sx, 1e-3, 'demo')); // { lower: 44, upper: 87, unit: ... }
|
|
45
45
|
|
|
46
46
|
// --- Two-Sample ---
|
|
47
47
|
|
|
48
|
-
sx = Sample.of(Array.from({ length:
|
|
49
|
-
const sy = Sample.of(Array.from({ length:
|
|
48
|
+
sx = Sample.of(Array.from({ length: 200 }, (_, i) => i + 1));
|
|
49
|
+
const sy = Sample.of(Array.from({ length: 200 }, (_, i) => i + 101));
|
|
50
50
|
|
|
51
|
-
console.log(shift(sx, sy).value); // -
|
|
52
|
-
console.log(shiftBounds(sx, sy, 1e-3)); // { lower: -
|
|
53
|
-
console.log(ratio(sx, sy).value); // 0.
|
|
54
|
-
console.log(ratioBounds(sx, sy, 1e-3)); // { lower: 0.
|
|
55
|
-
console.log(disparity(sx, sy).value); // -
|
|
56
|
-
console.log(disparityBounds(sx, sy, 1e-3, 'demo')); // { lower: -
|
|
51
|
+
console.log(shift(sx, sy).value); // -100
|
|
52
|
+
console.log(shiftBounds(sx, sy, 1e-3)); // { lower: -120, upper: -80, unit: ... }
|
|
53
|
+
console.log(ratio(sx, sy).value); // 0.5008354224706336
|
|
54
|
+
console.log(ratioBounds(sx, sy, 1e-3)); // { lower: 0.4066..., upper: 0.5958..., unit: ... }
|
|
55
|
+
console.log(disparity(sx, sy).value); // -1.694915254237288
|
|
56
|
+
console.log(disparityBounds(sx, sy, 1e-3, 'demo')); // { lower: -3.1025..., upper: -0.8494..., unit: ... }
|
|
57
57
|
|
|
58
58
|
// --- Randomization ---
|
|
59
59
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare1 and Compare2: confirmatory analysis for one-sample and two-sample estimators.
|
|
3
|
+
*
|
|
4
|
+
* These high-level APIs compare estimates (Center, Spread, Shift, Ratio, Disparity)
|
|
5
|
+
* against practical thresholds and return verdicts (Less, Greater, or Inconclusive).
|
|
6
|
+
*/
|
|
7
|
+
import { Measurement } from './measurement';
|
|
8
|
+
import { Sample } from './sample';
|
|
9
|
+
import { Bounds } from './estimators';
|
|
10
|
+
/**
|
|
11
|
+
* Metric types supported by Compare1 and Compare2.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum Metric {
|
|
14
|
+
Center = "center",
|
|
15
|
+
Spread = "spread",
|
|
16
|
+
Shift = "shift",
|
|
17
|
+
Ratio = "ratio",
|
|
18
|
+
Disparity = "disparity"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Verdict from comparing an estimate against a threshold.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum ComparisonVerdict {
|
|
24
|
+
Less = "less",
|
|
25
|
+
Greater = "greater",
|
|
26
|
+
Inconclusive = "inconclusive"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A threshold value with a metric type and misrate for comparison.
|
|
30
|
+
*/
|
|
31
|
+
export declare class Threshold {
|
|
32
|
+
readonly metric: Metric;
|
|
33
|
+
readonly value: Measurement;
|
|
34
|
+
readonly misrate: number;
|
|
35
|
+
constructor(metric: Metric, value: Measurement, misrate: number);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A projection containing estimate, bounds, and verdict for a single threshold.
|
|
39
|
+
*/
|
|
40
|
+
export declare class Projection {
|
|
41
|
+
readonly threshold: Threshold;
|
|
42
|
+
readonly estimate: Measurement;
|
|
43
|
+
readonly bounds: Bounds;
|
|
44
|
+
readonly verdict: ComparisonVerdict;
|
|
45
|
+
constructor(threshold: Threshold, estimate: Measurement, bounds: Bounds, verdict: ComparisonVerdict);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* One-sample confirmatory analysis: compares Center/Spread against practical thresholds.
|
|
49
|
+
*
|
|
50
|
+
* @param x The sample to analyze
|
|
51
|
+
* @param thresholds List of thresholds to compare against
|
|
52
|
+
* @returns List of projections in the same order as the input thresholds
|
|
53
|
+
* @throws Error if thresholds is empty or contains unsupported metrics
|
|
54
|
+
* @throws AssumptionError if validation fails
|
|
55
|
+
*/
|
|
56
|
+
export declare function compare1(x: Sample, thresholds: Threshold[]): Projection[];
|
|
57
|
+
export declare function compare1(x: Sample, thresholds: Threshold[], seed: string): Projection[];
|
|
58
|
+
/**
|
|
59
|
+
* Two-sample confirmatory analysis: compares Shift/Ratio/Disparity against practical thresholds.
|
|
60
|
+
*
|
|
61
|
+
* @param x The first sample
|
|
62
|
+
* @param y The second sample
|
|
63
|
+
* @param thresholds List of thresholds to compare against
|
|
64
|
+
* @returns List of projections in the same order as the input thresholds
|
|
65
|
+
* @throws Error if thresholds is empty or contains unsupported metrics
|
|
66
|
+
* @throws AssumptionError if validation fails
|
|
67
|
+
*/
|
|
68
|
+
export declare function compare2(x: Sample, y: Sample, thresholds: Threshold[]): Projection[];
|
|
69
|
+
export declare function compare2(x: Sample, y: Sample, thresholds: Threshold[], seed: string): Projection[];
|
|
70
|
+
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,MAAM,EAA0D,MAAM,UAAU,CAAC;AAE1F,OAAO,EAWL,MAAM,EACP,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,oBAAY,MAAM;IAChB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,qBAAa,SAAS;IAElB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,KAAK,EAAE,WAAW;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM;gBAFf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM;CAS3B;AAED;;GAEG;AACH,qBAAa,UAAU;IAEnB,QAAQ,CAAC,SAAS,EAAE,SAAS;IAC7B,QAAQ,CAAC,QAAQ,EAAE,WAAW;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,OAAO,EAAE,iBAAiB;gBAH1B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB;CAEtC;AA8OD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,CAAC;AAC3E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC;AA6BzF;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,CAAC;AACtF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC"}
|
package/dist/compare.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Compare1 and Compare2: confirmatory analysis for one-sample and two-sample estimators.
|
|
4
|
+
*
|
|
5
|
+
* These high-level APIs compare estimates (Center, Spread, Shift, Ratio, Disparity)
|
|
6
|
+
* against practical thresholds and return verdicts (Less, Greater, or Inconclusive).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Projection = exports.Threshold = exports.ComparisonVerdict = exports.Metric = void 0;
|
|
10
|
+
exports.compare1 = compare1;
|
|
11
|
+
exports.compare2 = compare2;
|
|
12
|
+
const measurement_1 = require("./measurement");
|
|
13
|
+
const measurement_unit_1 = require("./measurement-unit");
|
|
14
|
+
const sample_1 = require("./sample");
|
|
15
|
+
const assumptions_1 = require("./assumptions");
|
|
16
|
+
const estimators_1 = require("./estimators");
|
|
17
|
+
/**
|
|
18
|
+
* Metric types supported by Compare1 and Compare2.
|
|
19
|
+
*/
|
|
20
|
+
var Metric;
|
|
21
|
+
(function (Metric) {
|
|
22
|
+
Metric["Center"] = "center";
|
|
23
|
+
Metric["Spread"] = "spread";
|
|
24
|
+
Metric["Shift"] = "shift";
|
|
25
|
+
Metric["Ratio"] = "ratio";
|
|
26
|
+
Metric["Disparity"] = "disparity";
|
|
27
|
+
})(Metric || (exports.Metric = Metric = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Verdict from comparing an estimate against a threshold.
|
|
30
|
+
*/
|
|
31
|
+
var ComparisonVerdict;
|
|
32
|
+
(function (ComparisonVerdict) {
|
|
33
|
+
ComparisonVerdict["Less"] = "less";
|
|
34
|
+
ComparisonVerdict["Greater"] = "greater";
|
|
35
|
+
ComparisonVerdict["Inconclusive"] = "inconclusive";
|
|
36
|
+
})(ComparisonVerdict || (exports.ComparisonVerdict = ComparisonVerdict = {}));
|
|
37
|
+
/**
|
|
38
|
+
* A threshold value with a metric type and misrate for comparison.
|
|
39
|
+
*/
|
|
40
|
+
class Threshold {
|
|
41
|
+
constructor(metric, value, misrate) {
|
|
42
|
+
this.metric = metric;
|
|
43
|
+
this.value = value;
|
|
44
|
+
this.misrate = misrate;
|
|
45
|
+
if (!Number.isFinite(misrate) || misrate <= 0.0 || misrate > 1.0) {
|
|
46
|
+
throw assumptions_1.AssumptionError.domain('misrate');
|
|
47
|
+
}
|
|
48
|
+
if (!Number.isFinite(value.value)) {
|
|
49
|
+
throw new Error('threshold value must be finite');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Threshold = Threshold;
|
|
54
|
+
/**
|
|
55
|
+
* A projection containing estimate, bounds, and verdict for a single threshold.
|
|
56
|
+
*/
|
|
57
|
+
class Projection {
|
|
58
|
+
constructor(threshold, estimate, bounds, verdict) {
|
|
59
|
+
this.threshold = threshold;
|
|
60
|
+
this.estimate = estimate;
|
|
61
|
+
this.bounds = bounds;
|
|
62
|
+
this.verdict = verdict;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Projection = Projection;
|
|
66
|
+
/** Validates and normalizes a Center threshold. */
|
|
67
|
+
function validateCenter(threshold, x, _y) {
|
|
68
|
+
if (!threshold.value.unit.isCompatible(x.unit)) {
|
|
69
|
+
throw new assumptions_1.AssumptionError(`can't convert ${threshold.value.unit.fullName} to ${x.unit.fullName}`);
|
|
70
|
+
}
|
|
71
|
+
const factor = measurement_unit_1.MeasurementUnit.conversionFactor(threshold.value.unit, x.unit);
|
|
72
|
+
return new measurement_1.Measurement(threshold.value.value * factor, x.unit);
|
|
73
|
+
}
|
|
74
|
+
/** Validates and normalizes a Spread threshold. */
|
|
75
|
+
function validateSpread(threshold, x, _y) {
|
|
76
|
+
return validateCenter(threshold, x, null); // Same validation as Center
|
|
77
|
+
}
|
|
78
|
+
/** Validates and normalizes a Shift threshold. */
|
|
79
|
+
function validateShift(threshold, x, y) {
|
|
80
|
+
if (!y) {
|
|
81
|
+
throw new Error('Shift requires y sample');
|
|
82
|
+
}
|
|
83
|
+
if (!threshold.value.unit.isCompatible(x.unit)) {
|
|
84
|
+
throw new assumptions_1.AssumptionError(`can't convert ${threshold.value.unit.fullName} to ${x.unit.fullName}`);
|
|
85
|
+
}
|
|
86
|
+
const target = measurement_unit_1.MeasurementUnit.finer(x.unit, y.unit);
|
|
87
|
+
const factor = measurement_unit_1.MeasurementUnit.conversionFactor(threshold.value.unit, target);
|
|
88
|
+
return new measurement_1.Measurement(threshold.value.value * factor, target);
|
|
89
|
+
}
|
|
90
|
+
/** Validates and normalizes a Ratio threshold. */
|
|
91
|
+
function validateRatio(threshold, _x, _y) {
|
|
92
|
+
const unit = threshold.value.unit;
|
|
93
|
+
if (unit.id !== 'ratio' && unit.id !== 'number') {
|
|
94
|
+
throw new assumptions_1.AssumptionError(`can't convert ${unit.fullName} to Ratio`);
|
|
95
|
+
}
|
|
96
|
+
const value = threshold.value.value;
|
|
97
|
+
if (value <= 0.0) {
|
|
98
|
+
throw new Error('Ratio threshold value must be positive');
|
|
99
|
+
}
|
|
100
|
+
return new measurement_1.Measurement(value, measurement_unit_1.MeasurementUnit.RATIO);
|
|
101
|
+
}
|
|
102
|
+
/** Validates and normalizes a Disparity threshold. */
|
|
103
|
+
function validateDisparity(threshold, _x, _y) {
|
|
104
|
+
const unit = threshold.value.unit;
|
|
105
|
+
if (unit.id !== 'disparity' && unit.id !== 'number') {
|
|
106
|
+
throw new assumptions_1.AssumptionError(`can't convert ${unit.fullName} to Disparity`);
|
|
107
|
+
}
|
|
108
|
+
return new measurement_1.Measurement(threshold.value.value, measurement_unit_1.MeasurementUnit.DISPARITY);
|
|
109
|
+
}
|
|
110
|
+
/** Compare1 metric specifications. */
|
|
111
|
+
const compare1Specs = [
|
|
112
|
+
{
|
|
113
|
+
metric: Metric.Center,
|
|
114
|
+
validateAndNormalize: validateCenter,
|
|
115
|
+
estimate: (x, _y) => (0, estimators_1.center)(x),
|
|
116
|
+
bounds: (x, _y, misrate, _seed) => (0, estimators_1.centerBounds)(x, misrate),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
metric: Metric.Spread,
|
|
120
|
+
validateAndNormalize: validateSpread,
|
|
121
|
+
estimate: (x, _y) => (0, estimators_1.spread)(x),
|
|
122
|
+
bounds: (x, _y, misrate, seed) => (0, estimators_1.spreadBounds)(x, misrate, seed),
|
|
123
|
+
seededBounds: (x, _y, misrate, seed) => (0, estimators_1.spreadBounds)(x, misrate, seed),
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
/** Compare2 metric specifications. */
|
|
127
|
+
const compare2Specs = [
|
|
128
|
+
{ metric: Metric.Shift, validateAndNormalize: validateShift },
|
|
129
|
+
{ metric: Metric.Ratio, validateAndNormalize: validateRatio },
|
|
130
|
+
{ metric: Metric.Disparity, validateAndNormalize: validateDisparity },
|
|
131
|
+
];
|
|
132
|
+
/** Computes the verdict by comparing bounds against a threshold value. */
|
|
133
|
+
function computeVerdict(bounds, thresholdValue) {
|
|
134
|
+
if (bounds.lower > thresholdValue) {
|
|
135
|
+
return ComparisonVerdict.Greater;
|
|
136
|
+
}
|
|
137
|
+
if (bounds.upper < thresholdValue) {
|
|
138
|
+
return ComparisonVerdict.Less;
|
|
139
|
+
}
|
|
140
|
+
return ComparisonVerdict.Inconclusive;
|
|
141
|
+
}
|
|
142
|
+
/** Gets the spec for a given metric from the spec array. */
|
|
143
|
+
function getSpec(specs, metric) {
|
|
144
|
+
return specs.find((s) => s.metric === metric);
|
|
145
|
+
}
|
|
146
|
+
/** Executes Compare1 logic. */
|
|
147
|
+
function executeCompare1(x, thresholds, normalizedValues, seed) {
|
|
148
|
+
const results = new Array(thresholds.length).fill(null);
|
|
149
|
+
// Group thresholds by metric
|
|
150
|
+
const byMetric = new Map();
|
|
151
|
+
for (let i = 0; i < thresholds.length; i++) {
|
|
152
|
+
const metric = thresholds[i].metric;
|
|
153
|
+
if (!byMetric.has(metric)) {
|
|
154
|
+
byMetric.set(metric, []);
|
|
155
|
+
}
|
|
156
|
+
byMetric.get(metric).push({
|
|
157
|
+
index: i,
|
|
158
|
+
threshold: thresholds[i],
|
|
159
|
+
normalizedValue: normalizedValues[i],
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Process each metric spec
|
|
163
|
+
for (const spec of compare1Specs) {
|
|
164
|
+
const entries = byMetric.get(spec.metric);
|
|
165
|
+
if (!entries || entries.length === 0) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Compute estimate once per metric
|
|
169
|
+
const estimate = spec.estimate(x, null);
|
|
170
|
+
// Compute bounds and verdict for each threshold of this metric
|
|
171
|
+
for (const entry of entries) {
|
|
172
|
+
const bounds = seed && spec.seededBounds
|
|
173
|
+
? spec.seededBounds(x, null, entry.threshold.misrate, seed)
|
|
174
|
+
: spec.bounds(x, null, entry.threshold.misrate);
|
|
175
|
+
const verdict = computeVerdict(bounds, entry.normalizedValue.value);
|
|
176
|
+
results[entry.index] = new Projection(entry.threshold, estimate, bounds, verdict);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return results.filter((r) => r !== null);
|
|
180
|
+
}
|
|
181
|
+
/** Executes Compare2 logic. */
|
|
182
|
+
function executeCompare2(x, y, thresholds, normalizedValues, seed) {
|
|
183
|
+
const results = new Array(thresholds.length).fill(null);
|
|
184
|
+
// Convert both samples to the finer unit
|
|
185
|
+
const [cx, cy] = (0, sample_1.convertToFiner)(x, y);
|
|
186
|
+
// Group thresholds by metric
|
|
187
|
+
const byMetric = new Map();
|
|
188
|
+
for (let i = 0; i < thresholds.length; i++) {
|
|
189
|
+
const metric = thresholds[i].metric;
|
|
190
|
+
if (!byMetric.has(metric)) {
|
|
191
|
+
byMetric.set(metric, []);
|
|
192
|
+
}
|
|
193
|
+
byMetric.get(metric).push({
|
|
194
|
+
index: i,
|
|
195
|
+
threshold: thresholds[i],
|
|
196
|
+
normalizedValue: normalizedValues[i],
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// Process Shift thresholds
|
|
200
|
+
const shiftEntries = byMetric.get(Metric.Shift);
|
|
201
|
+
if (shiftEntries && shiftEntries.length > 0) {
|
|
202
|
+
const estimate = (0, estimators_1.shift)(cx, cy);
|
|
203
|
+
for (const entry of shiftEntries) {
|
|
204
|
+
const bounds = (0, estimators_1.shiftBounds)(cx, cy, entry.threshold.misrate);
|
|
205
|
+
const verdict = computeVerdict(bounds, entry.normalizedValue.value);
|
|
206
|
+
results[entry.index] = new Projection(entry.threshold, estimate, bounds, verdict);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Process Ratio thresholds
|
|
210
|
+
const ratioEntries = byMetric.get(Metric.Ratio);
|
|
211
|
+
if (ratioEntries && ratioEntries.length > 0) {
|
|
212
|
+
const estimate = (0, estimators_1.ratio)(cx, cy);
|
|
213
|
+
for (const entry of ratioEntries) {
|
|
214
|
+
const bounds = (0, estimators_1.ratioBounds)(cx, cy, entry.threshold.misrate);
|
|
215
|
+
const verdict = computeVerdict(bounds, entry.normalizedValue.value);
|
|
216
|
+
results[entry.index] = new Projection(entry.threshold, estimate, bounds, verdict);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Process Disparity thresholds
|
|
220
|
+
const disparityEntries = byMetric.get(Metric.Disparity);
|
|
221
|
+
if (disparityEntries && disparityEntries.length > 0) {
|
|
222
|
+
const estimate = (0, estimators_1.disparity)(cx, cy);
|
|
223
|
+
for (const entry of disparityEntries) {
|
|
224
|
+
const bounds = (0, estimators_1.disparityBounds)(cx, cy, entry.threshold.misrate, seed);
|
|
225
|
+
const verdict = computeVerdict(bounds, entry.normalizedValue.value);
|
|
226
|
+
results[entry.index] = new Projection(entry.threshold, estimate, bounds, verdict);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return results.filter((r) => r !== null);
|
|
230
|
+
}
|
|
231
|
+
function compare1(x, thresholds, seed) {
|
|
232
|
+
(0, sample_1.checkNonWeighted)('x', x);
|
|
233
|
+
if (thresholds.length === 0) {
|
|
234
|
+
throw new Error('thresholds list cannot be empty');
|
|
235
|
+
}
|
|
236
|
+
for (const threshold of thresholds) {
|
|
237
|
+
if (threshold.metric !== Metric.Center && threshold.metric !== Metric.Spread) {
|
|
238
|
+
throw new Error(`Metric ${threshold.metric} is not supported by Compare1. Use Compare2 instead.`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const normalizedValues = [];
|
|
242
|
+
for (const threshold of thresholds) {
|
|
243
|
+
const spec = getSpec(compare1Specs, threshold.metric);
|
|
244
|
+
if (!spec) {
|
|
245
|
+
throw new Error(`No spec found for metric ${threshold.metric}`);
|
|
246
|
+
}
|
|
247
|
+
const normalized = spec.validateAndNormalize(threshold, x, null);
|
|
248
|
+
normalizedValues.push(normalized);
|
|
249
|
+
}
|
|
250
|
+
return executeCompare1(x, thresholds, normalizedValues, seed);
|
|
251
|
+
}
|
|
252
|
+
function compare2(x, y, thresholds, seed) {
|
|
253
|
+
(0, sample_1.checkNonWeighted)('x', x);
|
|
254
|
+
(0, sample_1.checkNonWeighted)('y', y);
|
|
255
|
+
(0, sample_1.checkCompatibleUnits)(x, y);
|
|
256
|
+
if (thresholds.length === 0) {
|
|
257
|
+
throw new Error('thresholds list cannot be empty');
|
|
258
|
+
}
|
|
259
|
+
for (const threshold of thresholds) {
|
|
260
|
+
if (threshold.metric !== Metric.Shift &&
|
|
261
|
+
threshold.metric !== Metric.Ratio &&
|
|
262
|
+
threshold.metric !== Metric.Disparity) {
|
|
263
|
+
throw new Error(`Metric ${threshold.metric} is not supported by Compare2. Use Compare1 instead.`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Normalize threshold values
|
|
267
|
+
const normalizedValues = [];
|
|
268
|
+
for (const threshold of thresholds) {
|
|
269
|
+
const spec = getSpec(compare2Specs, threshold.metric);
|
|
270
|
+
if (!spec) {
|
|
271
|
+
throw new Error(`No spec found for metric ${threshold.metric}`);
|
|
272
|
+
}
|
|
273
|
+
const normalized = spec.validateAndNormalize(threshold, x, y);
|
|
274
|
+
normalizedValues.push(normalized);
|
|
275
|
+
}
|
|
276
|
+
return executeCompare2(x, y, thresholds, normalizedValues, seed);
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA6TH,4BA0BC;AAcD,4BAsCC;AAzYD,+CAA4C;AAC5C,yDAAqD;AACrD,qCAA0F;AAC1F,+CAAgD;AAChD,6CAYsB;AAEtB;;GAEG;AACH,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,2BAAiB,CAAA;IAC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AC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IACE,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK;YACjC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK;YACjC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,EACrC,CAAC;YACD,MAAM,IAAI,KAAK,CACb,UAAU,SAAS,CAAC,MAAM,sDAAsD,CACjF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,6BAA6B;IAC7B,MAAM,gBAAgB,GAAkB,EAAE,CAAC;IAC3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9D,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { Measurement } from './measurement';
|
|
|
9
9
|
export { Sample } from './sample';
|
|
10
10
|
export { UnitRegistry } from './unit-registry';
|
|
11
11
|
export { DEFAULT_MISRATE, center, spread, shift, ratio, disparity, shiftBounds, ratioBounds, centerBounds, spreadBounds, disparityBounds, type Bounds, } from './estimators';
|
|
12
|
+
export { Metric, ComparisonVerdict, Threshold, Projection, compare1, compare2 } from './compare';
|
|
12
13
|
export { Rng } from './rng';
|
|
13
14
|
export { type Distribution, Uniform, Additive, Multiplic, Exp, Power } from './distributions/index';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAG5F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,KAAK,MAAM,GACZ,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAG5F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,KAAK,MAAM,GACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEjG,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A collection of robust statistical estimators for real-world data analysis.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Power = exports.Exp = exports.Multiplic = exports.Additive = exports.Uniform = exports.Rng = exports.disparityBounds = exports.spreadBounds = exports.centerBounds = exports.ratioBounds = exports.shiftBounds = exports.disparity = exports.ratio = exports.shift = exports.spread = exports.center = exports.DEFAULT_MISRATE = exports.UnitRegistry = exports.Sample = exports.Measurement = exports.MeasurementUnit = exports.AssumptionError = exports.AssumptionId = void 0;
|
|
8
|
+
exports.Power = exports.Exp = exports.Multiplic = exports.Additive = exports.Uniform = exports.Rng = exports.compare2 = exports.compare1 = exports.Projection = exports.Threshold = exports.ComparisonVerdict = exports.Metric = exports.disparityBounds = exports.spreadBounds = exports.centerBounds = exports.ratioBounds = exports.shiftBounds = exports.disparity = exports.ratio = exports.shift = exports.spread = exports.center = exports.DEFAULT_MISRATE = exports.UnitRegistry = exports.Sample = exports.Measurement = exports.MeasurementUnit = exports.AssumptionError = exports.AssumptionId = void 0;
|
|
9
9
|
// Assumptions
|
|
10
10
|
var assumptions_1 = require("./assumptions");
|
|
11
11
|
Object.defineProperty(exports, "AssumptionId", { enumerable: true, get: function () { return assumptions_1.AssumptionId; } });
|
|
@@ -32,6 +32,14 @@ Object.defineProperty(exports, "ratioBounds", { enumerable: true, get: function
|
|
|
32
32
|
Object.defineProperty(exports, "centerBounds", { enumerable: true, get: function () { return estimators_1.centerBounds; } });
|
|
33
33
|
Object.defineProperty(exports, "spreadBounds", { enumerable: true, get: function () { return estimators_1.spreadBounds; } });
|
|
34
34
|
Object.defineProperty(exports, "disparityBounds", { enumerable: true, get: function () { return estimators_1.disparityBounds; } });
|
|
35
|
+
// Compare
|
|
36
|
+
var compare_1 = require("./compare");
|
|
37
|
+
Object.defineProperty(exports, "Metric", { enumerable: true, get: function () { return compare_1.Metric; } });
|
|
38
|
+
Object.defineProperty(exports, "ComparisonVerdict", { enumerable: true, get: function () { return compare_1.ComparisonVerdict; } });
|
|
39
|
+
Object.defineProperty(exports, "Threshold", { enumerable: true, get: function () { return compare_1.Threshold; } });
|
|
40
|
+
Object.defineProperty(exports, "Projection", { enumerable: true, get: function () { return compare_1.Projection; } });
|
|
41
|
+
Object.defineProperty(exports, "compare1", { enumerable: true, get: function () { return compare_1.compare1; } });
|
|
42
|
+
Object.defineProperty(exports, "compare2", { enumerable: true, get: function () { return compare_1.compare2; } });
|
|
35
43
|
var rng_1 = require("./rng");
|
|
36
44
|
Object.defineProperty(exports, "Rng", { enumerable: true, get: function () { return rng_1.Rng; } });
|
|
37
45
|
var index_1 = require("./distributions/index");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,cAAc;AACd,6CAA4F;AAAnF,2GAAA,YAAY,OAAA;AAAE,8GAAA,eAAe,OAAA;AAEtC,YAAY;AACZ,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,aAAa;AACb,2CAasB;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