Skip to main content Module statistics Copy item path Source chi_square_sf Survival function of the chi-square distribution, P(X > x), for df
degrees of freedom. finite_range Inclusive range (min, max) of a sample as f64, or None when empty or
entirely non-finite. g_test_statistic G-test (likelihood-ratio) statistic for a 2 x k contingency table built
from two histograms, together with its degrees of freedom. hellinger_distance Hellinger distance, bounded by 1. histogram_counts Counts a sample into bins equal-width buckets spanning [min, max]. js_divergence Jensen-Shannon divergence in nats, bounded by ln 2. kl_divergence Kullback-Leibler divergence KL(p || q) in nats. Both inputs must be
smoothed probability mass functions of equal length. kolmogorov_sf Survival function of the Kolmogorov distribution,
Q(z) = 2 * sum_{k>=1} (-1)^(k-1) exp(-2 k^2 z^2). ks_statistic Two-sample Kolmogorov-Smirnov statistic D = max_x |F_a(x) - F_b(x)|. ks_two_sample_p Asymptotic p-value for a two-sample Kolmogorov-Smirnov statistic d
observed on samples of size n1 and n2. mean Arithmetic mean, or None for an empty sample. median Convenience wrapper: median of a borrowed sample (clones into a scratch
buffer so the caller’s data is left untouched). median_in_place True median (mean of the two central order statistics for even n),
computed with select_nth_unstable_by. Reorders values in place. normal_two_sided_p Two-sided normal p-value for a z statistic: P(|Z| > |z|). population_variance Population variance (divides by n), or None for an empty sample. quantile_in_place Nearest-rank quantile of p in [0, 1], computed in O(n) expected time
with select_nth_unstable_by (no full sort). Reorders values in place. sample_std_dev Sample standard deviation (divides by n - 1), or None when n < 2. smoothed_pmf Normalises counts into a probability mass function with additive (Laplace)
smoothing, so that no bucket is ever exactly zero. Zero-probability
buckets would make KL divergence infinite and the log-ratio undefined; the
smoothing constant is applied symmetrically to both distributions being
compared, which is the standard treatment. sort_ascending Sorts a slice ascending using the NaN-safe total order. standard_normal_sf Survival function of the standard normal distribution, P(Z > z). total_order Total ordering for floating-point values that never panics. wasserstein_1d First Wasserstein distance (a.k.a. Earth Mover’s Distance) between two
one-dimensional empirical distributions.