pub trait Distribution<T: Float>: Distribution<T> {
    // Provided methods
    fn mean(&self) -> Option<T> { ... }
    fn variance(&self) -> Option<T> { ... }
    fn std_dev(&self) -> Option<T> { ... }
    fn entropy(&self) -> Option<T> { ... }
    fn skewness(&self) -> Option<T> { ... }
}

Provided Methods§

source

fn mean(&self) -> Option<T>

Returns the mean, if it exists. The default implementation returns an estimation based on random samples. This is a crude estimate for when no further information is known about the distribution. More accurate statements about the mean can and should be given by overriding the default implementation.

Examples
use statrs::statistics::Distribution;
use statrs::distribution::Uniform;

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(0.5, n.mean().unwrap());
source

fn variance(&self) -> Option<T>

Returns the variance, if it exists. The default implementation returns an estimation based on random samples. This is a crude estimate for when no further information is known about the distribution. More accurate statements about the variance can and should be given by overriding the default implementation.

Examples
use statrs::statistics::Distribution;
use statrs::distribution::Uniform;

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(1.0 / 12.0, n.variance().unwrap());
source

fn std_dev(&self) -> Option<T>

Returns the standard deviation, if it exists.

Examples
use statrs::statistics::Distribution;
use statrs::distribution::Uniform;

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!((1f64 / 12f64).sqrt(), n.std_dev().unwrap());
source

fn entropy(&self) -> Option<T>

Returns the entropy, if it exists.

Examples
use statrs::statistics::Distribution;
use statrs::distribution::Uniform;

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(0.0, n.entropy().unwrap());
source

fn skewness(&self) -> Option<T>

Returns the skewness, if it exists.

Examples
use statrs::statistics::Distribution;
use statrs::distribution::Uniform;

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(0.0, n.skewness().unwrap());

Implementors§