use-statistics
Install
[]
= "0.0.1"
Foundation
use-statistics provides a deliberately small descriptive-statistics surface over f64 slices. The crate currently exposes arithmetic mean, median, population variance, sample variance, and matching standard-deviation helpers, along with an explicit StatisticsError for empty inputs and too-small samples. The first slice stays simple and direct instead of introducing a full dataframe or distribution framework.
| Helper group | Primary items | Best fit |
|---|---|---|
| Central tendency | mean, median |
Small apps and utilities that need direct descriptive summaries |
| Dispersion | population_variance, sample_variance, population_std_dev, sample_std_dev |
Call sites that should remain explicit about population vs. sample summaries |
| Error handling | StatisticsError |
Code that needs predictable handling for empty or undersized inputs |
When to use directly
Choose use-statistics directly when statistical summaries or distributions are the only surface you need and you want to keep that concern narrower than the full facade.
| Scenario | Use use-statistics directly? |
Why |
|---|---|---|
You need descriptive summaries over f64 slices |
Yes | The current API already covers the common location and dispersion cases directly |
| You want explicit population-vs-sample summary functions | Yes | The function names keep estimator choice visible at the call site |
| You also need probability, calculus, or other math domains | Usually no | use-math can compose the concrete surfaces behind features |
Scope
- The current surface is intentionally small and concrete.
- Helpers operate over borrowed
f64slices instead of introducing dataset wrapper types. - Probability primitives and broader numerical analysis belong in adjacent focused crates.
Examples
Central tendency and population summaries
use ;
let values = ;
assert!;
assert!;
assert!;
assert!;
# Ok::
Sample summaries
use ;
let sample = ;
assert!;
assert!;
# Ok::
Status
use-statistics is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent probability and numeric-analysis crates continue to grow around it.