@danielsimonjr/mathts-statistics 0.1.15 → 0.2.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 { DIST_WORKER_THRESHOLD, Distribution, SampleNOptions, anova, bartlettTest, bernoulli, bernoulliPMF, betaCDF, betaDist, betaPDF, betaQuantile, binomialDist, binomialPMF, binomialTest, cauchyCDF, cauchyPDF, cauchyQuantile, chiSquareTest, chiSquaredCDF, chiSquaredDist, chiSquaredQuantile, combinations, combinationsWithRep, corr, corrcoef, cov, cumsum, doubleFactorial, entropy, exponentialCDF, exponentialDist, exponentialPDF, fCDF, fDist, fQuantile, fTest, factorial, fallingFactorial, fisherExact, gamma, gammaCDF, gammaDist, gammaPDF, gammaQuantile, geometricPMF, gmean, hmean, hypergeometricDist, iqr, jarqueBera, jsDivergence, kendallTau, kldivergence, kolmogorovSmirnov2Test, kolmogorovSmirnovTest, kruskalWallis, kurtosis, laplaceCDF, laplacePDF, laplaceQuantile, leveneTest, lgamma, logNormalDist, logisticCDF, logisticPDF, logisticQuantile, mad, mannWhitneyTest, max, maxSelect, mean, median, medianSelect, min, minSelect, mode, moment, multinomial, negativeBinomialDist, noncentralChi2PDF, normalCDF, normalDist, normalPDF, normalQuantile, parallelStatCorr, parallelStatCumsum, parallelStatDistance, parallelStatHistogram, parallelStatMAD, parallelStatMax, parallelStatMean, parallelStatMedian, parallelStatMin, parallelStatMinMax, parallelStatMode, parallelStatNorm, parallelStatPercentile, parallelStatProd, parallelStatQuantile, parallelStatStd, parallelStatSum, parallelStatVariance, permutations, pickRandom, poissonDist, poissonPMF, principalComponentAnalysis, prod, proportionZTest, quantileSeq, quickSelect, random, randomInt, rankdata, risingFactorial, seedProbabilityRng, sem, shapiroWilkTest, skewness, spearman, std, studentTCDF, studentTPDF, studentTQuantile, studentTTest, studentTTestPaired, studentizedRangeCDF, studentizedRangeQuantile, subfactorial, sum, tDist, tukeyHSD, typedDistributions, typedProbability, typedStatistics, uniformDist, variance, 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,184 @@ 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";
27
150
  export {
151
+ DIST_WORKER_THRESHOLD,
152
+ anova,
153
+ bartlettTest,
154
+ bernoulli,
155
+ bernoulliPMF,
156
+ betaCDF,
157
+ betaDist,
158
+ betaPDF,
159
+ betaQuantile,
160
+ binomialDist,
161
+ binomialPMF,
162
+ binomialTest,
163
+ cauchyCDF,
164
+ cauchyPDF,
165
+ cauchyQuantile,
166
+ chiSquareTest,
167
+ chiSquaredCDF,
168
+ chiSquaredDist,
169
+ chiSquaredQuantile,
170
+ combinations,
171
+ combinationsWithRep,
172
+ corr,
173
+ corrcoef,
174
+ cov,
175
+ cumsum,
176
+ doubleFactorial,
177
+ entropy,
178
+ exponentialCDF,
179
+ exponentialDist,
180
+ exponentialPDF,
181
+ fCDF,
182
+ fDist,
183
+ fQuantile,
184
+ fTest,
185
+ factorial,
186
+ fallingFactorial,
187
+ fisherExact,
188
+ gamma,
189
+ gammaCDF,
190
+ gammaDist,
191
+ gammaPDF,
192
+ gammaQuantile,
193
+ geometricPMF,
194
+ gmean,
195
+ hmean,
196
+ hypergeometricDist,
197
+ iqr,
198
+ jarqueBera,
199
+ jsDivergence,
200
+ kendallTau,
201
+ kldivergence,
202
+ kolmogorovSmirnov2Test,
203
+ kolmogorovSmirnovTest,
204
+ kruskalWallis,
205
+ kurtosis,
206
+ laplaceCDF,
207
+ laplacePDF,
208
+ laplaceQuantile,
209
+ leveneTest,
210
+ lgamma,
211
+ logNormalDist,
212
+ logisticCDF,
213
+ logisticPDF,
214
+ logisticQuantile,
215
+ mad,
216
+ mannWhitneyTest,
217
+ max,
28
218
  maxSelect,
219
+ mean,
220
+ median,
29
221
  medianSelect,
222
+ min,
30
223
  minSelect,
224
+ mode,
225
+ moment,
226
+ multinomial,
227
+ negativeBinomialDist,
228
+ noncentralChi2PDF,
229
+ normalCDF,
230
+ normalDist,
231
+ normalPDF,
232
+ normalQuantile,
31
233
  parallelStatCorr,
32
234
  parallelStatCumsum,
33
235
  parallelStatDistance,
@@ -46,6 +248,42 @@ export {
46
248
  parallelStatStd,
47
249
  parallelStatSum,
48
250
  parallelStatVariance,
251
+ permutations,
252
+ pickRandom,
253
+ poissonDist,
254
+ poissonPMF,
255
+ principalComponentAnalysis,
256
+ prod,
257
+ proportionZTest,
258
+ quantileSeq,
49
259
  quickSelect,
50
- typedStatistics
260
+ random,
261
+ randomInt,
262
+ rankdata,
263
+ risingFactorial,
264
+ seedProbabilityRng,
265
+ sem,
266
+ shapiroWilkTest,
267
+ skewness,
268
+ spearman,
269
+ std,
270
+ studentTCDF,
271
+ studentTPDF,
272
+ studentTQuantile,
273
+ studentTTest,
274
+ studentTTestPaired,
275
+ studentizedRangeCDF,
276
+ studentizedRangeQuantile,
277
+ subfactorial,
278
+ sum,
279
+ tDist,
280
+ tukeyHSD,
281
+ typedDistributions,
282
+ typedProbability,
283
+ typedStatistics,
284
+ uniformDist,
285
+ variance,
286
+ weibullDist,
287
+ wilcoxon,
288
+ zscore
51
289
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-statistics",
3
- "version": "0.1.15",
4
- "description": "Standalone statistics functions for MathTS, re-exported as a focused package",
3
+ "version": "0.2.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.14.0",
34
+ "@danielsimonjr/mathts-functions": "^0.15.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
  }