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:
- Initialize your estimator of choice (
Average,WeightedAverageorWeightedAverage2) withnew(). - Add some subset (called "samples") of the sequence of numbers (called
"population") for which you want to estimate the average, using
add()orcollect(). - 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().
Example
use average::Average; let mut a: Average = (1..6).map(Into::into).collect(); a.add(42.); println!("The average is {} ± {}.", a.mean(), a.error());
Macros
| assert_almost_eq |
Assert that two numbers are almost equal to each other. |
Structs
| Average |
Estimate the arithmetic mean and the variance of a sequence of numbers ("population"). |
| WeightedAverage |
Estimate the weighted arithmetic mean and the weighted variance of a sequence of numbers ("population"). |
| WeightedAverage2 |
Estimate the weighted and unweighted arithmetic mean and the unweighted variance of a sequence of numbers ("population"). |