@danielsimonjr/mathts-statistics 0.1.16 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,64 @@
1
- # @danielsimonjr/mathts-statistics
2
-
3
- Standalone statistics for [MathTS](https://github.com/danielsimonjr/mathts).
4
-
5
- A focused entry point over the `statistics` typed-function domain in
6
- [`@danielsimonjr/mathts-functions`](https://www.npmjs.com/package/@danielsimonjr/mathts-functions).
7
- The implementation is re-exported, not duplicated. These are MathTS typed
8
- functions (polymorphic dispatch across number / Complex / Fraction / BigNumber /
9
- Matrix where supported).
10
-
11
- ## Install
12
-
13
- ```sh
14
- npm install @danielsimonjr/mathts-statistics
15
- ```
16
-
17
- ## What it exports
18
-
19
- `parallelStatSum`, `parallelStatMean`, `parallelStatVariance`, `parallelStatStd`, `parallelStatMin`, `parallelStatMax`, `parallelStatMinMax`, `parallelStatMedian`, `parallelStatMode`, `parallelStatProd`, `parallelStatNorm`, `parallelStatDistance`, `parallelStatCorr`, `parallelStatMAD`, `parallelStatCumsum`, `parallelStatQuantile`, `parallelStatPercentile`, `parallelStatHistogram`, `quickSelect`, `medianSelect`, `minSelect`, `maxSelect` (plus the `typedStatistics` bundle).
20
-
21
- ## License
22
-
23
- MIT (c) Daniel Simon Jr.
1
+ # @danielsimonjr/mathts-statistics
2
+
3
+ **Statistics & probability** for [MathTS](https://github.com/danielsimonjr/mathts) — a focused,
4
+ standalone library covering descriptive statistics, probability distributions, hypothesis tests,
5
+ and combinatorics.
6
+
7
+ The implementations live in
8
+ [`@danielsimonjr/mathts-functions`](https://www.npmjs.com/package/@danielsimonjr/mathts-functions)
9
+ and are **re-exported here, not duplicated** — this package is a curated entry point over the
10
+ statistics/probability surface. Every function is **externally oracle-pinned** (SciPy / NumPy /
11
+ mpmath / closed form) in the functions package's test suite, so the numbers are trustworthy, not
12
+ just green.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ npm install @danielsimonjr/mathts-statistics
18
+ ```
19
+
20
+ ## What's included
21
+
22
+ - **Descriptive statistics** — `mean`, `median`, `mode`, `variance`, `std`, `quantileSeq`, `mad`,
23
+ `iqr`, `sem`, `zscore`, `moment`, `skewness`, `kurtosis`, `gmean`, `hmean`, `cov`, `corr`,
24
+ `corrcoef`, `rankdata`, and the three correlation coefficients `corr` (Pearson), `spearman`,
25
+ `kendallTau` (τ_b).
26
+ - **Parallel-first reductions** — worker-pool-accelerated `parallelStat*` (`Mean`, `Variance`,
27
+ `Std`, `Median`, `Quantile`, `Histogram`, `Corr`, …) plus `quickSelect`/`medianSelect`.
28
+ - **Probability distributions** — 14 distribution objects with
29
+ `.pdf/.cdf/.quantile/.mean/.variance/.sample` (`normalDist`, `gammaDist`, `betaDist`,
30
+ `binomialDist`, `poissonDist`, `exponentialDist`, `chiSquaredDist`, `fDist`, `tDist`,
31
+ `logNormalDist`, `uniformDist`, `weibullDist`, `hypergeometricDist`, `negativeBinomialDist`),
32
+ plus free CDF/quantile functions and the `entropy`/`jsDivergence` divergences.
33
+ - **Hypothesis tests** — `studentTTest` (one/two-sample), `studentTTestPaired`, `anova`,
34
+ `chiSquareTest`, `kolmogorovSmirnovTest` (one-sample) + `kolmogorovSmirnov2Test` (two-sample),
35
+ `mannWhitneyTest`, `shapiroWilkTest`, `leveneTest`, `bartlettTest`, `proportionZTest`,
36
+ `binomialTest`, `fTest`, `jarqueBera`, `kruskalWallis`, `wilcoxon`, `fisherExact`, `tukeyHSD`,
37
+ `principalComponentAnalysis`.
38
+ - **Probability & combinatorics** — `combinations`, `permutations`, `multinomial`, `factorial`,
39
+ `doubleFactorial`, `risingFactorial`, `fallingFactorial`, `subfactorial`, `bernoulli`, `gamma`,
40
+ `lgamma`, `kldivergence`, and seedable RNG (`random`, `randomInt`, `pickRandom`,
41
+ `seedProbabilityRng`).
42
+
43
+ ## Example
44
+
45
+ ```ts
46
+ import {
47
+ anova,
48
+ kendallTau,
49
+ hypergeometricDist,
50
+ kolmogorovSmirnov2Test,
51
+ } from '@danielsimonjr/mathts-statistics';
52
+
53
+ anova([
54
+ [8.1, 8.3, 7.9],
55
+ [9.1, 9.5, 8.9],
56
+ ]); // one-way ANOVA F + p
57
+ kendallTau([1, 2, 3, 4, 5], [2, 1, 4, 3, 5]); // 0.6
58
+ hypergeometricDist(50, 5, 10).pmf(1); // 0.4313371972
59
+ kolmogorovSmirnov2Test([1, 2, 3], [2, 3, 4]); // { statistic, pValue }
60
+ ```
61
+
62
+ ## License
63
+
64
+ MIT
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { maxSelect, medianSelect, minSelect, parallelStatCorr, parallelStatCumsum, parallelStatDistance, parallelStatHistogram, parallelStatMAD, parallelStatMax, parallelStatMean, parallelStatMedian, parallelStatMin, parallelStatMinMax, parallelStatMode, parallelStatNorm, parallelStatPercentile, parallelStatProd, parallelStatQuantile, parallelStatStd, parallelStatSum, parallelStatVariance, quickSelect, typedStatistics } from '@danielsimonjr/mathts-functions';
1
+ export { Anova2Effect, Anova2Result, BootstrapCIOptions, ConfidenceInterval, CorrelationTestResult, DIST_WORKER_THRESHOLD, DescribeResult, Distribution, HistogramResult, HotellingResult, LinRegressResult, MultivariateDistribution, NormalityTestResult, PermutationOptions, SampleNOptions, acf, andersonDarlingTest, anova, anova2, bartlettTest, bernoulli, bernoulliPMF, beta, betaCDF, betaDist, betaPDF, betaQuantile, binomialDist, binomialPMF, binomialTest, bootstrapCI, cauchyCDF, cauchyPDF, cauchyQuantile, chiSquareTest, chiSquaredCDF, chiSquaredDist, chiSquaredQuantile, combinations, combinationsWithRep, corr, corrcoef, cov, cummax, cummin, cumprod, cumsum, cumtrapz, dagostinoTest, describe, detrend, digamma, discreteUniformDist, doubleFactorial, entropy, ewma, exponentialCDF, exponentialDist, exponentialPDF, fCDF, fDist, fQuantile, fTest, factorial, fallingFactorial, fisherExact, friedmanTest, gamma, gammaCDF, gammaDist, gammaPDF, gammaQuantile, geometricPMF, gmean, gumbelDist, histogram, hmean, hotellingT2, hypergeometricDist, invGaussDist, iqr, jarqueBera, jsDivergence, kendallTau, kendalltau, kldivergence, kmeans, kolmogorovSmirnov2Test, kolmogorovSmirnovTest, kruskalWallis, kurtosis, laplaceCDF, laplacePDF, laplaceQuantile, leveneTest, lgamma, linearRegression, linregress, logNormalDist, logisticCDF, logisticPDF, logisticQuantile, logsumexp, mad, mahalanobis, mannWhitneyTest, max, maxSelect, mean, meanCI, median, medianSelect, min, minSelect, mode, moment, movingAverage, multinomial, multipleComparison, multivariateNormal, negativeBinomialDist, noncentralChi2PDF, normalCDF, normalDist, normalPDF, normalQuantile, parallelStatCorr, parallelStatCumsum, parallelStatDistance, parallelStatHistogram, parallelStatMAD, parallelStatMax, parallelStatMean, parallelStatMedian, parallelStatMin, parallelStatMinMax, parallelStatMode, parallelStatNorm, parallelStatPercentile, parallelStatProd, parallelStatQuantile, parallelStatStd, parallelStatSum, parallelStatVariance, paretoDist, pearsonr, permutationTest, permutations, pickRandom, poissonDist, poissonPMF, polyFit, principalComponentAnalysis, prod, proportionCI, proportionZTest, ptp, quantileSeq, quickSelect, random, randomInt, rankdata, rayleighDist, risingFactorial, seedProbabilityRng, sem, shapiroWilkTest, skewness, softmax, spearman, spearmanr, spectralClustering, std, studentTCDF, studentTPDF, studentTQuantile, studentTTest, studentTTestPaired, studentizedRangeCDF, studentizedRangeQuantile, subfactorial, sum, tDist, trapzF64, triangularDist, trimmedMean, tukeyHSD, typedDistributions, typedProbability, typedStatistics, uniformDist, variance, variation, weibullDist, wilcoxon, zscore } from '@danielsimonjr/mathts-functions';
package/dist/index.js CHANGED
@@ -1,4 +1,32 @@
1
1
  // src/index.ts
2
+ import {
3
+ mean,
4
+ median,
5
+ mode,
6
+ variance,
7
+ std,
8
+ quantileSeq,
9
+ mad,
10
+ corr,
11
+ cumsum,
12
+ sum,
13
+ prod,
14
+ min,
15
+ max,
16
+ rankdata,
17
+ spearman,
18
+ kendallTau,
19
+ gmean,
20
+ hmean,
21
+ moment,
22
+ skewness,
23
+ kurtosis,
24
+ iqr,
25
+ sem,
26
+ zscore,
27
+ cov,
28
+ corrcoef
29
+ } from "@danielsimonjr/mathts-functions";
2
30
  import {
3
31
  parallelStatSum,
4
32
  parallelStatMean,
@@ -24,10 +52,268 @@ import {
24
52
  maxSelect,
25
53
  typedStatistics
26
54
  } from "@danielsimonjr/mathts-functions";
55
+ import {
56
+ normalDist,
57
+ betaDist,
58
+ binomialDist,
59
+ chiSquaredDist,
60
+ exponentialDist,
61
+ fDist,
62
+ gammaDist,
63
+ logNormalDist,
64
+ poissonDist,
65
+ tDist,
66
+ uniformDist,
67
+ weibullDist,
68
+ hypergeometricDist,
69
+ negativeBinomialDist,
70
+ DIST_WORKER_THRESHOLD,
71
+ normalPDF,
72
+ normalCDF,
73
+ exponentialPDF,
74
+ exponentialCDF,
75
+ poissonPMF,
76
+ binomialPMF,
77
+ geometricPMF,
78
+ bernoulliPMF,
79
+ betaPDF,
80
+ gammaPDF,
81
+ studentTPDF,
82
+ noncentralChi2PDF,
83
+ entropy,
84
+ jsDivergence,
85
+ typedDistributions,
86
+ normalQuantile,
87
+ studentTCDF,
88
+ studentTQuantile,
89
+ chiSquaredCDF,
90
+ chiSquaredQuantile,
91
+ fCDF,
92
+ fQuantile,
93
+ gammaCDF,
94
+ gammaQuantile,
95
+ betaCDF,
96
+ betaQuantile,
97
+ cauchyPDF,
98
+ cauchyCDF,
99
+ cauchyQuantile,
100
+ laplacePDF,
101
+ laplaceCDF,
102
+ laplaceQuantile,
103
+ logisticPDF,
104
+ logisticCDF,
105
+ logisticQuantile
106
+ } from "@danielsimonjr/mathts-functions";
107
+ import {
108
+ studentTTest,
109
+ studentTTestPaired,
110
+ chiSquareTest,
111
+ anova,
112
+ kolmogorovSmirnovTest,
113
+ kolmogorovSmirnov2Test,
114
+ mannWhitneyTest,
115
+ shapiroWilkTest,
116
+ leveneTest,
117
+ bartlettTest,
118
+ proportionZTest,
119
+ binomialTest,
120
+ principalComponentAnalysis,
121
+ fTest,
122
+ jarqueBera,
123
+ kruskalWallis,
124
+ wilcoxon,
125
+ fisherExact,
126
+ studentizedRangeCDF,
127
+ studentizedRangeQuantile,
128
+ tukeyHSD
129
+ } from "@danielsimonjr/mathts-functions";
130
+ import {
131
+ combinations,
132
+ combinationsWithRep,
133
+ permutations,
134
+ multinomial,
135
+ factorial,
136
+ doubleFactorial,
137
+ risingFactorial,
138
+ fallingFactorial,
139
+ subfactorial,
140
+ bernoulli,
141
+ gamma,
142
+ lgamma,
143
+ kldivergence,
144
+ random,
145
+ randomInt,
146
+ pickRandom,
147
+ seedProbabilityRng,
148
+ typedProbability
149
+ } from "@danielsimonjr/mathts-functions";
150
+ import {
151
+ linearRegression,
152
+ polyFit,
153
+ cummax,
154
+ cummin,
155
+ cumprod,
156
+ cumtrapz,
157
+ trapzF64,
158
+ movingAverage,
159
+ ewma,
160
+ detrend,
161
+ acf,
162
+ logsumexp,
163
+ softmax,
164
+ kmeans,
165
+ spectralClustering,
166
+ beta,
167
+ digamma
168
+ } from "@danielsimonjr/mathts-functions";
169
+ import {
170
+ linregress,
171
+ pearsonr,
172
+ spearmanr,
173
+ kendalltau,
174
+ ptp,
175
+ variation,
176
+ trimmedMean,
177
+ describe,
178
+ histogram
179
+ } from "@danielsimonjr/mathts-functions";
180
+ import {
181
+ andersonDarlingTest,
182
+ dagostinoTest,
183
+ friedmanTest,
184
+ anova2,
185
+ multipleComparison
186
+ } from "@danielsimonjr/mathts-functions";
187
+ import {
188
+ paretoDist,
189
+ rayleighDist,
190
+ triangularDist,
191
+ discreteUniformDist,
192
+ gumbelDist,
193
+ invGaussDist,
194
+ multivariateNormal
195
+ } from "@danielsimonjr/mathts-functions";
196
+ import {
197
+ meanCI,
198
+ proportionCI,
199
+ bootstrapCI,
200
+ permutationTest,
201
+ mahalanobis,
202
+ hotellingT2
203
+ } from "@danielsimonjr/mathts-functions";
27
204
  export {
205
+ DIST_WORKER_THRESHOLD,
206
+ acf,
207
+ andersonDarlingTest,
208
+ anova,
209
+ anova2,
210
+ bartlettTest,
211
+ bernoulli,
212
+ bernoulliPMF,
213
+ beta,
214
+ betaCDF,
215
+ betaDist,
216
+ betaPDF,
217
+ betaQuantile,
218
+ binomialDist,
219
+ binomialPMF,
220
+ binomialTest,
221
+ bootstrapCI,
222
+ cauchyCDF,
223
+ cauchyPDF,
224
+ cauchyQuantile,
225
+ chiSquareTest,
226
+ chiSquaredCDF,
227
+ chiSquaredDist,
228
+ chiSquaredQuantile,
229
+ combinations,
230
+ combinationsWithRep,
231
+ corr,
232
+ corrcoef,
233
+ cov,
234
+ cummax,
235
+ cummin,
236
+ cumprod,
237
+ cumsum,
238
+ cumtrapz,
239
+ dagostinoTest,
240
+ describe,
241
+ detrend,
242
+ digamma,
243
+ discreteUniformDist,
244
+ doubleFactorial,
245
+ entropy,
246
+ ewma,
247
+ exponentialCDF,
248
+ exponentialDist,
249
+ exponentialPDF,
250
+ fCDF,
251
+ fDist,
252
+ fQuantile,
253
+ fTest,
254
+ factorial,
255
+ fallingFactorial,
256
+ fisherExact,
257
+ friedmanTest,
258
+ gamma,
259
+ gammaCDF,
260
+ gammaDist,
261
+ gammaPDF,
262
+ gammaQuantile,
263
+ geometricPMF,
264
+ gmean,
265
+ gumbelDist,
266
+ histogram,
267
+ hmean,
268
+ hotellingT2,
269
+ hypergeometricDist,
270
+ invGaussDist,
271
+ iqr,
272
+ jarqueBera,
273
+ jsDivergence,
274
+ kendallTau,
275
+ kendalltau,
276
+ kldivergence,
277
+ kmeans,
278
+ kolmogorovSmirnov2Test,
279
+ kolmogorovSmirnovTest,
280
+ kruskalWallis,
281
+ kurtosis,
282
+ laplaceCDF,
283
+ laplacePDF,
284
+ laplaceQuantile,
285
+ leveneTest,
286
+ lgamma,
287
+ linearRegression,
288
+ linregress,
289
+ logNormalDist,
290
+ logisticCDF,
291
+ logisticPDF,
292
+ logisticQuantile,
293
+ logsumexp,
294
+ mad,
295
+ mahalanobis,
296
+ mannWhitneyTest,
297
+ max,
28
298
  maxSelect,
299
+ mean,
300
+ meanCI,
301
+ median,
29
302
  medianSelect,
303
+ min,
30
304
  minSelect,
305
+ mode,
306
+ moment,
307
+ movingAverage,
308
+ multinomial,
309
+ multipleComparison,
310
+ multivariateNormal,
311
+ negativeBinomialDist,
312
+ noncentralChi2PDF,
313
+ normalCDF,
314
+ normalDist,
315
+ normalPDF,
316
+ normalQuantile,
31
317
  parallelStatCorr,
32
318
  parallelStatCumsum,
33
319
  parallelStatDistance,
@@ -46,6 +332,56 @@ export {
46
332
  parallelStatStd,
47
333
  parallelStatSum,
48
334
  parallelStatVariance,
335
+ paretoDist,
336
+ pearsonr,
337
+ permutationTest,
338
+ permutations,
339
+ pickRandom,
340
+ poissonDist,
341
+ poissonPMF,
342
+ polyFit,
343
+ principalComponentAnalysis,
344
+ prod,
345
+ proportionCI,
346
+ proportionZTest,
347
+ ptp,
348
+ quantileSeq,
49
349
  quickSelect,
50
- typedStatistics
350
+ random,
351
+ randomInt,
352
+ rankdata,
353
+ rayleighDist,
354
+ risingFactorial,
355
+ seedProbabilityRng,
356
+ sem,
357
+ shapiroWilkTest,
358
+ skewness,
359
+ softmax,
360
+ spearman,
361
+ spearmanr,
362
+ spectralClustering,
363
+ std,
364
+ studentTCDF,
365
+ studentTPDF,
366
+ studentTQuantile,
367
+ studentTTest,
368
+ studentTTestPaired,
369
+ studentizedRangeCDF,
370
+ studentizedRangeQuantile,
371
+ subfactorial,
372
+ sum,
373
+ tDist,
374
+ trapzF64,
375
+ triangularDist,
376
+ trimmedMean,
377
+ tukeyHSD,
378
+ typedDistributions,
379
+ typedProbability,
380
+ typedStatistics,
381
+ uniformDist,
382
+ variance,
383
+ variation,
384
+ weibullDist,
385
+ wilcoxon,
386
+ zscore
51
387
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-statistics",
3
- "version": "0.1.16",
4
- "description": "Standalone statistics functions for MathTS, re-exported as a focused package",
3
+ "version": "0.3.0",
4
+ "description": "Statistics & probability for MathTS — descriptive stats, distributions, hypothesis tests, and combinatorics, every function externally oracle-pinned (SciPy/NumPy/closed-form)",
5
5
  "author": "Daniel Simon Jr.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
32
32
  },
33
33
  "dependencies": {
34
- "@danielsimonjr/mathts-functions": "^0.15.0",
34
+ "@danielsimonjr/mathts-functions": "^0.16.0",
35
35
  "typed-function": "^4.0.0"
36
36
  },
37
37
  "devDependencies": {
@@ -52,8 +52,21 @@
52
52
  "math",
53
53
  "typescript",
54
54
  "statistics",
55
- "mean",
56
- "variance",
57
- "quantile"
55
+ "probability",
56
+ "distribution",
57
+ "hypothesis-test",
58
+ "anova",
59
+ "t-test",
60
+ "ks-test",
61
+ "levene",
62
+ "bartlett",
63
+ "kendall",
64
+ "spearman",
65
+ "normal",
66
+ "gamma",
67
+ "beta",
68
+ "binomial",
69
+ "poisson",
70
+ "scipy"
58
71
  ]
59
72
  }