Trait statrs::statistics::CheckedMode[][src]

pub trait CheckedMode<T> {
    fn checked_mode(&self) -> Result<T>;
}

The CheckedMode trait specifies that an object has a closed form solution for its mode(s) with a possible failure mode

Required methods

fn checked_mode(&self) -> Result<T>[src]

Returns the mode.

Examples

use statrs::statistics::CheckedMode;
use statrs::distribution::Beta;

let n = Beta::new(1.0, 1.0).unwrap();
assert!(n.checked_mode().is_err());
Loading content...

Implementors

impl CheckedMode<f64> for Beta[src]

fn checked_mode(&self) -> Result<f64>[src]

Returns the mode of the Beta distribution.

Remarks

Since the mode is technically only calculate for α > 1, β > 1, those are the only values we allow. We may consider relaxing this constraint in the future.

Errors

If α <= 1 or β <= 1

Formula

(α - 1) / (α + β - 2)

where α is shapeA and β is shapeB

impl CheckedMode<f64> for Chi[src]

fn checked_mode(&self) -> Result<f64>[src]

Returns the mode for the chi distribution

Errors

If freedom < 1.0

Formula

sqrt(k - 1)

where k is the degrees of freedom

impl CheckedMode<f64> for FisherSnedecor[src]

fn checked_mode(&self) -> Result<f64>[src]

Returns the mode for the fisher-snedecor distribution

Errors

If freedom_1 <= 2.0

Remarks

Returns NaN if freedom_1 or freedom_2 is INF

Formula

((d1 - 2) / d1) * (d2 / (d2 + 2))

where d1 is the first degree of freedom and d2 is the second degree of freedom

Loading content...