@danielsimonjr/mathts-functions 0.14.0 → 0.16.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/dist/descriptive-stats.d.ts +64 -0
- package/dist/descriptive-stats.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +975 -34
- package/dist/typed/dist-objects.d.ts +66 -0
- package/dist/typed/dist-objects.d.ts.map +1 -1
- package/dist/typed/hypothesis.d.ts +194 -0
- package/dist/typed/hypothesis.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -215,5 +215,71 @@ export declare function uniformDist(a?: f64, b?: f64): Distribution;
|
|
|
215
215
|
* d.mean // sqrt(pi) / 2
|
|
216
216
|
*/
|
|
217
217
|
export declare function weibullDist(k: f64, lambda?: f64): Distribution;
|
|
218
|
+
/**
|
|
219
|
+
* Hypergeometric distribution — the number of successes in `draws` samples drawn
|
|
220
|
+
* WITHOUT replacement from a `population` containing `successes` successes.
|
|
221
|
+
* `hypergeometricDist(population, successes, draws)` matches
|
|
222
|
+
* `scipy.stats.hypergeom(M=population, n=successes, N=draws)`.
|
|
223
|
+
*
|
|
224
|
+
* @example hypergeometricDist(50, 5, 10).pmf(1) // 0.4313371972
|
|
225
|
+
*/
|
|
226
|
+
export declare function hypergeometricDist(population: number, successes: number, draws: number): Distribution;
|
|
227
|
+
/**
|
|
228
|
+
* Negative-binomial distribution — the number of failures before the `r`-th
|
|
229
|
+
* success in i.i.d. Bernoulli(`p`) trials. `negativeBinomialDist(r, p)` matches
|
|
230
|
+
* `scipy.stats.nbinom(r, p)` (integer `r`).
|
|
231
|
+
*
|
|
232
|
+
* @example negativeBinomialDist(5, 0.4).pmf(3) // 0.0774144
|
|
233
|
+
*/
|
|
234
|
+
export declare function negativeBinomialDist(r: number, p: f64): Distribution;
|
|
235
|
+
/**
|
|
236
|
+
* Pareto distribution (shape `b` > 0, scale `xm` > 0) — `scipy.stats.pareto(b, scale=xm)`.
|
|
237
|
+
* @example paretoDist(3, 2).cdf(4) // 0.875
|
|
238
|
+
*/
|
|
239
|
+
export declare function paretoDist(b: number, xm: number): Distribution;
|
|
240
|
+
/**
|
|
241
|
+
* Rayleigh distribution (scale `sigma` > 0) — `scipy.stats.rayleigh(scale=sigma)`.
|
|
242
|
+
* @example rayleighDist(2).mean // 2.5066282746
|
|
243
|
+
*/
|
|
244
|
+
export declare function rayleighDist(sigma: number): Distribution;
|
|
245
|
+
/**
|
|
246
|
+
* Triangular distribution on `[a, b]` with mode `c` — matches
|
|
247
|
+
* `scipy.stats.triang((c-a)/(b-a), loc=a, scale=b-a)`.
|
|
248
|
+
* @example triangularDist(0, 4, 6).mean // 3.3333333333
|
|
249
|
+
*/
|
|
250
|
+
export declare function triangularDist(a: number, c: number, b: number): Distribution;
|
|
251
|
+
/**
|
|
252
|
+
* Discrete uniform distribution on the integers `lo..hi` (inclusive) — matches
|
|
253
|
+
* `scipy.stats.randint(lo, hi+1)`.
|
|
254
|
+
* @example discreteUniformDist(1, 6).pmf(3) // 0.1666666667
|
|
255
|
+
*/
|
|
256
|
+
export declare function discreteUniformDist(lo: number, hi: number): Distribution;
|
|
257
|
+
/**
|
|
258
|
+
* Gumbel (right / maximum) distribution (location `mu`, scale `beta` > 0) —
|
|
259
|
+
* `scipy.stats.gumbel_r(loc=mu, scale=beta)`.
|
|
260
|
+
* @example gumbelDist(1, 2).cdf(3) // 0.6922006276
|
|
261
|
+
*/
|
|
262
|
+
export declare function gumbelDist(mu: number, beta: number): Distribution;
|
|
263
|
+
/**
|
|
264
|
+
* Inverse-Gaussian (Wald) distribution — mean `mu` > 0, shape `lambda` > 0.
|
|
265
|
+
* Matches `scipy.stats.invgauss(mu, scale=lambda)` where the scipy mean is
|
|
266
|
+
* `mu*scale`; here `mu` is the actual mean directly.
|
|
267
|
+
* @example invGaussDist(1, 1).pdf(1) // 0.3989422804
|
|
268
|
+
*/
|
|
269
|
+
export declare function invGaussDist(mu: number, lambda: number): Distribution;
|
|
270
|
+
/** A multivariate distribution exposing a density function. */
|
|
271
|
+
export interface MultivariateDistribution {
|
|
272
|
+
pdf: (x: number[]) => f64;
|
|
273
|
+
mean: number[];
|
|
274
|
+
cov: number[][];
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Multivariate normal distribution with the given `mean` vector and `cov`
|
|
278
|
+
* covariance matrix. Density via a Cholesky factorization (stable log-det +
|
|
279
|
+
* triangular solve). Matches `scipy.stats.multivariate_normal(mean, cov).pdf`.
|
|
280
|
+
*
|
|
281
|
+
* @example multivariateNormal([0, 0], [[1, 0.5],[0.5, 2]]).pdf([0, 0]) // 0.1203098284
|
|
282
|
+
*/
|
|
283
|
+
export declare function multivariateNormal(mean: number[], cov: number[][]): MultivariateDistribution;
|
|
218
284
|
export {};
|
|
219
285
|
//# sourceMappingURL=dist-objects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-objects.d.ts","sourceRoot":"","sources":["../../src/typed/dist-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,0CAA0C;AAC1C,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,SAAU,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;IACrB,uCAAuC;IACvC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;IACrB,sCAAsC;IACtC,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;IAC1B,wBAAwB;IACx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export declare function principalComponentAnalysis(data: f64[][], k?: number): PCAResult;
|
|
273
|
+
/**
|
|
274
|
+
* Two-sample Kolmogorov–Smirnov test: are two samples drawn from the same
|
|
275
|
+
* continuous distribution? The statistic is the maximum gap between the two
|
|
276
|
+
* empirical CDFs, D = maxₓ |F₁(x) − F₂(x)|; the p-value is the large-sample
|
|
277
|
+
* asymptotic Q(√(n₁n₂/(n₁+n₂))·D) (the `kstwobign` survival function, matching
|
|
278
|
+
* scipy's asymptotic method for large n). Distinct from the one-sample
|
|
279
|
+
* {@link kolmogorovSmirnovTest}, which compares one sample to a CDF *function*.
|
|
280
|
+
*
|
|
281
|
+
* @param sample1 - first sample (non-empty)
|
|
282
|
+
* @param sample2 - second sample (non-empty)
|
|
283
|
+
* @returns `{ statistic: D, pValue }`
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* kolmogorovSmirnov2Test([0.1, 0.4, 0.6], [0.3, 0.5, 0.9]) // { statistic, pValue }
|
|
287
|
+
*/
|
|
288
|
+
export declare function kolmogorovSmirnov2Test(sample1: f64[], sample2: f64[]): KSTestResult;
|
|
289
|
+
/** Variance-homogeneity test result. `degreesOfFreedom` is `[d1, d2]` for the
|
|
290
|
+
* F-based Levene test, a single number for the χ²-based Bartlett test. */
|
|
291
|
+
export interface VarianceTestResult {
|
|
292
|
+
statistic: f64;
|
|
293
|
+
pValue: f64;
|
|
294
|
+
degreesOfFreedom: number | [number, number];
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Levene's test for equality of variances across ≥2 groups (the ANOVA
|
|
298
|
+
* prerequisite). Robust to non-normality — it runs a one-way ANOVA F-test on the
|
|
299
|
+
* absolute deviations from each group's center. `center` defaults to `'median'`
|
|
300
|
+
* (the Brown–Forsythe variant, scipy's default); `'mean'` gives the original
|
|
301
|
+
* Levene test. Pinned to `scipy.stats.levene`.
|
|
302
|
+
*
|
|
303
|
+
* @example leveneTest([[8.1,8.3,7.9],[9.1,9.5,8.9]]) // { statistic, pValue, degreesOfFreedom }
|
|
304
|
+
*/
|
|
305
|
+
export declare function leveneTest(groups: f64[][], center?: 'median' | 'mean'): VarianceTestResult;
|
|
306
|
+
/**
|
|
307
|
+
* Bartlett's test for equality of variances across ≥2 groups. More powerful than
|
|
308
|
+
* Levene when the data are normal, but sensitive to departures from normality.
|
|
309
|
+
* Statistic is χ²-distributed with k−1 df. Pinned to `scipy.stats.bartlett`.
|
|
310
|
+
*
|
|
311
|
+
* @example bartlettTest([[8.1,8.3,7.9],[9.1,9.5,8.9]]) // { statistic, pValue, degreesOfFreedom }
|
|
312
|
+
*/
|
|
313
|
+
export declare function bartlettTest(groups: f64[][]): VarianceTestResult;
|
|
314
|
+
/**
|
|
315
|
+
* Paired (dependent-samples) t-test: tests whether the mean of the paired
|
|
316
|
+
* differences x−y is zero. Distinct from the two-sample Welch test in
|
|
317
|
+
* {@link studentTTest}, which assumes independent samples. Pinned to
|
|
318
|
+
* `scipy.stats.ttest_rel`.
|
|
319
|
+
*
|
|
320
|
+
* @example studentTTestPaired([1.2,2.3,3.1], [1.0,2.0,3.5]) // { statistic, pValue, degreesOfFreedom }
|
|
321
|
+
*/
|
|
322
|
+
export declare function studentTTestPaired(sample1: f64[], sample2: f64[]): TTestResult;
|
|
323
|
+
/** z-test result (statistic + two-tailed p-value). */
|
|
324
|
+
export interface ProportionZResult {
|
|
325
|
+
statistic: f64;
|
|
326
|
+
pValue: f64;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Proportion z-test (large-sample, two-tailed).
|
|
330
|
+
* - **One-sample**: `proportionZTest(successes, n, p0)` tests p̂ = successes/n
|
|
331
|
+
* against a hypothesized proportion `p0`.
|
|
332
|
+
* - **Two-sample**: `proportionZTest([s1, s2], [n1, n2])` tests p̂₁ = p̂₂ using
|
|
333
|
+
* the pooled-variance z (equivalent to `statsmodels.proportions_ztest`).
|
|
334
|
+
*
|
|
335
|
+
* @example proportionZTest(40, 100, 0.5) // one-sample: z=-2, p≈0.0455
|
|
336
|
+
* @example proportionZTest([40, 30], [100, 100]) // two-sample: z≈1.482, p≈0.138
|
|
337
|
+
*/
|
|
338
|
+
export declare function proportionZTest(count: number | [number, number], nobs: number | [number, number], value?: number): ProportionZResult;
|
|
339
|
+
/**
|
|
340
|
+
* Exact binomial test — is the observed success count consistent with success
|
|
341
|
+
* probability `p`? The two-tailed p-value is the total probability of all
|
|
342
|
+
* outcomes no more likely than the observed one (scipy's method-of-small-p).
|
|
343
|
+
* Pinned to `scipy.stats.binomtest`.
|
|
344
|
+
*
|
|
345
|
+
* @example binomialTest(8, 20, 0.5) // { pValue: 0.5034446716 }
|
|
346
|
+
*/
|
|
347
|
+
export declare function binomialTest(successes: number, n: number, p?: f64): {
|
|
348
|
+
statistic: f64;
|
|
349
|
+
pValue: f64;
|
|
350
|
+
};
|
|
351
|
+
/** Normality-test result (statistic + p-value). */
|
|
352
|
+
export interface NormalityTestResult {
|
|
353
|
+
statistic: f64;
|
|
354
|
+
pValue: f64;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Anderson-Darling test for normality. Returns the A^2 statistic (matching
|
|
358
|
+
* scipy.stats.anderson, standardized with the ddof=1 sample std) and a p-value
|
|
359
|
+
* from the D'Agostino-Stephens approximation on the small-sample-corrected A^2*.
|
|
360
|
+
*/
|
|
361
|
+
export declare function andersonDarlingTest(data: f64[]): NormalityTestResult;
|
|
362
|
+
/**
|
|
363
|
+
* D'Agostino-Pearson omnibus normality test (scipy.stats.normaltest):
|
|
364
|
+
* K2 = Z1^2 + Z2^2 (skew + kurtosis Z-tests), chi-square with 2 df, p = e^(-K2/2).
|
|
365
|
+
*/
|
|
366
|
+
export declare function dagostinoTest(data: f64[]): NormalityTestResult;
|
|
367
|
+
/**
|
|
368
|
+
* Friedman test - non-parametric repeated-measures ANOVA across k related
|
|
369
|
+
* groups of the same n blocks. chi-square with k-1 df. scipy.stats.friedmanchisquare.
|
|
370
|
+
*/
|
|
371
|
+
export declare function friedmanTest(groups: f64[][]): {
|
|
372
|
+
statistic: f64;
|
|
373
|
+
pValue: f64;
|
|
374
|
+
degreesOfFreedom: number;
|
|
375
|
+
};
|
|
376
|
+
/** One factor's line in a two-way ANOVA table. */
|
|
377
|
+
export interface Anova2Effect {
|
|
378
|
+
F: f64;
|
|
379
|
+
pValue: f64;
|
|
380
|
+
degreesOfFreedom: [number, number];
|
|
381
|
+
}
|
|
382
|
+
/** Balanced two-way (with-replication) ANOVA result. */
|
|
383
|
+
export interface Anova2Result {
|
|
384
|
+
factorA: Anova2Effect;
|
|
385
|
+
factorB: Anova2Effect;
|
|
386
|
+
interaction: Anova2Effect;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Balanced two-way ANOVA with replication. data[i][j] holds the r replicates for
|
|
390
|
+
* level i of factor A x level j of factor B (all cells equal size). Equivalent to
|
|
391
|
+
* MATLAB anova2.
|
|
392
|
+
*/
|
|
393
|
+
export declare function anova2(data: f64[][][]): Anova2Result;
|
|
394
|
+
/**
|
|
395
|
+
* Multiple-comparison p-value correction: bonferroni, holm (step-down), or bh
|
|
396
|
+
* (Benjamini-Hochberg FDR). Matches statsmodels multipletests.
|
|
397
|
+
*/
|
|
398
|
+
export declare function multipleComparison(pValues: f64[], method?: 'bonferroni' | 'holm' | 'bh'): f64[];
|
|
399
|
+
/** A confidence interval with the point estimate it brackets. */
|
|
400
|
+
export interface ConfidenceInterval {
|
|
401
|
+
estimate: f64;
|
|
402
|
+
lower: f64;
|
|
403
|
+
upper: f64;
|
|
404
|
+
confidence: f64;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Confidence interval for the population mean via the Student-t distribution
|
|
408
|
+
* (`scipy.stats.t.interval`). `confidence` defaults to 0.95.
|
|
409
|
+
*/
|
|
410
|
+
export declare function meanCI(data: f64[], confidence?: number): ConfidenceInterval;
|
|
411
|
+
/**
|
|
412
|
+
* Wald confidence interval for a binomial proportion (normal approximation).
|
|
413
|
+
* `confidence` defaults to 0.95.
|
|
414
|
+
*/
|
|
415
|
+
export declare function proportionCI(successes: number, n: number, confidence?: number): ConfidenceInterval;
|
|
416
|
+
/** Options for `bootstrapCI`. */
|
|
417
|
+
export interface BootstrapCIOptions {
|
|
418
|
+
confidence?: number;
|
|
419
|
+
resamples?: number;
|
|
420
|
+
seed?: number;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Percentile bootstrap confidence interval for an arbitrary statistic of a
|
|
424
|
+
* single sample (`scipy.stats.bootstrap`, percentile method). Resampling is
|
|
425
|
+
* deterministic when `seed` is given. Returns the CI plus the observed estimate.
|
|
426
|
+
*/
|
|
427
|
+
export declare function bootstrapCI(data: f64[], statistic: (sample: f64[]) => f64, opts?: BootstrapCIOptions): ConfidenceInterval;
|
|
428
|
+
/** Options for `permutationTest`. */
|
|
429
|
+
export interface PermutationOptions {
|
|
430
|
+
resamples?: number;
|
|
431
|
+
seed?: number;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Two-sample permutation test for an arbitrary statistic `statistic(a, b)`.
|
|
435
|
+
* The combined pool is repeatedly shuffled and re-split; the two-tailed p-value
|
|
436
|
+
* is the fraction of permuted statistics at least as extreme (in absolute value)
|
|
437
|
+
* as the observed one (`scipy.stats.permutation_test`). Deterministic with `seed`.
|
|
438
|
+
*/
|
|
439
|
+
export declare function permutationTest(a: f64[], b: f64[], statistic: (x: f64[], y: f64[]) => f64, opts?: PermutationOptions): {
|
|
440
|
+
statistic: f64;
|
|
441
|
+
pValue: f64;
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Mahalanobis distance between two vectors `u` and `v` under covariance `cov`:
|
|
445
|
+
* √((u−v)ᵀ Σ⁻¹ (u−v)). Matches `scipy.spatial.distance.mahalanobis(u, v, inv(cov))`
|
|
446
|
+
* (this form takes the covariance directly and inverts it internally).
|
|
447
|
+
*
|
|
448
|
+
* @example mahalanobis([1,2], [2.5,1], [[2,0.5],[0.5,1]]) // 1.8126539343
|
|
449
|
+
*/
|
|
450
|
+
export declare function mahalanobis(u: number[], v: number[], cov: number[][]): f64;
|
|
451
|
+
/** One-sample Hotelling's T² result. */
|
|
452
|
+
export interface HotellingResult {
|
|
453
|
+
statistic: f64;
|
|
454
|
+
fStatistic: f64;
|
|
455
|
+
pValue: f64;
|
|
456
|
+
degreesOfFreedom: [number, number];
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* One-sample Hotelling's T² test — the multivariate generalization of the
|
|
460
|
+
* one-sample t-test: is the mean vector of `data` (rows = observations, columns
|
|
461
|
+
* = variables) equal to `mu0`? T² = n·(x̄−μ₀)ᵀ S⁻¹ (x̄−μ₀), and
|
|
462
|
+
* F = (n−p)/(p(n−1))·T² ~ F(p, n−p) under H₀.
|
|
463
|
+
*
|
|
464
|
+
* @example hotellingT2(data, [5, 7]) // { statistic, fStatistic, pValue, degreesOfFreedom }
|
|
465
|
+
*/
|
|
466
|
+
export declare function hotellingT2(data: f64[][], mu0: f64[]): HotellingResult;
|
|
273
467
|
export {};
|
|
274
468
|
//# sourceMappingURL=hypothesis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hypothesis.d.ts","sourceRoot":"","sources":["../../src/typed/hypothesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;
|
|
1
|
+
{"version":3,"file":"hypothesis.d.ts","sourceRoot":"","sources":["../../src/typed/hypothesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAWH,mBAAmB;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,CAAC;IACZ,gBAAgB,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,CAAC;IACZ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