Expand description
CommonStats — WASM-first statistical core.
Base (always compiled): special functions (special), the mergeable
accumulator core (accum), descriptives (descriptive), kernel density and
auto-histograms (density), distribution-free transforms (transform), and
hypothesis tests (htest), plus the fixed-bin histogram + ECDF
(accum::histogram). Feature-gated: rng (counter-based Philox + Lemire
bounded ints), resample (draw-addressable index generation, the
NullDist/BootDist distribution accumulators, and a serial reference
driver), and dist (continuous + discrete distribution objects with
CDF/SF/PDF/quantile).
This crate ships only user-facing docs; design notes and specs live in the umbrella dev repo.
let g1 = [89., 88., 97., 92.];
let g2 = [84., 79., 81., 83.];
let r = commonstats::t_test_two(&g1, &g2, commonstats::VarAssumption::Welch).unwrap();
assert!(r.p_value < 0.05);Re-exports§
pub use error::StatError;pub use nan::NanPolicy;pub use accum::HistResult;pub use accum::Histogram;pub use descriptive::count;pub use descriptive::cov;pub use descriptive::describe;pub use descriptive::kurtosis;pub use descriptive::max;pub use descriptive::mean;pub use descriptive::median;pub use descriptive::min;pub use descriptive::pearson;pub use descriptive::range;pub use descriptive::sd;pub use descriptive::skewness;pub use descriptive::sum;pub use descriptive::var;pub use descriptive::Ddof;pub use descriptive::Describe;pub use htest::anova_one_way;pub use htest::chi2_gof;pub use htest::chi2_independence;pub use htest::cor_test;pub use htest::f_test_var;pub use htest::t_test_one;pub use htest::t_test_paired;pub use htest::t_test_two;pub use htest::CorMethod;pub use htest::TestResult;pub use htest::VarAssumption;
Modules§
- accum
- The mergeable-accumulator core.
mergeis the whole game: one op gives one-pass streaming, parallel chunking, and incremental recompute — never downdating. - density
- Kernel density estimation and auto-binned histograms.
- descriptive
- Batch descriptives — thin finalize() wrappers over the accum accumulators. One source of truth: each fn folds a (NaN-omitted) slice and reads out.
- error
- The crate’s single error type. One enum, returned by every fallible public
API, hand-rolled
Displayto staylibm-only and WASM-clean. - htest
- Hypothesis tests (named
htestto avoid Cargo’stests/integration dir). Test statistics come off the accumulators; p-values come straight from thespecialfunctions (no distribution-object suite yet). - nan
- Missing-data policy — the single home for how the crate treats NaN.
- special
- Centralized special-function surface: all transcendental math the crate needs has one home so accuracy and cross-host behavior have a single choke point.
- transform
- Data transformations: ranking, normal scores, power transforms, PIT family.