Modular statistics toolkit offering descriptive analysis, streaming statistics, 28 probability distributions, hypothesis tests, correlation/regression, ranking/normalization, bootstrap and weighted sampling for data analysis and simulation.
A Kotlin Multiplatform statistics toolkit covering descriptive analysis, probability distributions, hypothesis testing,
correlation, regression, and sampling. Pure Kotlin, published to Maven Central as focused modules.
val sample = doubleArrayOf(2.0, 4.0, 4.0, 5.0, 7.0, 9.0)
val result = tTest(sample, mu = 5.0)
result.statistic // => 0.1644
result.pValue // => 0.8759
result.isSignificant(alpha = 0.05) // => false
kstats-correlation
val x = doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0)
val y = doubleArrayOf(2.1, 3.9, 6.2, 7.8, 10.1)
val r = pearsonCorrelation(x, y)
r.coefficient
r.pValue
reg = simpleLinearRegression(x, y)
reg.slope
reg.rSquared
reg.predict()
Interactive notebooks: samples/ — Kotlin Notebooks with Kandy visualizations for each guide
Development
./gradlew jvmTest # run JVM tests
./gradlew allTests # run all platform tests
./gradlew build # full build
./gradlew :benchmark:benchmark # JMH benchmarks (kstats vs Apache Commons Math)
./gradlew :benchmark:smokeBenchmark # quick smoke run
Contributing
Contributions are welcome. See CONTRIBUTING.md for the contribution workflow, issue guidelines, and
project conventions. Please also read CODE_OF_CONDUCT.md before participating in issues, pull
requests, or discussions.