@danielsimonjr/mathts-statistics
v0.4.3
Published
Statistics & probability for MathTS — descriptive stats, distributions, hypothesis tests, and combinatorics, every function externally oracle-pinned (SciPy/NumPy/closed-form)
Maintainers
Readme
@danielsimonjr/mathts-statistics
Statistics & probability for MathTS — a focused, standalone library covering descriptive statistics, probability distributions, hypothesis tests, and combinatorics.
Every name this package exports is implemented in @danielsimonjr/mathts-functions. This package does not define a second copy of a distribution.
The implementations live in
@danielsimonjr/mathts-functions
and are re-exported here, not duplicated — this package is a curated entry point over the
statistics/probability surface. Every function is externally oracle-pinned (SciPy / NumPy /
mpmath / closed form) in the functions package's test suite, so the numbers are trustworthy, not
just green.
Install
npm install @danielsimonjr/mathts-statisticsWhat's included
- Descriptive statistics —
mean,median,mode,variance,std,quantileSeq,mad(median absolute deviation),iqr,sem,zscore,moment,skewness,kurtosis,gmean,hmean,cov,corr,corrcoef,rankdata,ptp,trimmedMean,variation,describe,logsumexp,softmax,detrend,movingAverage,ewma,acf, and the correlation helperspearsonr,spearman,spearmanr,kendalltau/kendallTau. - Parallel reductions —
parallelStat*helpers mirror the typed reductions onFloat64Array; most op thresholds inComputePoolare'never'today (inline JS), but the API staysasync-friendly where the typed layer returns aPromise. Factorymadis median absolute deviation;parallelStatMAD/parallelStatMeanADare mean absolute deviation from the mean (not the same statistic).quickSelect/medianSelect/minSelect/maxSelectare synchronous selection utilities. - Regression & resampling —
linearRegression,polyFit,linregress,pearsonr,spearman,spearmanr,kendalltau,meanCI,proportionCI,bootstrapCI,permutationTest,mahalanobis,hotellingT2,kmeans,spectralClustering. - Probability distributions — distribution objects with
.pdf/.cdf/.quantile/.mean/.variance/.sample(normalDist,gammaDist,betaDist,binomialDist,poissonDist,exponentialDist,chiSquaredDist,fDist,tDist,logNormalDist,uniformDist,weibullDist,hypergeometricDist,negativeBinomialDist,paretoDist,rayleighDist,triangularDist,discreteUniformDist,gumbelDist,invGaussDist,multivariateNormal), plus free CDF/quantile functions,studentizedRangeCDF/studentizedRangeQuantile, andentropy/jsDivergence. - Hypothesis tests —
studentTTest(one/two-sample),studentTTestPaired,anova,anova2,chiSquareTest,kolmogorovSmirnovTest+kolmogorovSmirnov2Test,mannWhitneyTest,shapiroWilkTest,leveneTest,bartlettTest,proportionZTest,binomialTest,fTest,jarqueBera,kruskalWallis,wilcoxon,fisherExact,tukeyHSD,andersonDarlingTest,dagostinoTest,friedmanTest,multipleComparison,principalComponentAnalysis. - Probability & combinatorics —
combinations,combinationsWithRep,permutations,multinomial,factorial,doubleFactorial,risingFactorial,fallingFactorial,subfactorial,bernoulli,gamma,lgamma,kldivergence, and seedable RNG (random,randomInt,pickRandom,seedProbabilityRng).
Example
import {
anova,
kendallTau,
hypergeometricDist,
kolmogorovSmirnov2Test,
} from '@danielsimonjr/mathts-statistics';
anova([
[8.1, 8.3, 7.9],
[9.1, 9.5, 8.9],
]); // one-way ANOVA F + p
kendallTau([1, 2, 3, 4, 5], [2, 1, 4, 3, 5]); // 0.6
hypergeometricDist(50, 5, 10).pdf(1); // 0.4313371972
kolmogorovSmirnov2Test([1, 2, 3], [2, 3, 4]); // { statistic, pValue }License
MIT
