Crate average [] [src]

This crate provides estimators for the weighted and unweighted average of a sequence of numbers, and for their standard errors. The typical workflow looks like this:

  1. Initialize your estimator of choice (Average or WeightedAverage) with new().
  2. Add some subset (called "samples") of the sequence of numbers (called "population") for which you want to estimate the average, using add() or collect().
  3. Calculate the arithmetic mean with mean() and its standard error with `error().

You can run several estimators in parallel and merge them into one with merge().


use average::Average;

let mut a: Average = (1..6).map(Into::into).collect();
println!("The average is {} ± {}.", a.mean(), a.error());



Assert that two numbers are almost equal to each other.



Estimate the arithmetic mean and the variance of a sequence of numbers ("population").


Estimate the weighted and unweighted arithmetic mean and the unweighted variance of a sequence of numbers ("population").