@ac-kit/math-stats 0.5.0 → 0.7.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/CHANGELOG.md +205 -0
- package/README.md +86 -6
- package/dist/_digamma.d.ts +10 -0
- package/dist/_digamma.d.ts.map +1 -0
- package/dist/_digamma.js +38 -0
- package/dist/_digamma.js.map +1 -0
- package/dist/_dilogarithm.d.ts +14 -0
- package/dist/_dilogarithm.d.ts.map +1 -0
- package/dist/_dilogarithm.js +77 -0
- package/dist/_dilogarithm.js.map +1 -0
- package/dist/_histogram-rules.d.ts +15 -0
- package/dist/_histogram-rules.d.ts.map +1 -0
- package/dist/_histogram-rules.js +208 -0
- package/dist/_histogram-rules.js.map +1 -0
- package/dist/_incomplete-gamma-shape-derivative.d.ts +17 -0
- package/dist/_incomplete-gamma-shape-derivative.d.ts.map +1 -0
- package/dist/_incomplete-gamma-shape-derivative.js +90 -0
- package/dist/_incomplete-gamma-shape-derivative.js.map +1 -0
- package/dist/_logistic.d.ts +14 -0
- package/dist/_logistic.d.ts.map +1 -0
- package/dist/_logistic.js +29 -0
- package/dist/_logistic.js.map +1 -0
- package/dist/_normal-tail.d.ts +43 -0
- package/dist/_normal-tail.d.ts.map +1 -0
- package/dist/_normal-tail.js +124 -0
- package/dist/_normal-tail.js.map +1 -0
- package/dist/_rank-test.d.ts +71 -0
- package/dist/_rank-test.d.ts.map +1 -0
- package/dist/_rank-test.js +130 -0
- package/dist/_rank-test.js.map +1 -0
- package/dist/average.js +2 -2
- package/dist/average.js.map +1 -1
- package/dist/bootstrap.d.ts +67 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +154 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/censored-logistic-distribution.d.ts +23 -0
- package/dist/censored-logistic-distribution.d.ts.map +1 -0
- package/dist/censored-logistic-distribution.js +63 -0
- package/dist/censored-logistic-distribution.js.map +1 -0
- package/dist/censored-shifted-gamma-distribution.d.ts +23 -0
- package/dist/censored-shifted-gamma-distribution.d.ts.map +1 -0
- package/dist/censored-shifted-gamma-distribution.js +73 -0
- package/dist/censored-shifted-gamma-distribution.js.map +1 -0
- package/dist/confidence-interval.d.ts +53 -0
- package/dist/confidence-interval.d.ts.map +1 -1
- package/dist/confidence-interval.js +73 -0
- package/dist/confidence-interval.js.map +1 -1
- package/dist/correlation.d.ts +41 -0
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +168 -2
- package/dist/correlation.js.map +1 -1
- package/dist/descriptive.d.ts +129 -0
- package/dist/descriptive.d.ts.map +1 -0
- package/dist/descriptive.js +289 -0
- package/dist/descriptive.js.map +1 -0
- package/dist/forecast/_forecast-checks.d.ts +30 -0
- package/dist/forecast/_forecast-checks.d.ts.map +1 -0
- package/dist/forecast/_forecast-checks.js +119 -0
- package/dist/forecast/_forecast-checks.js.map +1 -0
- package/dist/forecast/_score-kernels.d.ts +63 -0
- package/dist/forecast/_score-kernels.d.ts.map +1 -0
- package/dist/forecast/_score-kernels.js +264 -0
- package/dist/forecast/_score-kernels.js.map +1 -0
- package/dist/forecast/brier-score.d.ts +102 -0
- package/dist/forecast/brier-score.d.ts.map +1 -0
- package/dist/forecast/brier-score.js +163 -0
- package/dist/forecast/brier-score.js.map +1 -0
- package/dist/forecast/crps-closed-form.d.ts +64 -0
- package/dist/forecast/crps-closed-form.d.ts.map +1 -0
- package/dist/forecast/crps-closed-form.js +106 -0
- package/dist/forecast/crps-closed-form.js.map +1 -0
- package/dist/forecast/crps-ensemble.d.ts +53 -0
- package/dist/forecast/crps-ensemble.d.ts.map +1 -0
- package/dist/forecast/crps-ensemble.js +121 -0
- package/dist/forecast/crps-ensemble.js.map +1 -0
- package/dist/forecast/emos.d.ts +158 -0
- package/dist/forecast/emos.d.ts.map +1 -0
- package/dist/forecast/emos.js +397 -0
- package/dist/forecast/emos.js.map +1 -0
- package/dist/forecast/exceedance-probability.d.ts +54 -0
- package/dist/forecast/exceedance-probability.d.ts.map +1 -0
- package/dist/forecast/exceedance-probability.js +125 -0
- package/dist/forecast/exceedance-probability.js.map +1 -0
- package/dist/forecast/log-score.d.ts +18 -0
- package/dist/forecast/log-score.d.ts.map +1 -0
- package/dist/forecast/log-score.js +19 -0
- package/dist/forecast/log-score.js.map +1 -0
- package/dist/forecast/logistic-regression.d.ts +123 -0
- package/dist/forecast/logistic-regression.d.ts.map +1 -0
- package/dist/forecast/logistic-regression.js +282 -0
- package/dist/forecast/logistic-regression.js.map +1 -0
- package/dist/forecast/rank-histogram.d.ts +32 -0
- package/dist/forecast/rank-histogram.d.ts.map +1 -0
- package/dist/forecast/rank-histogram.js +63 -0
- package/dist/forecast/rank-histogram.js.map +1 -0
- package/dist/forecast/reliability-diagram.d.ts +70 -0
- package/dist/forecast/reliability-diagram.d.ts.map +1 -0
- package/dist/forecast/reliability-diagram.js +126 -0
- package/dist/forecast/reliability-diagram.js.map +1 -0
- package/dist/forecast/roc-curve.d.ts +58 -0
- package/dist/forecast/roc-curve.d.ts.map +1 -0
- package/dist/forecast/roc-curve.js +124 -0
- package/dist/forecast/roc-curve.js.map +1 -0
- package/dist/hierarchical-cluster.d.ts.map +1 -1
- package/dist/hierarchical-cluster.js +10 -5
- package/dist/hierarchical-cluster.js.map +1 -1
- package/dist/histogram-edges.d.ts +92 -0
- package/dist/histogram-edges.d.ts.map +1 -0
- package/dist/histogram-edges.js +325 -0
- package/dist/histogram-edges.js.map +1 -0
- package/dist/histogram.d.ts +55 -21
- package/dist/histogram.d.ts.map +1 -1
- package/dist/histogram.js +56 -83
- package/dist/histogram.js.map +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/kmeans.d.ts.map +1 -1
- package/dist/kmeans.js +11 -6
- package/dist/kmeans.js.map +1 -1
- package/dist/kmedoids.js +2 -1
- package/dist/kmedoids.js.map +1 -1
- package/dist/mann-whitney-u.d.ts +27 -0
- package/dist/mann-whitney-u.d.ts.map +1 -0
- package/dist/mann-whitney-u.js +94 -0
- package/dist/mann-whitney-u.js.map +1 -0
- package/dist/multiple-regression.d.ts +123 -0
- package/dist/multiple-regression.d.ts.map +1 -0
- package/dist/multiple-regression.js +208 -0
- package/dist/multiple-regression.js.map +1 -0
- package/dist/principal-components.d.ts +66 -0
- package/dist/principal-components.d.ts.map +1 -0
- package/dist/principal-components.js +105 -0
- package/dist/principal-components.js.map +1 -0
- package/dist/quantile.d.ts +113 -5
- package/dist/quantile.d.ts.map +1 -1
- package/dist/quantile.js +318 -19
- package/dist/quantile.js.map +1 -1
- package/dist/regression.d.ts +46 -0
- package/dist/regression.d.ts.map +1 -1
- package/dist/regression.js +99 -1
- package/dist/regression.js.map +1 -1
- package/dist/running-statistics.d.ts +103 -0
- package/dist/running-statistics.d.ts.map +1 -0
- package/dist/running-statistics.js +283 -0
- package/dist/running-statistics.js.map +1 -0
- package/dist/sample.d.ts +29 -0
- package/dist/sample.d.ts.map +1 -0
- package/dist/sample.js +39 -0
- package/dist/sample.js.map +1 -0
- package/dist/t-digest.d.ts +136 -0
- package/dist/t-digest.d.ts.map +1 -0
- package/dist/t-digest.js +424 -0
- package/dist/t-digest.js.map +1 -0
- package/dist/truncated-normal-distribution.d.ts +28 -0
- package/dist/truncated-normal-distribution.d.ts.map +1 -0
- package/dist/truncated-normal-distribution.js +198 -0
- package/dist/truncated-normal-distribution.js.map +1 -0
- package/dist/wilcoxon-signed-rank.d.ts +42 -0
- package/dist/wilcoxon-signed-rank.d.ts.map +1 -0
- package/dist/wilcoxon-signed-rank.js +117 -0
- package/dist/wilcoxon-signed-rank.js.map +1 -0
- package/package.json +14 -10
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type Callable } from "@ac-kit/core";
|
|
2
|
+
import { type BootstrapOptions } from "./bootstrap.js";
|
|
1
3
|
/** An interval estimate around a point estimate, at a confidence level. */
|
|
2
4
|
export type ConfidenceInterval = {
|
|
3
5
|
/** The point estimate the interval is about. */
|
|
@@ -59,4 +61,55 @@ export declare function meanConfidenceInterval(values: readonly number[], level?
|
|
|
59
61
|
* 1)`.
|
|
60
62
|
*/
|
|
61
63
|
export declare function medianConfidenceInterval(sorted: readonly number[], level?: number): ConfidenceInterval;
|
|
64
|
+
/**
|
|
65
|
+
* The estimators {@link confidenceInterval} computes an interval for: the sample
|
|
66
|
+
* `"mean"`, the `"median"`, or any statistic of a sample.
|
|
67
|
+
*/
|
|
68
|
+
export type ConfidenceIntervalStatistic = "mean" | "median" | Callable<[readonly number[]], number>;
|
|
69
|
+
/**
|
|
70
|
+
* How {@link confidenceInterval} builds the interval:
|
|
71
|
+
*
|
|
72
|
+
* - `"t"` — Student's `mean ± t · s/√n` (the mean only; its default).
|
|
73
|
+
* - `"normal"` — `mean ± z · s/√n`, {@link meanConfidenceInterval} (the mean
|
|
74
|
+
* only).
|
|
75
|
+
* - `"order-statistic"` — the distribution-free order statistics of
|
|
76
|
+
* {@link medianConfidenceInterval} (the median only; its default).
|
|
77
|
+
* - `"bootstrap"` — {@link bootstrap}, for any statistic (the default for a
|
|
78
|
+
* statistic function).
|
|
79
|
+
*/
|
|
80
|
+
export type ConfidenceIntervalMethod = "t" | "normal" | "order-statistic" | "bootstrap";
|
|
81
|
+
/** Options of {@link confidenceInterval}. */
|
|
82
|
+
export type ConfidenceIntervalOptions = {
|
|
83
|
+
/** Defaults to `"mean"`. */
|
|
84
|
+
readonly statistic?: ConfidenceIntervalStatistic;
|
|
85
|
+
/** Defaults to the statistic's default (see {@link ConfidenceIntervalMethod}). */
|
|
86
|
+
readonly method?: ConfidenceIntervalMethod;
|
|
87
|
+
/** Resamples, method and random source of the `"bootstrap"` method. */
|
|
88
|
+
readonly bootstrap?: Omit<BootstrapOptions, "level">;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* A confidence interval at `level` for a statistic of `values`, by the method
|
|
92
|
+
* that suits it: Student's t for the mean, order statistics for the median, the
|
|
93
|
+
* bootstrap (BCa by default) for any statistic and as the
|
|
94
|
+
* no-distributional-assumption choice for the mean and the median too.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* confidenceInterval(timings); // Student's t interval for the mean
|
|
99
|
+
* confidenceInterval(timings, 0.99, { statistic: "median" });
|
|
100
|
+
* confidenceInterval(timings, 0.95, {
|
|
101
|
+
* statistic: (sample) => trimmedMean(sample, 0.1),
|
|
102
|
+
* bootstrap: { random: mulberry32(1) },
|
|
103
|
+
* });
|
|
104
|
+
* ```;
|
|
105
|
+
*
|
|
106
|
+
* @param values The sample, in any order. Not modified.
|
|
107
|
+
* @param level Confidence level in `(0, 1)`. Default `0.95`.
|
|
108
|
+
* @param options The statistic and the method.
|
|
109
|
+
* @returns The interval.
|
|
110
|
+
* @throws {RangeError} When the sample is too small for the method (two values,
|
|
111
|
+
* one for the order statistics), `level` is outside `(0, 1)`, or the method
|
|
112
|
+
* does not apply to the statistic.
|
|
113
|
+
*/
|
|
114
|
+
export declare function confidenceInterval(values: readonly number[], level?: number, options?: ConfidenceIntervalOptions): ConfidenceInterval;
|
|
62
115
|
//# sourceMappingURL=confidence-interval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confidence-interval.d.ts","sourceRoot":"","sources":["../src/confidence-interval.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"confidence-interval.d.ts","sourceRoot":"","sources":["../src/confidence-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMlE,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,GAAG;IAChC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,mCAAmC;IACnC,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3
|
+
import { bootstrap } from "./bootstrap.js";
|
|
3
4
|
import { sampleStandardDeviation } from "./dispersion.js";
|
|
4
5
|
import { normalQuantile } from "./normal-quantile.js";
|
|
5
6
|
import { quantile } from "./quantile.js";
|
|
7
|
+
import { studentTDistribution } from "./student-t-distribution.js";
|
|
6
8
|
/**
|
|
7
9
|
* Normal-approximation confidence interval for the mean of a sample: `mean ± z
|
|
8
10
|
* · s / √n`, with `z` the `(1 + level) / 2` standard normal quantile and `s`
|
|
@@ -86,6 +88,77 @@ export function medianConfidenceInterval(sorted, level = 0.95) {
|
|
|
86
88
|
level,
|
|
87
89
|
};
|
|
88
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* A confidence interval at `level` for a statistic of `values`, by the method
|
|
93
|
+
* that suits it: Student's t for the mean, order statistics for the median, the
|
|
94
|
+
* bootstrap (BCa by default) for any statistic and as the
|
|
95
|
+
* no-distributional-assumption choice for the mean and the median too.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* confidenceInterval(timings); // Student's t interval for the mean
|
|
100
|
+
* confidenceInterval(timings, 0.99, { statistic: "median" });
|
|
101
|
+
* confidenceInterval(timings, 0.95, {
|
|
102
|
+
* statistic: (sample) => trimmedMean(sample, 0.1),
|
|
103
|
+
* bootstrap: { random: mulberry32(1) },
|
|
104
|
+
* });
|
|
105
|
+
* ```;
|
|
106
|
+
*
|
|
107
|
+
* @param values The sample, in any order. Not modified.
|
|
108
|
+
* @param level Confidence level in `(0, 1)`. Default `0.95`.
|
|
109
|
+
* @param options The statistic and the method.
|
|
110
|
+
* @returns The interval.
|
|
111
|
+
* @throws {RangeError} When the sample is too small for the method (two values,
|
|
112
|
+
* one for the order statistics), `level` is outside `(0, 1)`, or the method
|
|
113
|
+
* does not apply to the statistic.
|
|
114
|
+
*/
|
|
115
|
+
export function confidenceInterval(values, level = 0.95, options) {
|
|
116
|
+
checkConfidenceLevel(level);
|
|
117
|
+
const statistic = options?.statistic ?? "mean";
|
|
118
|
+
const method = options?.method ??
|
|
119
|
+
(statistic === "mean"
|
|
120
|
+
? "t"
|
|
121
|
+
: statistic === "median"
|
|
122
|
+
? "order-statistic"
|
|
123
|
+
: "bootstrap");
|
|
124
|
+
if (method === "bootstrap") {
|
|
125
|
+
const estimator = statistic === "mean"
|
|
126
|
+
? meanOf_
|
|
127
|
+
: statistic === "median"
|
|
128
|
+
? medianOf_
|
|
129
|
+
: statistic;
|
|
130
|
+
return bootstrap(values, estimator, { ...options?.bootstrap, level });
|
|
131
|
+
}
|
|
132
|
+
if (statistic === "mean" && method === "normal") {
|
|
133
|
+
return meanConfidenceInterval(values, level);
|
|
134
|
+
}
|
|
135
|
+
if (statistic === "mean" && method === "t") {
|
|
136
|
+
if (values.length < 2) {
|
|
137
|
+
throw new RangeError("confidenceInterval: the sample must have at least two values");
|
|
138
|
+
}
|
|
139
|
+
const estimate = mean(values);
|
|
140
|
+
const standardError = sampleStandardDeviation(values) / Math.sqrt(values.length);
|
|
141
|
+
const halfWidth = studentTDistribution(values.length - 1).quantile((1 + level) / 2) *
|
|
142
|
+
standardError;
|
|
143
|
+
return {
|
|
144
|
+
estimate,
|
|
145
|
+
lower: estimate - halfWidth,
|
|
146
|
+
upper: estimate + halfWidth,
|
|
147
|
+
halfWidth,
|
|
148
|
+
level,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (statistic === "median" && method === "order-statistic") {
|
|
152
|
+
return medianConfidenceInterval([...values].sort((left, right) => left - right), level);
|
|
153
|
+
}
|
|
154
|
+
throw new RangeError(`confidenceInterval: the "${method}" method does not apply to ${typeof statistic === "string" ? `the ${statistic}` : "a statistic function"}`);
|
|
155
|
+
}
|
|
156
|
+
function meanOf_(values) {
|
|
157
|
+
return mean(values);
|
|
158
|
+
}
|
|
159
|
+
function medianOf_(values) {
|
|
160
|
+
return quantile([...values].sort((left, right) => left - right), 0.5);
|
|
161
|
+
}
|
|
89
162
|
function checkConfidenceLevel(level) {
|
|
90
163
|
if (!(level > 0 && level < 1)) {
|
|
91
164
|
throw new RangeError(`the confidence level must be in (0, 1), got ${describeValue(level)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confidence-interval.js","sourceRoot":"","sources":["../src/confidence-interval.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"confidence-interval.js","sourceRoot":"","sources":["../src/confidence-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAyB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAwBnE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CACrC,MAAyB,EACzB,KAAK,GAAG,IAAI;IAEZ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,UAAU,CACnB,kEAAkE,CAClE,CAAC;IACH,CAAC;IACD,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAE5B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,aAAa,GAClB,uBAAuB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC;IAElE,OAAO;QACN,QAAQ;QACR,KAAK,EAAE,QAAQ,GAAG,SAAS;QAC3B,K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angeError} If `xValues` and `yValues` have different lengths.
|
|
12
12
|
*/
|
|
13
13
|
export declare function pearsonCorrelation(xValues: readonly number[], yValues: readonly number[]): number;
|
|
14
|
+
/**
|
|
15
|
+
* Spearman's rank correlation coefficient ρ of paired `xValues` and `yValues`:
|
|
16
|
+
* Pearson's coefficient of their ranks, so it measures how nearly a monotone
|
|
17
|
+
* function — not only a line — relates them, from -1 through 0 to
|
|
18
|
+
*
|
|
19
|
+
* 1. Tied values take the average of the ranks they span (`rankBy` from
|
|
20
|
+
* `@ac-kit/algo` with `ties: "average"`), which is SciPy's `spearmanr` and
|
|
21
|
+
* R's `cor(method = "spearman")`; the `1 − 6Σd²/(n(n² − 1))` shortcut is
|
|
22
|
+
* exact only without ties and is not used.
|
|
23
|
+
*
|
|
24
|
+
* Time O(n log n), memory O(n).
|
|
25
|
+
*
|
|
26
|
+
* @param xValues Samples. Not modified.
|
|
27
|
+
* @param yValues Samples paired by index. Not modified.
|
|
28
|
+
* @returns The coefficient; `0` for fewer than two pairs or when either side is
|
|
29
|
+
* constant, as {@link pearsonCorrelation}; `NaN` when a value is `NaN`.
|
|
30
|
+
* @throws {RangeError} If `xValues` and `yValues` have different lengths.
|
|
31
|
+
*/
|
|
32
|
+
export declare function spearmanCorrelation(xValues: readonly number[], yValues: readonly number[]): number;
|
|
33
|
+
/**
|
|
34
|
+
* Kendall's rank correlation coefficient τ_b of paired `xValues` and `yValues`:
|
|
35
|
+
* the excess of concordant over discordant pairs, `(n_c − n_d) / √((n₀ − n₁)(n₀
|
|
36
|
+
* − n₂))`, with `n₀ = n(n − 1)/2` and `n₁`, `n₂` the pairs tied in `x` and in
|
|
37
|
+
* `y`. The tie correction makes it reach ±1 for a monotone relation with ties
|
|
38
|
+
* (where τ_a does not); it is SciPy's `kendalltau` default and R's `cor(method
|
|
39
|
+
* = "kendall")`.
|
|
40
|
+
*
|
|
41
|
+
* Knight's algorithm: the pairs sorted by `x` then `y`, then a merge sort by
|
|
42
|
+
* `y` counting the exchanges, which are the discordant pairs. Values are
|
|
43
|
+
* compared through their dense ranks (`rankBy` from `@ac-kit/algo`), so `-0`
|
|
44
|
+
* ties `0`.
|
|
45
|
+
*
|
|
46
|
+
* Time O(n log n), memory O(n).
|
|
47
|
+
*
|
|
48
|
+
* @param xValues Samples. Not modified.
|
|
49
|
+
* @param yValues Samples paired by index. Not modified.
|
|
50
|
+
* @returns The coefficient; `0` for fewer than two pairs or when either side is
|
|
51
|
+
* constant, as {@link pearsonCorrelation}; `NaN` when a value is `NaN`.
|
|
52
|
+
* @throws {RangeError} If `xValues` and `yValues` have different lengths.
|
|
53
|
+
*/
|
|
54
|
+
export declare function kendallTau(xValues: readonly number[], yValues: readonly number[]): number;
|
|
14
55
|
//# sourceMappingURL=correlation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../src/correlation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../src/correlation.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CASR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CAcR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CA8ER"}
|
package/dist/correlation.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rankBy } from "@ac-kit/algo";
|
|
1
2
|
import { PreciseSum } from "@ac-kit/core";
|
|
2
3
|
import { mean } from "./average.js";
|
|
3
4
|
/**
|
|
@@ -19,8 +20,134 @@ export function pearsonCorrelation(xValues, yValues) {
|
|
|
19
20
|
if (xValues.length < 2) {
|
|
20
21
|
return 0;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
return correlationAboutMeans_(xValues, yValues, mean(xValues), mean(yValues));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Spearman's rank correlation coefficient ρ of paired `xValues` and `yValues`:
|
|
27
|
+
* Pearson's coefficient of their ranks, so it measures how nearly a monotone
|
|
28
|
+
* function — not only a line — relates them, from -1 through 0 to
|
|
29
|
+
*
|
|
30
|
+
* 1. Tied values take the average of the ranks they span (`rankBy` from
|
|
31
|
+
* `@ac-kit/algo` with `ties: "average"`), which is SciPy's `spearmanr` and
|
|
32
|
+
* R's `cor(method = "spearman")`; the `1 − 6Σd²/(n(n² − 1))` shortcut is
|
|
33
|
+
* exact only without ties and is not used.
|
|
34
|
+
*
|
|
35
|
+
* Time O(n log n), memory O(n).
|
|
36
|
+
*
|
|
37
|
+
* @param xValues Samples. Not modified.
|
|
38
|
+
* @param yValues Samples paired by index. Not modified.
|
|
39
|
+
* @returns The coefficient; `0` for fewer than two pairs or when either side is
|
|
40
|
+
* constant, as {@link pearsonCorrelation}; `NaN` when a value is `NaN`.
|
|
41
|
+
* @throws {RangeError} If `xValues` and `yValues` have different lengths.
|
|
42
|
+
*/
|
|
43
|
+
export function spearmanCorrelation(xValues, yValues) {
|
|
44
|
+
if (xValues.length !== yValues.length) {
|
|
45
|
+
throw new RangeError("xValues and yValues must have the same length");
|
|
46
|
+
}
|
|
47
|
+
const count = xValues.length;
|
|
48
|
+
if (count < 2) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const ranksX = rankBy(xValues, identity_);
|
|
52
|
+
const ranksY = rankBy(yValues, identity_);
|
|
53
|
+
// Average ranks always sum to n(n + 1)/2, so their mean is exact.
|
|
54
|
+
const meanRank = (count + 1) / 2;
|
|
55
|
+
return correlationAboutMeans_(ranksX, ranksY, meanRank, meanRank);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Kendall's rank correlation coefficient τ_b of paired `xValues` and `yValues`:
|
|
59
|
+
* the excess of concordant over discordant pairs, `(n_c − n_d) / √((n₀ − n₁)(n₀
|
|
60
|
+
* − n₂))`, with `n₀ = n(n − 1)/2` and `n₁`, `n₂` the pairs tied in `x` and in
|
|
61
|
+
* `y`. The tie correction makes it reach ±1 for a monotone relation with ties
|
|
62
|
+
* (where τ_a does not); it is SciPy's `kendalltau` default and R's `cor(method
|
|
63
|
+
* = "kendall")`.
|
|
64
|
+
*
|
|
65
|
+
* Knight's algorithm: the pairs sorted by `x` then `y`, then a merge sort by
|
|
66
|
+
* `y` counting the exchanges, which are the discordant pairs. Values are
|
|
67
|
+
* compared through their dense ranks (`rankBy` from `@ac-kit/algo`), so `-0`
|
|
68
|
+
* ties `0`.
|
|
69
|
+
*
|
|
70
|
+
* Time O(n log n), memory O(n).
|
|
71
|
+
*
|
|
72
|
+
* @param xValues Samples. Not modified.
|
|
73
|
+
* @param yValues Samples paired by index. Not modified.
|
|
74
|
+
* @returns The coefficient; `0` for fewer than two pairs or when either side is
|
|
75
|
+
* constant, as {@link pearsonCorrelation}; `NaN` when a value is `NaN`.
|
|
76
|
+
* @throws {RangeError} If `xValues` and `yValues` have different lengths.
|
|
77
|
+
*/
|
|
78
|
+
export function kendallTau(xValues, yValues) {
|
|
79
|
+
if (xValues.length !== yValues.length) {
|
|
80
|
+
throw new RangeError("xValues and yValues must have the same length");
|
|
81
|
+
}
|
|
82
|
+
const count = xValues.length;
|
|
83
|
+
if (count < 2) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const ranksX = rankBy(xValues, identity_, { ties: "dense" });
|
|
87
|
+
const ranksY = rankBy(yValues, identity_, { ties: "dense" });
|
|
88
|
+
for (let index = 0; index < count; index++) {
|
|
89
|
+
if (ranksX[index] !== ranksX[index] || ranksY[index] !== ranksY[index]) {
|
|
90
|
+
return Number.NaN;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const order = new Int32Array(count);
|
|
94
|
+
for (let index = 0; index < count; index++) {
|
|
95
|
+
order[index] = index;
|
|
96
|
+
}
|
|
97
|
+
order.sort((left, right) => ranksX[left] - ranksX[right] || ranksY[left] - ranksY[right]);
|
|
98
|
+
let tiedX = 0;
|
|
99
|
+
let tiedBoth = 0;
|
|
100
|
+
let runX = 1;
|
|
101
|
+
let runBoth = 1;
|
|
102
|
+
for (let position = 1; position < count; position++) {
|
|
103
|
+
const previous = order[position - 1];
|
|
104
|
+
const current = order[position];
|
|
105
|
+
if (ranksX[previous] === ranksX[current]) {
|
|
106
|
+
runX++;
|
|
107
|
+
if (ranksY[previous] === ranksY[current]) {
|
|
108
|
+
runBoth++;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
tiedBoth += (runBoth * (runBoth - 1)) / 2;
|
|
112
|
+
runBoth = 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
tiedX += (runX * (runX - 1)) / 2;
|
|
117
|
+
tiedBoth += (runBoth * (runBoth - 1)) / 2;
|
|
118
|
+
runX = 1;
|
|
119
|
+
runBoth = 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
tiedX += (runX * (runX - 1)) / 2;
|
|
123
|
+
tiedBoth += (runBoth * (runBoth - 1)) / 2;
|
|
124
|
+
const discordant = mergeSortCountingExchanges_(order, new Int32Array(count), ranksY);
|
|
125
|
+
let tiedY = 0;
|
|
126
|
+
let runY = 1;
|
|
127
|
+
for (let position = 1; position < count; position++) {
|
|
128
|
+
if (ranksY[order[position - 1]] === ranksY[order[position]]) {
|
|
129
|
+
runY++;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
tiedY += (runY * (runY - 1)) / 2;
|
|
133
|
+
runY = 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
tiedY += (runY * (runY - 1)) / 2;
|
|
137
|
+
const pairs = (count * (count - 1)) / 2;
|
|
138
|
+
const untiedX = pairs - tiedX;
|
|
139
|
+
const untiedY = pairs - tiedY;
|
|
140
|
+
if (untiedX === 0 || untiedY === 0) {
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
// n_c − n_d = n₀ − n₁ − n₂ + n₃ − 2·n_d, every term an exact integer.
|
|
144
|
+
const excess = pairs - tiedX - tiedY + tiedBoth - 2 * discordant;
|
|
145
|
+
return excess / Math.sqrt(untiedX) / Math.sqrt(untiedY);
|
|
146
|
+
}
|
|
147
|
+
function identity_(value) {
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
function correlationAboutMeans_(xValues, yValues, meanX, meanY) {
|
|
24
151
|
const covariance = new PreciseSum();
|
|
25
152
|
const varianceX = new PreciseSum();
|
|
26
153
|
const varianceY = new PreciseSum();
|
|
@@ -34,4 +161,43 @@ export function pearsonCorrelation(xValues, yValues) {
|
|
|
34
161
|
const spread = Math.sqrt(varianceX.value * varianceY.value);
|
|
35
162
|
return spread === 0 ? 0 : covariance.value / spread;
|
|
36
163
|
}
|
|
164
|
+
// Bottom-up stable merge sort of `order` by `keys`, returning the number of
|
|
165
|
+
// pairs it exchanges: those whose key decreases along the input order.
|
|
166
|
+
function mergeSortCountingExchanges_(order, scratch, keys) {
|
|
167
|
+
const count = order.length;
|
|
168
|
+
let source = order;
|
|
169
|
+
let target = scratch;
|
|
170
|
+
let exchanges = 0;
|
|
171
|
+
for (let width = 1; width < count; width *= 2) {
|
|
172
|
+
for (let low = 0; low < count; low += 2 * width) {
|
|
173
|
+
const middle = Math.min(low + width, count);
|
|
174
|
+
const high = Math.min(low + 2 * width, count);
|
|
175
|
+
let left = low;
|
|
176
|
+
let right = middle;
|
|
177
|
+
let output = low;
|
|
178
|
+
while (left < middle && right < high) {
|
|
179
|
+
if (keys[source[right]] < keys[source[left]]) {
|
|
180
|
+
exchanges += middle - left;
|
|
181
|
+
target[output++] = source[right++];
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
target[output++] = source[left++];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
while (left < middle) {
|
|
188
|
+
target[output++] = source[left++];
|
|
189
|
+
}
|
|
190
|
+
while (right < high) {
|
|
191
|
+
target[output++] = source[right++];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const swap = source;
|
|
195
|
+
source = target;
|
|
196
|
+
target = swap;
|
|
197
|
+
}
|
|
198
|
+
if (source !== order) {
|
|
199
|
+
order.set(source);
|
|
200
|
+
}
|
|
201
|
+
return exchanges;
|
|
202
|
+
}
|
|
37
203
|
//# sourceMappingURL=correlation.js.map
|
package/dist/correlation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation.js","sourceRoot":"","sources":["../src/correlation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CACjC,OAA0B,EAC1B,OAA0B;IAE1B,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,IAAI,UAAU,CAAC,+CAA+C,CAAC,CAAC;IACvE,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"correlation.js","sourceRoot":"","sources":["../src/correlation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,cA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
|
|
|
1
|
+
import { type Matrix } from "@ac-kit/math-linear";
|
|
2
|
+
/**
|
|
3
|
+
* The interquartile range `Q₃ − Q₁`, the spread of the middle half of the
|
|
4
|
+
* values: robust to outliers where the standard deviation is not, and the scale
|
|
5
|
+
* of Tukey's fences (`Q₁ − 1.5·IQR`, `Q₃ + 1.5·IQR`). Quartiles by
|
|
6
|
+
* {@link quantile}'s linear interpolation (Hyndman–Fan type 7, R's and NumPy's
|
|
7
|
+
* default). `NaN` for no values. Sorts a copy, O(n log n).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* interquartileRange([1, 2, 3, 4, 5, 6, 7, 8]); // 3.5
|
|
12
|
+
* ```;
|
|
13
|
+
*/
|
|
14
|
+
export declare function interquartileRange(values: readonly number[]): number;
|
|
15
|
+
/**
|
|
16
|
+
* The sample covariance of two paired series, `Σ (xᵢ − x̄)(yᵢ − ȳ) / (n − 1)`,
|
|
17
|
+
* accumulated exactly (`PreciseSum`) around exactly rounded means. `0` for
|
|
18
|
+
* fewer than two pairs, like {@link sampleVariance}.
|
|
19
|
+
*
|
|
20
|
+
* @throws {RangeError} When the series have different lengths.
|
|
21
|
+
*/
|
|
22
|
+
export declare function covariance(x: readonly number[], y: readonly number[]): number;
|
|
23
|
+
/**
|
|
24
|
+
* The sample covariance matrix of `k` variables observed together: entry `(i,
|
|
25
|
+
* j)` is the {@link covariance} of `columns[i]` and `columns[j]`, so the
|
|
26
|
+
* diagonal holds the sample variances. A symmetric `k × k` `Matrix` of
|
|
27
|
+
* `@ac-kit/math-linear`, ready for its decompositions.
|
|
28
|
+
*
|
|
29
|
+
* @throws {RangeError} When the columns have different lengths.
|
|
30
|
+
*/
|
|
31
|
+
export declare function covarianceMatrix(columns: readonly (readonly number[])[]): Matrix;
|
|
32
|
+
/**
|
|
33
|
+
* The coefficient of determination `R² = 1 − SSres / SStot` of predictions
|
|
34
|
+
* against observations: the share of the observations' variance the model
|
|
35
|
+
* explains, `1` for a perfect fit, `0` for one no better than the mean, and
|
|
36
|
+
* negative for one worse than it. `NaN` when the observations do not vary.
|
|
37
|
+
*
|
|
38
|
+
* @throws {RangeError} When the series have different lengths.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rSquared(actual: readonly number[], predicted: readonly number[]): number;
|
|
41
|
+
/**
|
|
42
|
+
* The root-mean-square error `√(Σ (aᵢ − pᵢ)² / n)` of predictions, in the
|
|
43
|
+
* observations' units. `NaN` for no values.
|
|
44
|
+
*
|
|
45
|
+
* @throws {RangeError} When the series have different lengths.
|
|
46
|
+
*/
|
|
47
|
+
export declare function rootMeanSquareError(actual: readonly number[], predicted: readonly number[]): number;
|
|
48
|
+
/**
|
|
49
|
+
* The weighted mean `Σ wᵢxᵢ / Σ wᵢ`, accumulated exactly. `NaN` when the
|
|
50
|
+
* weights sum to zero.
|
|
51
|
+
*
|
|
52
|
+
* @throws {RangeError} When the lengths differ or a weight is negative or not
|
|
53
|
+
* finite.
|
|
54
|
+
*/
|
|
55
|
+
export declare function weightedMean(values: readonly number[], weights: readonly number[]): number;
|
|
56
|
+
/** What kind of weights {@link weightedVariance} takes. */
|
|
57
|
+
export type WeightKind = "frequency" | "reliability";
|
|
58
|
+
/**
|
|
59
|
+
* The weighted variance about the weighted mean. Frequency weights (counts of
|
|
60
|
+
* repeated observations, the default) divide by `Σw − 1`, as the variance of
|
|
61
|
+
* the expanded sample would; reliability weights (inverse variances, or any
|
|
62
|
+
* relative importance) by `Σw − Σw²/Σw`, the unbiased form for them. `NaN` when
|
|
63
|
+
* the divisor is not positive.
|
|
64
|
+
*
|
|
65
|
+
* @throws {RangeError} When the lengths differ or a weight is negative or not
|
|
66
|
+
* finite.
|
|
67
|
+
*/
|
|
68
|
+
export declare function weightedVariance(values: readonly number[], weights: readonly number[], kind?: WeightKind): number;
|
|
69
|
+
/** `√` of {@link weightedVariance}. */
|
|
70
|
+
export declare function weightedStandardDeviation(values: readonly number[], weights: readonly number[], kind?: WeightKind): number;
|
|
71
|
+
/**
|
|
72
|
+
* The z-scores `(xᵢ − x̄) / s` of the values, with the sample standard
|
|
73
|
+
* deviation: centred on 0 with unit variance. All `NaN` when the values do not
|
|
74
|
+
* vary or there are fewer than two.
|
|
75
|
+
*/
|
|
76
|
+
export declare function standardize(values: readonly number[]): Float64Array;
|
|
77
|
+
/**
|
|
78
|
+
* The values rescaled linearly onto `[0, 1]` (min–max normalisation): the
|
|
79
|
+
* smallest becomes 0, the largest 1. All `NaN` when they are all equal.
|
|
80
|
+
*/
|
|
81
|
+
export declare function normalize(values: readonly number[]): Float64Array;
|
|
82
|
+
/**
|
|
83
|
+
* The trailing simple moving average over `window` values: entry `i` is the
|
|
84
|
+
* mean of `values[i − window + 1 … i]`, so the result has `n − window + 1`
|
|
85
|
+
* entries (empty when the window is longer than the series). Each mean is
|
|
86
|
+
* recomputed exactly over its window rather than updated by a running sum,
|
|
87
|
+
* which drifts, at O(n · window).
|
|
88
|
+
*
|
|
89
|
+
* @throws {RangeError} When `window` is not a positive integer.
|
|
90
|
+
*/
|
|
91
|
+
export declare function movingAverage(values: readonly number[], window: number): Float64Array;
|
|
92
|
+
/**
|
|
93
|
+
* Simple exponential smoothing: `sᵢ = α·xᵢ + (1 − α)·sᵢ₋₁` from `s₀ = x₀`, the
|
|
94
|
+
* level of Brown's method (and the one-step forecast of a series with no
|
|
95
|
+
* trend). `alpha` near 1 follows the data, near 0 smooths it heavily.
|
|
96
|
+
*
|
|
97
|
+
* @throws {RangeError} When `alpha` is not in `(0, 1]`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function exponentialSmoothing(values: readonly number[], alpha: number): Float64Array;
|
|
100
|
+
/**
|
|
101
|
+
* A streaming exponential moving average, `m ← m + α (x − m)`, seeded by the
|
|
102
|
+
* first value: a smoothed rate, a load average, a signal level, updated in O(1)
|
|
103
|
+
* per value with no memory of the past. Construct it from `alpha` or from a
|
|
104
|
+
* `halfLife` in samples (`α = 1 − 2^(−1/halfLife)`).
|
|
105
|
+
*/
|
|
106
|
+
export declare class ExponentialMovingAverage {
|
|
107
|
+
/** The smoothing factor, in `(0, 1]`. */
|
|
108
|
+
readonly alpha: number;
|
|
109
|
+
private value_;
|
|
110
|
+
private count_;
|
|
111
|
+
/**
|
|
112
|
+
* @throws {RangeError} When neither or both are given, `alpha` is not in `(0,
|
|
113
|
+
* 1]`, or `halfLife` is not positive.
|
|
114
|
+
*/
|
|
115
|
+
constructor(options: {
|
|
116
|
+
alpha: number;
|
|
117
|
+
} | {
|
|
118
|
+
halfLife: number;
|
|
119
|
+
});
|
|
120
|
+
/** The current average; `NaN` before the first value. */
|
|
121
|
+
get value(): number;
|
|
122
|
+
/** The number of values pushed. */
|
|
123
|
+
get count(): number;
|
|
124
|
+
/** Adds a value and returns the updated average. */
|
|
125
|
+
push(value: number): number;
|
|
126
|
+
/** Forgets every value. */
|
|
127
|
+
reset(): void;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=descriptive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptive.d.ts","sourceRoot":"","sources":["../src/descriptive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAehE;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAMpE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAY7E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GACrC,MAAM,CAWR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACvB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC1B,M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