Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kstats.oremif.org/llms.txt

Use this file to discover all available pages before exploring further.

Start with the end-to-end scenario below, or jump to the per-module snippets at the bottom.

End-to-End Scenario

Define a sample

val sample = doubleArrayOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0)

Summarize

val stats = sample.describe()
stats.mean              // 5.0
stats.median            // 4.5
stats.standardDeviation // 2.1380
stats.skewness          // 0.6563
stats.interquartileRange // 1.5
describe() returns count, center, spread, quartiles, shape, and standard error in a single object.

Check normality

val normality = shapiroWilkTest(sample)
normality.statistic          // W statistic
normality.pValue             // > 0.05 → no evidence against normality
normality.isSignificant()    // false

Fit a distribution

val normal = NormalDistribution(mu = stats.mean, sigma = stats.standardDeviation)
normal.cdf(6.0)          // probability that X ≤ 6.0
normal.quantile(0.95)    // value below which 95% of the distribution falls

Test a hypothesis

val result = tTest(sample, mu = 5.0)
result.statistic         // 0.0
result.pValue            // 1.0
result.isSignificant()   // false — cannot reject H₀: μ = 5.0
result.confidenceInterval // (3.21, 6.79)

Measure association

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            // 0.9987
r.pValue                 // 0.0001

val model = simpleLinearRegression(x, y)
model.slope              // 1.99
model.rSquared           // 0.9973
model.predict(6.0)       // 11.99

Per-Module Snippets

val data = doubleArrayOf(2.0, 4.0, 4.0, 5.0, 7.0, 9.0)
data.mean()               // 5.1667
data.median()             // 4.5
data.standardDeviation()  // 2.4833
val summary = data.describe()
summary.skewness          // 0.3942

Next Steps

Descriptive Statistics

Full guide to summaries, moments, quantiles, and streaming stats.

Hypothesis Tests

Choose the right test and interpret TestResult.

A/B Testing

End-to-end example with summaries, assumption checks, and group comparison.
Last modified on April 18, 2026