Trait statrs::statistics::Mean [−][src]
pub trait Mean<T> { fn mean(&self) -> T; }
The Mean
trait specifies that an object has a closed form
solution for its mean(s)
Required methods
fn mean(&self) -> T
[src]
Returns the mean. May panic depending on the implementor.
Examples
use statrs::statistics::Mean; use statrs::distribution::Uniform; let n = Uniform::new(0.0, 1.0).unwrap(); assert_eq!(0.5, n.mean());
Implementations on Foreign Types
impl Mean<f64> for [f64]
[src]
impl Mean<f64> for [f64]
[src]fn mean(&self) -> f64
[src]
Evaluates the sample mean, an estimate of the population mean.
Remarks
Returns f64::NAN
if data is empty or an entry is f64::NAN
Examples
#[macro_use] extern crate statrs; use std::f64; use statrs::statistics::Mean; let x = []; assert!(x.mean().is_nan()); let y = [0.0, f64::NAN, 3.0, -2.0]; assert!(y.mean().is_nan()); let z = [0.0, 3.0, -2.0]; assert_almost_eq!(z.mean(), 1.0 / 3.0, 1e-15);
Implementors
impl Mean<f64> for Categorical
[src]
impl Mean<f64> for Categorical
[src]impl Mean<f64> for ChiSquared
[src]
impl Mean<f64> for ChiSquared
[src]impl Mean<f64> for DiscreteUniform
[src]
impl Mean<f64> for DiscreteUniform
[src]impl Mean<f64> for Exponential
[src]
impl Mean<f64> for Exponential
[src]impl Mean<f64> for FisherSnedecor
[src]
impl Mean<f64> for FisherSnedecor
[src]impl Mean<f64> for Hypergeometric
[src]
impl Mean<f64> for Hypergeometric
[src]impl Mean<f64> for InverseGamma
[src]
impl Mean<f64> for InverseGamma
[src]impl Mean<f64> for Triangular
[src]
impl Mean<f64> for Triangular
[src]