Expand description
§iterstats
Statistics for rust iterators.
Extra iterator methods for common statistics operations.
To most easily get the functionality of this crate, import the Iterstats trait. See the methods belonging to the trait for all available functionality.
§Example
// import the `Iterstats` trait into scope
use iterstats::Iterstats;
// start with your dataset
let data = [1f32, 2., 3., 4.];
// say you want the mean
let mean = data.iter().mean();
assert_eq!(mean, 2.5);
// get the variance
let variance = data.iter().variance();
assert_eq!(variance, 1.25);
// or standard deviation
let stddev = data.iter().stddev();
assert_eq!(stddev, 1.25f32.sqrt());
// or the zscore of each data point
let zscores = data.iter().zscore().collect::<Vec<_>>();
assert_eq!(zscores, vec![-1.3416407, -0.4472136, 0.4472136, 1.3416407]);§Additional
Shoutout to
itertools, which was one of the inspirations for this project.
Re-exports§
pub use fill_nan::FillNan;pub use mean::Mean;pub use median::Median;pub use normalize::Normalize;pub use stddev::StdDev;pub use sum_of_squares::SumOfSquares;pub use variance::Variance;pub use zscore::ZScore;
Modules§
- argsort
- Calculate argsort.
- fill_
nan - Replace NANs with something else.
- mean
- Caculate the mean/average.
- median
- Calculate the median.
- normalize
- Normalize a dataset to a range.
- range
- Calculate the range.
- rank
- Calcualte rank.
- stddev
- Calculate the standard deviation.
- sum_
of_ squares - Caculate the total sum of squares.
- variance
- Caculate the variance.
- zscore
- Calculate the z-score.