Struct average::Variance [−][src]
pub struct Variance { /* fields omitted */ }
Estimate the arithmetic mean and the variance of a sequence of numbers (“population”).
This can be used to estimate the standard error of the mean.
Example
use average::Variance; let a: Variance = (1..6).map(f64::from).collect(); println!("The mean is {} ± {}.", a.mean(), a.error());
Implementations
impl Variance
[src]
impl Variance
[src]pub fn new() -> Variance
[src]
Create a new variance estimator.
pub fn is_empty(&self) -> bool
[src]
Determine whether the sample is empty.
pub fn mean(&self) -> f64
[src]
Estimate the mean of the population.
Returns 0 for an empty sample.
pub fn len(&self) -> u64
[src]
Return the sample size.
pub fn sample_variance(&self) -> f64
[src]
Calculate the sample variance.
This is an unbiased estimator of the variance of the population.
pub fn population_variance(&self) -> f64
[src]
Calculate the population variance of the sample.
This is a biased estimator of the variance of the population.
pub fn variance_of_mean(&self) -> f64
[src]
Estimate the variance of the mean of the population.
pub fn error(&self) -> f64
[src]
Estimate the standard error of the mean of the population.
Trait Implementations
impl<'de> Deserialize<'de> for Variance
[src]
impl<'de> Deserialize<'de> for Variance
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> FromIterator<&'a f64> for Variance
[src]
impl<'a> FromIterator<&'a f64> for Variance
[src]fn from_iter<T>(iter: T) -> Variance where
T: IntoIterator<Item = &'a f64>,
[src]
T: IntoIterator<Item = &'a f64>,
impl FromIterator<f64> for Variance
[src]
impl FromIterator<f64> for Variance
[src]fn from_iter<T>(iter: T) -> Variance where
T: IntoIterator<Item = f64>,
[src]
T: IntoIterator<Item = f64>,
impl<'a> FromParallelIterator<&'a f64> for Variance
[src]
impl<'a> FromParallelIterator<&'a f64> for Variance
[src]fn from_par_iter<I>(par_iter: I) -> Variance where
I: IntoParallelIterator<Item = &'a f64>,
Self: Merge,
[src]
I: IntoParallelIterator<Item = &'a f64>,
Self: Merge,
impl FromParallelIterator<f64> for Variance
[src]
impl FromParallelIterator<f64> for Variance
[src]fn from_par_iter<I>(par_iter: I) -> Variance where
I: IntoParallelIterator<Item = f64>,
Self: Merge,
[src]
I: IntoParallelIterator<Item = f64>,
Self: Merge,
impl Merge for Variance
[src]
impl Merge for Variance
[src]fn merge(&mut self, other: &Variance)
[src]
Merge another sample into this one.
Example
use average::{Variance, Merge}; let sequence: &[f64] = &[1., 2., 3., 4., 5., 6., 7., 8., 9.]; let (left, right) = sequence.split_at(3); let avg_total: Variance = sequence.iter().collect(); let mut avg_left: Variance = left.iter().collect(); let avg_right: Variance = right.iter().collect(); avg_left.merge(&avg_right); assert_eq!(avg_total.mean(), avg_left.mean()); assert_eq!(avg_total.sample_variance(), avg_left.sample_variance());
Auto Trait Implementations
impl RefUnwindSafe for Variance
impl RefUnwindSafe for Variance
impl UnwindSafe for Variance
impl UnwindSafe for Variance
Blanket Implementations
impl<S, T> CastFloat<T> for S where
T: ConvFloat<S>,
[src]
impl<S, T> CastFloat<T> for S where
T: ConvFloat<S>,
[src]pub fn cast_trunc(self) -> T
[src]
pub fn cast_nearest(self) -> T
[src]
pub fn cast_floor(self) -> T
[src]
pub fn cast_ceil(self) -> T
[src]
pub fn try_cast_trunc(self) -> Result<T, Error>
[src]
pub fn try_cast_nearest(self) -> Result<T, Error>
[src]
pub fn try_cast_floor(self) -> Result<T, Error>
[src]
pub fn try_cast_ceil(self) -> Result<T, Error>
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]