@sipemu/anofox-statistics 0.4.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/LICENSE +21 -0
- package/README.md +281 -0
- package/anofox_statistics_js.d.ts +744 -0
- package/anofox_statistics_js.js +1758 -0
- package/anofox_statistics_js_bg.wasm +0 -0
- package/package.json +39 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Alternative hypothesis for JavaScript
|
|
6
|
+
*/
|
|
7
|
+
export enum JsAlternative {
|
|
8
|
+
TwoSided = 0,
|
|
9
|
+
Less = 1,
|
|
10
|
+
Greater = 2,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* ANOVA kind for JavaScript
|
|
15
|
+
*/
|
|
16
|
+
export enum JsAnovaKind {
|
|
17
|
+
Fisher = 0,
|
|
18
|
+
Welch = 1,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Correlation TOST method for JavaScript
|
|
23
|
+
*/
|
|
24
|
+
export enum JsCorrelationTostMethod {
|
|
25
|
+
Pearson = 0,
|
|
26
|
+
Spearman = 1,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ICC type for JavaScript
|
|
31
|
+
*/
|
|
32
|
+
export enum JsICCType {
|
|
33
|
+
ICC1 = 0,
|
|
34
|
+
ICC2 = 1,
|
|
35
|
+
ICC3 = 2,
|
|
36
|
+
ICC1k = 3,
|
|
37
|
+
ICC2k = 4,
|
|
38
|
+
ICC3k = 5,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Kendall variant for JavaScript
|
|
43
|
+
*/
|
|
44
|
+
export enum JsKendallVariant {
|
|
45
|
+
TauA = 0,
|
|
46
|
+
TauB = 1,
|
|
47
|
+
TauC = 2,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Kernel type for MMD test
|
|
52
|
+
*/
|
|
53
|
+
export enum JsKernel {
|
|
54
|
+
Gaussian = 0,
|
|
55
|
+
Laplacian = 1,
|
|
56
|
+
Linear = 2,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Loss function for forecast comparison
|
|
61
|
+
*/
|
|
62
|
+
export enum JsLossFunction {
|
|
63
|
+
SquaredError = 0,
|
|
64
|
+
AbsoluteError = 1,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* MCS statistic type
|
|
69
|
+
*/
|
|
70
|
+
export enum JsMCSStatistic {
|
|
71
|
+
Max = 0,
|
|
72
|
+
Range = 1,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* T-test kind for JavaScript
|
|
77
|
+
*/
|
|
78
|
+
export enum JsTTestKind {
|
|
79
|
+
Welch = 0,
|
|
80
|
+
Student = 1,
|
|
81
|
+
Paired = 2,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Variance estimator for forecast tests
|
|
86
|
+
*/
|
|
87
|
+
export enum JsVarEstimator {
|
|
88
|
+
Acf = 0,
|
|
89
|
+
Bartlett = 1,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Exact binomial test.
|
|
94
|
+
*
|
|
95
|
+
* @param successes - Number of successes
|
|
96
|
+
* @param trials - Number of trials
|
|
97
|
+
* @param p0 - Hypothesized probability (default: 0.5)
|
|
98
|
+
* @param alternative - Alternative hypothesis direction
|
|
99
|
+
* @returns Object with p_value, estimate, conf_int_lower, conf_int_upper
|
|
100
|
+
*/
|
|
101
|
+
export function binomTest(successes: number, trials: number, p0: number | null | undefined, alternative: JsAlternative): any;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Brown-Forsythe test for homogeneity of variances.
|
|
105
|
+
*
|
|
106
|
+
* @param groups - Array of groups, each group is a Float64Array
|
|
107
|
+
* @returns Object with statistic, df1, df2, p_value
|
|
108
|
+
*/
|
|
109
|
+
export function brownForsythe(groups: Array<any>): any;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Brunner-Munzel test for stochastic equality.
|
|
113
|
+
*
|
|
114
|
+
* @param x - First sample as Float64Array
|
|
115
|
+
* @param y - Second sample as Float64Array
|
|
116
|
+
* @param alternative - Alternative hypothesis direction
|
|
117
|
+
* @param alpha - If specified, compute CI at (1-alpha) level (e.g., 0.05 for 95% CI)
|
|
118
|
+
* @returns Object with statistic, df, p_value, estimate, conf_int
|
|
119
|
+
*/
|
|
120
|
+
export function brunnerMunzel(x: Float64Array, y: Float64Array, alternative: JsAlternative, alpha?: number | null): any;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Chi-square goodness-of-fit test.
|
|
124
|
+
*
|
|
125
|
+
* @param observed - Observed counts as array of numbers
|
|
126
|
+
* @param expectedProps - Expected proportions as array of numbers (must sum to 1), or null for uniform
|
|
127
|
+
* @returns Object with statistic, df, p_value
|
|
128
|
+
*/
|
|
129
|
+
export function chiSquareGoodnessOfFit(observed: Float64Array, expected_props?: Float64Array | null): any;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Chi-square test for independence.
|
|
133
|
+
*
|
|
134
|
+
* @param observed - 2D array of observed counts (contingency table)
|
|
135
|
+
* @param yatesCorrection - Apply Yates continuity correction for 2x2 tables (default: false)
|
|
136
|
+
* @returns Object with statistic, df, p_value, expected frequencies
|
|
137
|
+
*/
|
|
138
|
+
export function chiSquareTest(observed: Array<any>, yates_correction?: boolean | null): any;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Clark-West test for comparing nested forecast models.
|
|
142
|
+
*
|
|
143
|
+
* @param e1 - Forecast errors from restricted model as Float64Array
|
|
144
|
+
* @param e2 - Forecast errors from unrestricted model as Float64Array
|
|
145
|
+
* @param horizon - Forecast horizon for HAC variance adjustment
|
|
146
|
+
* @returns Object with statistic, p_value, p_value_two_sided
|
|
147
|
+
*/
|
|
148
|
+
export function clarkWest(e1: Float64Array, e2: Float64Array, horizon: number): any;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Cohen's Kappa for inter-rater agreement.
|
|
152
|
+
*
|
|
153
|
+
* @param table - 2D agreement matrix (square, same categories for both raters)
|
|
154
|
+
* @param weighted - Use weighted kappa with linear weights (default: false)
|
|
155
|
+
* @returns Object with kappa, se, z, p_value, conf_int_lower, conf_int_upper, weighted
|
|
156
|
+
*/
|
|
157
|
+
export function cohenKappa(table: Array<any>, weighted?: boolean | null): any;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Contingency coefficient.
|
|
161
|
+
*
|
|
162
|
+
* @param observed - 2D array of observed counts
|
|
163
|
+
* @returns Object with estimate
|
|
164
|
+
*/
|
|
165
|
+
export function contingencyCoefficient(observed: Array<any>): any;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Cramér's V measure of association.
|
|
169
|
+
*
|
|
170
|
+
* @param observed - 2D array of observed counts
|
|
171
|
+
* @returns Object with estimate (Cramér's V)
|
|
172
|
+
*/
|
|
173
|
+
export function cramersV(observed: Array<any>): any;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* D'Agostino-Pearson K² test for normality.
|
|
177
|
+
*
|
|
178
|
+
* Tests normality using both skewness and kurtosis.
|
|
179
|
+
*
|
|
180
|
+
* @param x - Sample data as Float64Array
|
|
181
|
+
* @returns Object with k2_statistic, p_value, skewness_z, kurtosis_z
|
|
182
|
+
*/
|
|
183
|
+
export function dagostinoKSquared(x: Float64Array): any;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Diebold-Mariano test for comparing forecast accuracy.
|
|
187
|
+
*
|
|
188
|
+
* @param e1 - Forecast errors from model 1 as Float64Array
|
|
189
|
+
* @param e2 - Forecast errors from model 2 as Float64Array
|
|
190
|
+
* @param lossFunction - Loss function (SquaredError or AbsoluteError)
|
|
191
|
+
* @param horizon - Forecast horizon (h=1 for 1-step ahead)
|
|
192
|
+
* @param alternative - Alternative hypothesis direction
|
|
193
|
+
* @param varEstimator - Variance estimator (Acf or Bartlett)
|
|
194
|
+
* @returns Object with statistic, p_value, horizon
|
|
195
|
+
*/
|
|
196
|
+
export function dieboldMariano(e1: Float64Array, e2: Float64Array, loss_function: JsLossFunction, horizon: number, alternative: JsAlternative, var_estimator: JsVarEstimator): any;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Distance correlation (measures non-linear dependence).
|
|
200
|
+
*
|
|
201
|
+
* @param x - First variable as Float64Array
|
|
202
|
+
* @param y - Second variable as Float64Array
|
|
203
|
+
* @returns Object with dcor, dcov, dvar_x, dvar_y, statistic
|
|
204
|
+
*/
|
|
205
|
+
export function distanceCorrelation(x: Float64Array, y: Float64Array): any;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Distance correlation with permutation test.
|
|
209
|
+
*
|
|
210
|
+
* @param x - First variable as Float64Array
|
|
211
|
+
* @param y - Second variable as Float64Array
|
|
212
|
+
* @param nPermutations - Number of permutations (default: 999)
|
|
213
|
+
* @param seed - Random seed (optional)
|
|
214
|
+
* @returns Object with dcor, statistic, p_value
|
|
215
|
+
*/
|
|
216
|
+
export function distanceCorrelationTest(x: Float64Array, y: Float64Array, n_permutations?: number | null, seed?: bigint | null): any;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Energy distance two-sample test (multivariate data).
|
|
220
|
+
*
|
|
221
|
+
* @param x - First sample as 2D array (each row is an observation)
|
|
222
|
+
* @param y - Second sample as 2D array
|
|
223
|
+
* @param nPermutations - Number of permutations (default: 999)
|
|
224
|
+
* @param seed - Random seed (optional)
|
|
225
|
+
* @returns Object with statistic, p_value, n_permutations
|
|
226
|
+
*/
|
|
227
|
+
export function energyDistanceTest(x: Array<any>, y: Array<any>, n_permutations?: number | null, seed?: bigint | null): any;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Energy distance two-sample test (1D data).
|
|
231
|
+
*
|
|
232
|
+
* Tests if two samples come from the same distribution using energy distance.
|
|
233
|
+
*
|
|
234
|
+
* @param x - First sample as Float64Array
|
|
235
|
+
* @param y - Second sample as Float64Array
|
|
236
|
+
* @param nPermutations - Number of permutations (default: 999)
|
|
237
|
+
* @param seed - Random seed (optional)
|
|
238
|
+
* @returns Object with statistic, p_value, n_permutations
|
|
239
|
+
*/
|
|
240
|
+
export function energyDistanceTest1d(x: Float64Array, y: Float64Array, n_permutations?: number | null, seed?: bigint | null): any;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Fisher's exact test for 2x2 contingency tables.
|
|
244
|
+
*
|
|
245
|
+
* @param table - 2x2 contingency table as [[a, b], [c, d]]
|
|
246
|
+
* @param alternative - Alternative hypothesis direction
|
|
247
|
+
* @returns Object with odds_ratio, p_value, conf_int_lower, conf_int_upper
|
|
248
|
+
*/
|
|
249
|
+
export function fisherExact(table: Array<any>, alternative: JsAlternative): any;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* G-test (likelihood ratio test) for independence.
|
|
253
|
+
*
|
|
254
|
+
* @param observed - 2D array of observed counts (contingency table)
|
|
255
|
+
* @returns Object with statistic, df, p_value, expected frequencies
|
|
256
|
+
*/
|
|
257
|
+
export function gTest(observed: Array<any>): any;
|
|
258
|
+
|
|
259
|
+
export function getVersion(): string;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Intraclass correlation coefficient.
|
|
263
|
+
*
|
|
264
|
+
* @param data - 2D array where rows are subjects and columns are raters
|
|
265
|
+
* @param iccType - ICC type (ICC1, ICC2, ICC3, ICC1k, ICC2k, ICC3k)
|
|
266
|
+
* @returns Object with icc, f_value, df1, df2, p_value, conf_int_lower, conf_int_upper
|
|
267
|
+
*/
|
|
268
|
+
export function intraclassCorrelation(data: Array<any>, icc_type: JsICCType): any;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Kendall's tau correlation coefficient.
|
|
272
|
+
*
|
|
273
|
+
* @param x - First variable as Float64Array
|
|
274
|
+
* @param y - Second variable as Float64Array
|
|
275
|
+
* @param variant - Tau variant (TauA, TauB, TauC)
|
|
276
|
+
* @returns Object with estimate, statistic, p_value, conf_int
|
|
277
|
+
*/
|
|
278
|
+
export function kendallCorrelation(x: Float64Array, y: Float64Array, variant: JsKendallVariant): any;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Kruskal-Wallis H test (non-parametric one-way ANOVA).
|
|
282
|
+
*
|
|
283
|
+
* @param groups - Array of groups, each group is a Float64Array
|
|
284
|
+
* @returns Object with statistic (H), df, p_value
|
|
285
|
+
*/
|
|
286
|
+
export function kruskalWallis(groups: Array<any>): any;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Mann-Whitney U test (Wilcoxon rank-sum test).
|
|
290
|
+
*
|
|
291
|
+
* @param x - First sample as Float64Array
|
|
292
|
+
* @param y - Second sample as Float64Array
|
|
293
|
+
* @param alternative - Alternative hypothesis direction
|
|
294
|
+
* @param continuityCorrectionParam - Whether to apply continuity correction (default: true)
|
|
295
|
+
* @param exact - Whether to compute exact p-value (default: false)
|
|
296
|
+
* @param confLevel - Confidence level for Hodges-Lehmann CI (optional)
|
|
297
|
+
* @param mu - Location shift under H0 (default: 0)
|
|
298
|
+
* @returns Object with statistic, p_value, estimate, null_value, conf_int
|
|
299
|
+
*/
|
|
300
|
+
export function mannWhitneyU(x: Float64Array, y: Float64Array, alternative: JsAlternative, continuity_correction?: boolean | null, exact?: boolean | null, conf_level?: number | null, mu?: number | null): any;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* McNemar's exact test for paired proportions (small samples).
|
|
304
|
+
*
|
|
305
|
+
* @param table - 2x2 paired table as [[a, b], [c, d]]
|
|
306
|
+
* @returns Object with p_value, b, c
|
|
307
|
+
*/
|
|
308
|
+
export function mcnemarExact(table: Array<any>): any;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* McNemar's test for paired proportions.
|
|
312
|
+
*
|
|
313
|
+
* @param table - 2x2 paired table as [[a, b], [c, d]]
|
|
314
|
+
* @param correction - Apply continuity correction (default: true)
|
|
315
|
+
* @returns Object with statistic, df, p_value
|
|
316
|
+
*/
|
|
317
|
+
export function mcnemarTest(table: Array<any>, correction?: boolean | null): any;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Maximum Mean Discrepancy two-sample test (multivariate data).
|
|
321
|
+
*
|
|
322
|
+
* @param x - First sample as 2D array
|
|
323
|
+
* @param y - Second sample as 2D array
|
|
324
|
+
* @param kernel - Kernel type (Gaussian, Laplacian, or Linear)
|
|
325
|
+
* @param bandwidth - Kernel bandwidth (required for Gaussian and Laplacian)
|
|
326
|
+
* @param nPermutations - Number of permutations (default: 999)
|
|
327
|
+
* @param seed - Random seed (optional)
|
|
328
|
+
* @returns Object with statistic, p_value, n_permutations
|
|
329
|
+
*/
|
|
330
|
+
export function mmdTest(x: Array<any>, y: Array<any>, kernel: JsKernel, bandwidth?: number | null, n_permutations?: number | null, seed?: bigint | null): any;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Maximum Mean Discrepancy two-sample test (1D data).
|
|
334
|
+
*
|
|
335
|
+
* Uses median heuristic for bandwidth selection automatically.
|
|
336
|
+
*
|
|
337
|
+
* @param x - First sample as Float64Array
|
|
338
|
+
* @param y - Second sample as Float64Array
|
|
339
|
+
* @param nPermutations - Number of permutations (default: 999)
|
|
340
|
+
* @param seed - Random seed (optional)
|
|
341
|
+
* @returns Object with statistic, p_value, n_permutations
|
|
342
|
+
*/
|
|
343
|
+
export function mmdTest1d(x: Float64Array, y: Float64Array, n_permutations?: number | null, seed?: bigint | null): any;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Model Confidence Set (MCS) procedure.
|
|
347
|
+
*
|
|
348
|
+
* Identifies the set of models that contains the best model with a given confidence.
|
|
349
|
+
*
|
|
350
|
+
* @param losses - Array of loss value arrays (one per model)
|
|
351
|
+
* @param alpha - Significance level (default: 0.1)
|
|
352
|
+
* @param statistic - MCS statistic (TMax or TR)
|
|
353
|
+
* @param nBootstrap - Number of bootstrap samples (default: 1000)
|
|
354
|
+
* @param blockLength - Expected block length for stationary bootstrap
|
|
355
|
+
* @param seed - Random seed (optional)
|
|
356
|
+
* @returns Object with included_models, excluded_models, p_values, elimination_order
|
|
357
|
+
*/
|
|
358
|
+
export function modelConfidenceSet(losses: Array<any>, alpha: number | null | undefined, statistic: JsMCSStatistic, n_bootstrap: number | null | undefined, block_length: number, seed?: bigint | null): any;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* MSPE-adjusted SPA test.
|
|
362
|
+
*
|
|
363
|
+
* @param benchmarkErrors - Forecast errors from benchmark model as Float64Array
|
|
364
|
+
* @param modelErrors - Array of forecast error arrays from alternative models
|
|
365
|
+
* @param nBootstrap - Number of bootstrap samples (default: 1000)
|
|
366
|
+
* @param blockLength - Expected block length for stationary bootstrap
|
|
367
|
+
* @param seed - Random seed (optional)
|
|
368
|
+
* @returns Object with statistic, p_value_consistent, p_value_upper
|
|
369
|
+
*/
|
|
370
|
+
export function mspeAdjustedSpa(benchmark_errors: Float64Array, model_errors: Array<any>, n_bootstrap: number | null | undefined, block_length: number, seed?: bigint | null): any;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* One-way ANOVA test.
|
|
374
|
+
*
|
|
375
|
+
* @param groups - Array of groups, each group is a Float64Array
|
|
376
|
+
* @param kind - Type of ANOVA (Fisher or Welch)
|
|
377
|
+
* @returns Object with statistic, df_between, df_within, p_value, SS and MS components
|
|
378
|
+
*/
|
|
379
|
+
export function oneWayAnova(groups: Array<any>, kind: JsAnovaKind): any;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Partial correlation controlling for confounders.
|
|
383
|
+
*
|
|
384
|
+
* @param x - First variable as Float64Array
|
|
385
|
+
* @param y - Second variable as Float64Array
|
|
386
|
+
* @param z - Array of confounding variables (each as Float64Array)
|
|
387
|
+
* @returns Object with estimate, statistic, df, p_value
|
|
388
|
+
*/
|
|
389
|
+
export function partialCorrelation(x: Float64Array, y: Float64Array, z: Array<any>): any;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Pearson correlation coefficient with significance test.
|
|
393
|
+
*
|
|
394
|
+
* @param x - First variable as Float64Array
|
|
395
|
+
* @param y - Second variable as Float64Array
|
|
396
|
+
* @param confLevel - Confidence level for CI (optional, e.g., 0.95)
|
|
397
|
+
* @returns Object with estimate, statistic, df, p_value, conf_int
|
|
398
|
+
*/
|
|
399
|
+
export function pearsonCorrelation(x: Float64Array, y: Float64Array, conf_level?: number | null): any;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Permutation t-test.
|
|
403
|
+
*
|
|
404
|
+
* @param x - First sample as Float64Array
|
|
405
|
+
* @param y - Second sample as Float64Array
|
|
406
|
+
* @param alternative - Alternative hypothesis direction
|
|
407
|
+
* @param nPermutations - Number of permutations (default: 9999)
|
|
408
|
+
* @param seed - Random seed (optional)
|
|
409
|
+
* @returns Object with statistic, p_value, n_permutations
|
|
410
|
+
*/
|
|
411
|
+
export function permutationTTest(x: Float64Array, y: Float64Array, alternative: JsAlternative, n_permutations?: number | null, seed?: bigint | null): any;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Phi coefficient for 2x2 tables.
|
|
415
|
+
*
|
|
416
|
+
* @param table - 2x2 contingency table as [[a, b], [c, d]]
|
|
417
|
+
* @returns Object with estimate (phi coefficient)
|
|
418
|
+
*/
|
|
419
|
+
export function phiCoefficient(table: Array<any>): any;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* One-sample proportion test.
|
|
423
|
+
*
|
|
424
|
+
* @param successes - Number of successes
|
|
425
|
+
* @param trials - Number of trials
|
|
426
|
+
* @param p0 - Hypothesized probability
|
|
427
|
+
* @param alternative - Alternative hypothesis direction
|
|
428
|
+
* @returns Object with statistic, p_value, estimate, conf_int_lower, conf_int_upper
|
|
429
|
+
*/
|
|
430
|
+
export function propTestOne(successes: number, trials: number, p0: number, alternative: JsAlternative): any;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Two-sample proportion test.
|
|
434
|
+
*
|
|
435
|
+
* @param successes1 - Number of successes in group 1
|
|
436
|
+
* @param trials1 - Number of trials in group 1
|
|
437
|
+
* @param successes2 - Number of successes in group 2
|
|
438
|
+
* @param trials2 - Number of trials in group 2
|
|
439
|
+
* @param alternative - Alternative hypothesis direction
|
|
440
|
+
* @param correction - Apply Yates' continuity correction (default: false)
|
|
441
|
+
* @returns Object with statistic, p_value, estimates, conf_int_lower, conf_int_upper
|
|
442
|
+
*/
|
|
443
|
+
export function propTestTwo(successes1: number, trials1: number, successes2: number, trials2: number, alternative: JsAlternative, correction?: boolean | null): any;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Semi-partial (part) correlation.
|
|
447
|
+
*
|
|
448
|
+
* @param x - First variable as Float64Array
|
|
449
|
+
* @param y - Second variable as Float64Array
|
|
450
|
+
* @param z - Array of confounding variables to control for x only (each as Float64Array)
|
|
451
|
+
* @returns Object with estimate, statistic, df, p_value
|
|
452
|
+
*/
|
|
453
|
+
export function semiPartialCorrelation(x: Float64Array, y: Float64Array, z: Array<any>): any;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Shapiro-Wilk test for normality.
|
|
457
|
+
*
|
|
458
|
+
* @param x - Sample data as Float64Array
|
|
459
|
+
* @returns Object with statistic (W) and p_value
|
|
460
|
+
*/
|
|
461
|
+
export function shapiroWilk(x: Float64Array): any;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Superior Predictive Ability (SPA) test.
|
|
465
|
+
*
|
|
466
|
+
* Tests if a benchmark forecast is not inferior to a set of alternative forecasts.
|
|
467
|
+
*
|
|
468
|
+
* @param benchmarkLosses - Loss values from benchmark model as Float64Array
|
|
469
|
+
* @param modelLosses - Array of loss value arrays from competing models
|
|
470
|
+
* @param nBootstrap - Number of bootstrap samples (default: 1000)
|
|
471
|
+
* @param blockLength - Expected block length for stationary bootstrap
|
|
472
|
+
* @param seed - Random seed (optional)
|
|
473
|
+
* @returns Object with statistic, p_values, best_model_idx
|
|
474
|
+
*/
|
|
475
|
+
export function spaTest(benchmark_losses: Float64Array, model_losses: Array<any>, n_bootstrap: number | null | undefined, block_length: number, seed?: bigint | null): any;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Spearman rank correlation coefficient with significance test.
|
|
479
|
+
*
|
|
480
|
+
* @param x - First variable as Float64Array
|
|
481
|
+
* @param y - Second variable as Float64Array
|
|
482
|
+
* @param confLevel - Confidence level for CI (optional)
|
|
483
|
+
* @returns Object with estimate, statistic, df, p_value, conf_int
|
|
484
|
+
*/
|
|
485
|
+
export function spearmanCorrelation(x: Float64Array, y: Float64Array, conf_level?: number | null): any;
|
|
486
|
+
|
|
487
|
+
export function start(): void;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Perform a t-test comparing two samples.
|
|
491
|
+
*
|
|
492
|
+
* @param x - First sample as Float64Array
|
|
493
|
+
* @param y - Second sample as Float64Array
|
|
494
|
+
* @param kind - Type of t-test (Welch, Student, or Paired)
|
|
495
|
+
* @param alternative - Alternative hypothesis direction
|
|
496
|
+
* @param mu - Null hypothesis value (default: 0.0)
|
|
497
|
+
* @param confLevel - Confidence level for CI (optional, e.g., 0.95)
|
|
498
|
+
* @returns Object with statistic, df, p_value, mean_x, mean_y, conf_int
|
|
499
|
+
*/
|
|
500
|
+
export function tTest(x: Float64Array, y: Float64Array, kind: JsTTestKind, alternative: JsAlternative, mu?: number | null, conf_level?: number | null): any;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* TOST using bootstrap resampling.
|
|
504
|
+
*
|
|
505
|
+
* @param x - First sample as Float64Array
|
|
506
|
+
* @param y - Second sample as Float64Array
|
|
507
|
+
* @param lowerBound - Lower equivalence bound
|
|
508
|
+
* @param upperBound - Upper equivalence bound
|
|
509
|
+
* @param alpha - Significance level (default: 0.05)
|
|
510
|
+
* @param nBootstrap - Number of bootstrap samples (default: 1000)
|
|
511
|
+
* @param seed - Random seed (optional)
|
|
512
|
+
* @returns TOST result object
|
|
513
|
+
*/
|
|
514
|
+
export function tostBootstrap(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, alpha?: number | null, n_bootstrap?: number | null, seed?: bigint | null): any;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* TOST for correlation equivalence.
|
|
518
|
+
*
|
|
519
|
+
* @param x - First variable as Float64Array
|
|
520
|
+
* @param y - Second variable as Float64Array
|
|
521
|
+
* @param rhoNull - Null value for correlation (usually 0)
|
|
522
|
+
* @param lowerBound - Lower equivalence bound for correlation (e.g., -0.1)
|
|
523
|
+
* @param upperBound - Upper equivalence bound for correlation (e.g., 0.1)
|
|
524
|
+
* @param method - Correlation method (Pearson or Spearman)
|
|
525
|
+
* @param alpha - Significance level (default: 0.05)
|
|
526
|
+
* @returns TOST result object
|
|
527
|
+
*/
|
|
528
|
+
export function tostCorrelation(x: Float64Array, y: Float64Array, rho_null: number, lower_bound: number, upper_bound: number, method: JsCorrelationTostMethod, alpha?: number | null): any;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* TOST for one-sample proportion.
|
|
532
|
+
*
|
|
533
|
+
* @param successes - Number of successes
|
|
534
|
+
* @param trials - Number of trials
|
|
535
|
+
* @param p0 - Hypothesized proportion
|
|
536
|
+
* @param lowerBound - Lower equivalence bound
|
|
537
|
+
* @param upperBound - Upper equivalence bound
|
|
538
|
+
* @param alpha - Significance level (default: 0.05)
|
|
539
|
+
* @returns TOST result object
|
|
540
|
+
*/
|
|
541
|
+
export function tostPropOne(successes: number, trials: number, p0: number, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* TOST for two-sample proportions.
|
|
545
|
+
*
|
|
546
|
+
* @param successes1 - Successes in group 1
|
|
547
|
+
* @param trials1 - Trials in group 1
|
|
548
|
+
* @param successes2 - Successes in group 2
|
|
549
|
+
* @param trials2 - Trials in group 2
|
|
550
|
+
* @param lowerBound - Lower equivalence bound
|
|
551
|
+
* @param upperBound - Upper equivalence bound
|
|
552
|
+
* @param alpha - Significance level (default: 0.05)
|
|
553
|
+
* @returns TOST result object
|
|
554
|
+
*/
|
|
555
|
+
export function tostPropTwo(successes1: number, trials1: number, successes2: number, trials2: number, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* TOST t-test for one sample.
|
|
559
|
+
*
|
|
560
|
+
* @param x - Sample data as Float64Array
|
|
561
|
+
* @param mu - Hypothesized mean
|
|
562
|
+
* @param lowerBound - Lower equivalence bound (e.g., -0.5)
|
|
563
|
+
* @param upperBound - Upper equivalence bound (e.g., 0.5)
|
|
564
|
+
* @param alpha - Significance level (default: 0.05)
|
|
565
|
+
* @returns TOST result object
|
|
566
|
+
*/
|
|
567
|
+
export function tostTTestOneSample(x: Float64Array, mu: number, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* TOST t-test for paired samples.
|
|
571
|
+
*
|
|
572
|
+
* @param x - First sample as Float64Array
|
|
573
|
+
* @param y - Second sample as Float64Array
|
|
574
|
+
* @param lowerBound - Lower equivalence bound
|
|
575
|
+
* @param upperBound - Upper equivalence bound
|
|
576
|
+
* @param alpha - Significance level (default: 0.05)
|
|
577
|
+
* @returns TOST result object
|
|
578
|
+
*/
|
|
579
|
+
export function tostTTestPaired(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* TOST t-test for two independent samples.
|
|
583
|
+
*
|
|
584
|
+
* @param x - First sample as Float64Array
|
|
585
|
+
* @param y - Second sample as Float64Array
|
|
586
|
+
* @param lowerBound - Lower equivalence bound
|
|
587
|
+
* @param upperBound - Upper equivalence bound
|
|
588
|
+
* @param alpha - Significance level (default: 0.05)
|
|
589
|
+
* @param pooled - Use pooled variance (default: false for Welch)
|
|
590
|
+
* @returns TOST result object
|
|
591
|
+
*/
|
|
592
|
+
export function tostTTestTwoSample(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, alpha?: number | null, pooled?: boolean | null): any;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* TOST Wilcoxon test for paired samples.
|
|
596
|
+
*
|
|
597
|
+
* @param x - First sample as Float64Array
|
|
598
|
+
* @param y - Second sample as Float64Array
|
|
599
|
+
* @param lowerBound - Lower equivalence bound
|
|
600
|
+
* @param upperBound - Upper equivalence bound
|
|
601
|
+
* @param alpha - Significance level (default: 0.05)
|
|
602
|
+
* @returns TOST result object
|
|
603
|
+
*/
|
|
604
|
+
export function tostWilcoxonPaired(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* TOST Wilcoxon test for two independent samples.
|
|
608
|
+
*
|
|
609
|
+
* @param x - First sample as Float64Array
|
|
610
|
+
* @param y - Second sample as Float64Array
|
|
611
|
+
* @param lowerBound - Lower equivalence bound
|
|
612
|
+
* @param upperBound - Upper equivalence bound
|
|
613
|
+
* @param alpha - Significance level (default: 0.05)
|
|
614
|
+
* @returns TOST result object
|
|
615
|
+
*/
|
|
616
|
+
export function tostWilcoxonTwoSample(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, alpha?: number | null): any;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* TOST Yuen test using trimmed means.
|
|
620
|
+
*
|
|
621
|
+
* @param x - First sample as Float64Array
|
|
622
|
+
* @param y - Second sample as Float64Array
|
|
623
|
+
* @param lowerBound - Lower equivalence bound
|
|
624
|
+
* @param upperBound - Upper equivalence bound
|
|
625
|
+
* @param trim - Trim proportion (default: 0.2)
|
|
626
|
+
* @param alpha - Significance level (default: 0.05)
|
|
627
|
+
* @returns TOST result object
|
|
628
|
+
*/
|
|
629
|
+
export function tostYuen(x: Float64Array, y: Float64Array, lower_bound: number, upper_bound: number, trim?: number | null, alpha?: number | null): any;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Wilcoxon signed-rank test.
|
|
633
|
+
*
|
|
634
|
+
* @param x - First sample as Float64Array
|
|
635
|
+
* @param y - Second sample as Float64Array (optional, for paired test)
|
|
636
|
+
* @param alternative - Alternative hypothesis direction
|
|
637
|
+
* @param continuityCorrectionParam - Whether to apply continuity correction (default: true)
|
|
638
|
+
* @param exact - Whether to compute exact p-value (default: false)
|
|
639
|
+
* @param confLevel - Confidence level for CI (optional)
|
|
640
|
+
* @param mu - Null hypothesis value (default: 0.0)
|
|
641
|
+
* @returns Object with statistic, p_value, estimate, null_value, conf_int
|
|
642
|
+
*/
|
|
643
|
+
export function wilcoxonSignedRank(x: Float64Array, y: Float64Array, alternative: JsAlternative, continuity_correction?: boolean | null, exact?: boolean | null, conf_level?: number | null, mu?: number | null): any;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Yuen's test for trimmed means (robust alternative to t-test).
|
|
647
|
+
*
|
|
648
|
+
* @param x - First sample as Float64Array
|
|
649
|
+
* @param y - Second sample as Float64Array
|
|
650
|
+
* @param trim - Trim proportion (default: 0.2 for 20% trimming)
|
|
651
|
+
* @param alternative - Alternative hypothesis direction
|
|
652
|
+
* @param confLevel - Confidence level for CI (optional)
|
|
653
|
+
* @returns Object with statistic, df, p_value, diff, trimmed_mean_x, trimmed_mean_y
|
|
654
|
+
*/
|
|
655
|
+
export function yuenTest(x: Float64Array, y: Float64Array, trim: number | null | undefined, alternative: JsAlternative, conf_level?: number | null): any;
|
|
656
|
+
|
|
657
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
658
|
+
|
|
659
|
+
export interface InitOutput {
|
|
660
|
+
readonly memory: WebAssembly.Memory;
|
|
661
|
+
readonly binomTest: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
662
|
+
readonly chiSquareGoodnessOfFit: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
663
|
+
readonly chiSquareTest: (a: any, b: number) => [number, number, number];
|
|
664
|
+
readonly cohenKappa: (a: any, b: number) => [number, number, number];
|
|
665
|
+
readonly contingencyCoefficient: (a: any) => [number, number, number];
|
|
666
|
+
readonly cramersV: (a: any) => [number, number, number];
|
|
667
|
+
readonly fisherExact: (a: any, b: number) => [number, number, number];
|
|
668
|
+
readonly gTest: (a: any) => [number, number, number];
|
|
669
|
+
readonly mcnemarExact: (a: any) => [number, number, number];
|
|
670
|
+
readonly mcnemarTest: (a: any, b: number) => [number, number, number];
|
|
671
|
+
readonly phiCoefficient: (a: any) => [number, number, number];
|
|
672
|
+
readonly propTestOne: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
673
|
+
readonly propTestTwo: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
674
|
+
readonly tostBootstrap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: bigint) => [number, number, number];
|
|
675
|
+
readonly tostCorrelation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
676
|
+
readonly tostPropOne: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
677
|
+
readonly tostPropTwo: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
678
|
+
readonly tostTTestOneSample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
679
|
+
readonly tostTTestPaired: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
680
|
+
readonly tostTTestTwoSample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
681
|
+
readonly tostWilcoxonPaired: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
682
|
+
readonly tostWilcoxonTwoSample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
683
|
+
readonly tostYuen: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
684
|
+
readonly distanceCorrelation: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
685
|
+
readonly distanceCorrelationTest: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number, number];
|
|
686
|
+
readonly intraclassCorrelation: (a: any, b: number) => [number, number, number];
|
|
687
|
+
readonly kendallCorrelation: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
688
|
+
readonly partialCorrelation: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
689
|
+
readonly pearsonCorrelation: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
690
|
+
readonly semiPartialCorrelation: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
691
|
+
readonly spearmanCorrelation: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
692
|
+
readonly clarkWest: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
693
|
+
readonly dieboldMariano: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
694
|
+
readonly modelConfidenceSet: (a: any, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => [number, number, number];
|
|
695
|
+
readonly mspeAdjustedSpa: (a: number, b: number, c: any, d: number, e: number, f: number, g: bigint) => [number, number, number];
|
|
696
|
+
readonly spaTest: (a: number, b: number, c: any, d: number, e: number, f: number, g: bigint) => [number, number, number];
|
|
697
|
+
readonly brownForsythe: (a: any) => [number, number, number];
|
|
698
|
+
readonly oneWayAnova: (a: any, b: number) => [number, number, number];
|
|
699
|
+
readonly tTest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
700
|
+
readonly yuenTest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
701
|
+
readonly brunnerMunzel: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
702
|
+
readonly kruskalWallis: (a: any) => [number, number, number];
|
|
703
|
+
readonly mannWhitneyU: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
|
|
704
|
+
readonly wilcoxonSignedRank: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
|
|
705
|
+
readonly energyDistanceTest: (a: any, b: any, c: number, d: number, e: bigint) => [number, number, number];
|
|
706
|
+
readonly energyDistanceTest1d: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number, number];
|
|
707
|
+
readonly mmdTest: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: bigint) => [number, number, number];
|
|
708
|
+
readonly mmdTest1d: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number, number];
|
|
709
|
+
readonly dagostinoKSquared: (a: number, b: number) => [number, number, number];
|
|
710
|
+
readonly getVersion: () => [number, number];
|
|
711
|
+
readonly permutationTTest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => [number, number, number];
|
|
712
|
+
readonly shapiroWilk: (a: number, b: number) => [number, number, number];
|
|
713
|
+
readonly start: () => void;
|
|
714
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
715
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
716
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
717
|
+
readonly __externref_table_alloc: () => number;
|
|
718
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
719
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
720
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
721
|
+
readonly __wbindgen_start: () => void;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
728
|
+
* a precompiled `WebAssembly.Module`.
|
|
729
|
+
*
|
|
730
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
731
|
+
*
|
|
732
|
+
* @returns {InitOutput}
|
|
733
|
+
*/
|
|
734
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
738
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
739
|
+
*
|
|
740
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
741
|
+
*
|
|
742
|
+
* @returns {Promise<InitOutput>}
|
|
743
|
+
*/
|
|
744
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|