Trait statrs::distribution::CheckedInverseCDF[][src]

pub trait CheckedInverseCDF<T> {
    fn checked_inverse_cdf(&self, x: T) -> Result<T>;
}

The CheckedInverseCDF trait is used to specify an interface for distributions with a closed form solution to the inverse cumulative distribution function with possible failure modes. This trait should be merged into a CheckedUnivarite trait alongside InverseCDF in a future release.

Required methods

fn checked_inverse_cdf(&self, x: T) -> Result<T>[src]

Returns the inverse cumulative distribution function calculated at x for a given distribution. May panic depending on the implementor.

Examples

use statrs::distribution::CheckedInverseCDF;
use statrs::distribution::Categorical;

let n = Categorical::new(&[0.0, 1.0, 2.0]).unwrap();
assert!(n.checked_inverse_cdf(-1.0).is_err());
Loading content...

Implementors

impl CheckedInverseCDF<f64> for Categorical[src]

fn checked_inverse_cdf(&self, x: f64) -> Result<f64>[src]

Calculates the inverse cumulative distribution function for the categorical distribution at x

Errors

If x <= 0.0 or x >= 1.0

Formula

i

where i is the first index such that x < f(i) and f(x) is defined as p_x + f(x - 1) and f(0) = p_0 where p_x is the xth probability mass

impl CheckedInverseCDF<f64> for Normal[src]

fn checked_inverse_cdf(&self, x: f64) -> Result<f64>[src]

Calculates the inverse cumulative distribution function for the normal distribution at x

Errors

If x < 0.0 or x > 1.0

Formula

μ - sqrt(2) * σ * erfc_inv(2x)

where μ is the mean, σ is the standard deviation and erfc_inv is the inverse of the complementary error function

Loading content...