Update documentation
This commit is contained in:
parent
bea79374e3
commit
80e92f6176
@ -4,10 +4,11 @@ name = "average"
|
|||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/vks/average"
|
repository = "https://github.com/vks/average"
|
||||||
description = "Calculate the average of a sequence and its error iteratively"
|
description = "Calculate statistics iteratively"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
categories = ["science", "no-std"]
|
categories = ["science", "no-std"]
|
||||||
keywords = ["statistics", "stats"]
|
keywords = ["statistics", "stats", "mean", "variance", "skewness",
|
||||||
|
"kurtosis", "quantile"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
conv = "0.3"
|
conv = "0.3"
|
||||||
|
12
README.md
12
README.md
@ -1,7 +1,7 @@
|
|||||||
# average
|
# average
|
||||||
|
|
||||||
Calculate the average of a sequence and its error iteratively in a single pass,
|
Calculate statistics of a sequence iteratively in a single pass, using
|
||||||
using constant memory and avoiding numerical problems. The calculation can be
|
constant memory and avoiding numerical problems. The calculations can be
|
||||||
easily parallelized by using `merge`.
|
easily parallelized by using `merge`.
|
||||||
|
|
||||||
[Documentation](https://docs.rs/average) |
|
[Documentation](https://docs.rs/average) |
|
||||||
@ -9,7 +9,9 @@ easily parallelized by using `merge`.
|
|||||||
|
|
||||||
[![Build Status](https://travis-ci.org/vks/average.svg?branch=master)](https://travis-ci.org/vks/average)
|
[![Build Status](https://travis-ci.org/vks/average.svg?branch=master)](https://travis-ci.org/vks/average)
|
||||||
|
|
||||||
## Advantages over naive calculation of average and variance
|
## Implemented statistics
|
||||||
|
|
||||||
* Avoids loss of precision due to cancellation.
|
* Mean and its error.
|
||||||
* Only needs a single pass over the samples, at the cost of a division inside the loop.
|
* Variance, skewness, kurtosis.
|
||||||
|
* Minium and maximum.
|
||||||
|
* Quantile.
|
||||||
|
51
src/lib.rs
51
src/lib.rs
@ -1,14 +1,11 @@
|
|||||||
//! This crate provides estimators for the weighted and unweighted average of a
|
//! This crate provides estimators for statistics on a sequence of numbers. The
|
||||||
//! sequence of numbers, and for their standard errors. The typical workflow
|
//! typical workflow looks like this:
|
||||||
//! looks like this:
|
|
||||||
//!
|
//!
|
||||||
//! 1. Initialize your estimator of choice ([`Mean`], [`MeanWithError`],
|
//! 1. Initialize the estimator of your choice with `new()`.
|
||||||
//! [`WeightedMean`] or [`WeightedMeanWithError`]) with `new()`.
|
//! 2. Add some subset (called "sample") of the sequence of numbers (called
|
||||||
//! 2. Add some subset (called "samples") of the sequence of numbers (called
|
//! "population") for which you want to estimate the statistic, using `add()`
|
||||||
//! "population") for which you want to estimate the average, using `add()`
|
|
||||||
//! or `collect()`.
|
//! or `collect()`.
|
||||||
//! 3. Calculate the arithmetic mean with `mean()` and its standard error with
|
//! 3. Calculate the statistic with `mean()` or similar.
|
||||||
//! `error()`.
|
|
||||||
//!
|
//!
|
||||||
//! You can run several estimators in parallel and merge them into one with
|
//! You can run several estimators in parallel and merge them into one with
|
||||||
//! `merge()`.
|
//! `merge()`.
|
||||||
@ -17,10 +14,38 @@
|
|||||||
//! so the sequence of numbers can be an iterator. The used algorithms try to
|
//! so the sequence of numbers can be an iterator. The used algorithms try to
|
||||||
//! avoid numerical instabilities.
|
//! avoid numerical instabilities.
|
||||||
//!
|
//!
|
||||||
//! [`Mean`]: ./average/struct.Mean.html
|
//!
|
||||||
//! [`MeanWithError`]: ./average/struct.MeanWithError.html
|
//! ## Estimators
|
||||||
//! [`WeightedMean`]: ./weighted_average/struct.WeightedMean.html
|
//!
|
||||||
//! [`WeightedMeanWithError`]: ./weighted_average/struct.WeightedMeanWithError.html
|
//! * Mean ([`Mean`]) and its error ([`MeanWithError`]).
|
||||||
|
//! * Weighted mean ([`WeightedMean`]) and its error
|
||||||
|
//! ([`WeightedMeanWithError`]).
|
||||||
|
//! * Variance ([`Variance`]), skewness ([`Skewness`]) and kurtosis
|
||||||
|
//! ([`Kurtosis`]).
|
||||||
|
//! * Quantiles ([`Quantile`]).
|
||||||
|
//! * Minimum ([`Min`]) and maximum ([`Max`]).
|
||||||
|
//!
|
||||||
|
//! [`Mean`]: ./struct.Mean.html
|
||||||
|
//! [`MeanWithError`]: ./type.MeanWithError.html
|
||||||
|
//! [`WeightedMean`]: ./struct.WeightedMean.html
|
||||||
|
//! [`WeightedMeanWithError`]: ./struct.WeightedMeanWithError.html
|
||||||
|
//! [`Variance`]: ./struct.Variance.html
|
||||||
|
//! [`Skewness`]: ./struct.Skewness.html
|
||||||
|
//! [`Kurtosis`]: ./struct.Kurtosis.html
|
||||||
|
//! [`Quantile`]: ./struct.Quantile.html
|
||||||
|
//! [`Min`]: ./struct.Min.html
|
||||||
|
//! [`Max`]: ./struct.Max.html
|
||||||
|
//!
|
||||||
|
//!
|
||||||
|
//! ## Estimating several statistics at once
|
||||||
|
//!
|
||||||
|
//! The estimators are designed to have minimal state. The recommended way to
|
||||||
|
//! calculate several of them at once is to create a struct with all the
|
||||||
|
//! estimators you need. You can then implement `add` for your struct by
|
||||||
|
//! forwarding to the underlying estimators.
|
||||||
|
//!
|
||||||
|
//! Note that calculating moments requires calculating the lower moments, so you
|
||||||
|
//! only need to include the highest moment in your struct.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
|
@ -3,4 +3,5 @@ include!("variance.rs");
|
|||||||
include!("skewness.rs");
|
include!("skewness.rs");
|
||||||
include!("kurtosis.rs");
|
include!("kurtosis.rs");
|
||||||
|
|
||||||
|
/// Alias for `Variance`.
|
||||||
pub type MeanWithError = Variance;
|
pub type MeanWithError = Variance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user