Trait statrs::statistics::Mean [−][src]
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]
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 Bernoulli
[src]
impl Mean<f64> for Beta
[src]
impl Mean<f64> for Binomial
[src]
impl Mean<f64> for Categorical
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the categorical distribution
Formula
Σ(j * p_j)
where p_j
is the j
th probability mass,
Σ
is the sum from 0
to k - 1
,
and k
is the number of categories
impl Mean<f64> for Chi
[src]
impl Mean<f64> for ChiSquared
[src]
impl Mean<f64> for DiscreteUniform
[src]
impl Mean<f64> for Erlang
[src]
impl Mean<f64> for Exponential
[src]
impl Mean<f64> for FisherSnedecor
[src]
impl Mean<f64> for Gamma
[src]
impl Mean<f64> for Geometric
[src]
impl Mean<f64> for Hypergeometric
[src]
impl Mean<f64> for InverseGamma
[src]
impl Mean<f64> for LogNormal
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the log-normal distribution
Formula
e^(μ + σ^2 / 2)
where μ
is the location and σ
is the scale
impl Mean<f64> for Normal
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the normal distribution
Remarks
This is the same mean used to construct the distribution
impl Mean<f64> for Pareto
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the Pareto distribution
Formula
if α <= 1 { INF } else { (α * x_m)/(α - 1) }
where x_m
is the scale and α
is the shape
impl Mean<f64> for Poisson
[src]
impl Mean<f64> for StudentsT
[src]
impl Mean<f64> for Triangular
[src]
impl Mean<f64> for Uniform
[src]
impl Mean<f64> for Weibull
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the weibull distribution
Formula
λΓ(1 + 1 / k)
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
impl Mean<Vec<f64, Global>> for Dirichlet
[src]
fn mean(&self) -> Vec<f64>
[src]
Returns the means of the dirichlet distribution
Formula
α_i / α_0
for the i
th element where α_i
is the i
th concentration parameter
and α_0
is the sum of all concentration parameters