Skip to main content
kstats is a Kotlin Multiplatform statistics library. It covers descriptive statistics, probability distributions, hypothesis testing, correlation and regression, and sampling — everything needed for quantitative analysis in Kotlin.

Modules

Descriptive Statistics

Mean, median, variance, quantiles, moments, frequency tables, streaming stats, and describe() summaries.

Probability Distributions

18 continuous and 10 discrete distributions with a shared API: pdf/pmf, cdf, quantile, and sampling.

Hypothesis Tests

t-tests, ANOVA, chi-squared, Fisher exact, Mann-Whitney, Wilcoxon, Shapiro-Wilk, and more.

Correlation & Regression

Pearson, Spearman, Kendall tau, partial correlation, matrices, and simple linear regression.

Sampling & Transformation

Ranking, z-score normalization, min-max scaling, binning, bootstrap, and weighted sampling.

Supported Targets

Next Steps

Installation

Add the BOM or a single module to a Gradle KTS project.

Quick Start

Run a summary, fit a distribution, and execute a hypothesis test.

A/B Testing

Walk through a complete A/B test with assumption checks and group comparison.
Last modified on April 23, 2026