Trait statrs::statistics::Distribution[][src]

pub trait Distribution<T: Float>: Distribution<T> {
    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

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());

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());

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());

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());

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