Trait statrs::statistics::CheckedVariance[][src]

pub trait CheckedVariance<T>: CheckedMean<T> {
    fn checked_variance(&self) -> Result<T>;
fn checked_std_dev(&self) -> Result<T>; }

Required methods

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

Returns the variance.

Examples

use statrs::statistics::CheckedVariance;
use statrs::distribution::FisherSnedecor;

let n = FisherSnedecor::new(1.0, 1.0).unwrap();
assert!(n.checked_variance().is_err());

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

Returns the standard deviation.

Examples

use statrs::statistics::CheckedVariance;
use statrs::distribution::FisherSnedecor;

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

Implementors

impl CheckedVariance<f64> for FisherSnedecor[src]

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

Returns the variance of the fisher-snedecor distribution

Errors

If freedom_2 <= 4.0

Remarks

Returns NaN if freedom_1 or freedom_2 is INF

Formula

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

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

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

Returns the standard deviation of the fisher-snedecor distribution

Errors

If freedom_2 <= 4.0

Remarks

Returns NaN if freedom_1 or freedom_2 is INF

Formula

sqrt((2 * d2^2 * (d1 + d2 - 2)) / (d1 * (d2 - 2)^2 * (d2 - 4)))

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

impl CheckedVariance<f64> for Hypergeometric[src]

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

Returns the variance of the hypergeometric distribution

Errors

If N <= 1

Formula

n * (K / N) * ((N - K) / N) * ((N - n) / (N - 1))

where N is population, K is successes, and n is draws

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

Returns the standard deviation of the hypergeometric distribution

Errors

If N <= 1

Formula

sqrt(n * (K / N) * ((N - K) / N) * ((N - n) / (N - 1)))

where N is population, K is successes, and n is draws

impl CheckedVariance<f64> for InverseGamma[src]

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

Returns the variance of the inverse gamma distribution

Errors

If shape <= 2.0

Formula

β^2 / ((α - 1)^2 * (α - 2))

where α is the shape and β is the rate

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

Returns the standard deviation of the inverse gamma distribution

Errors

If shape <= 2.0

Formula

sqrt(β^2 / ((α - 1)^2 * (α - 2)))

where α is the shape and β is the rate

impl CheckedVariance<f64> for StudentsT[src]

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

Returns the variance of the student’s t-distribution

Errors

If freedom <= 1.0

Formula

if v == INF {
    σ^2
} else if freedom > 2.0 {
    v * σ^2 / (v - 2)
} else {
    INF
}

where σ is the scale and v is the freedom

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

Returns the standard deviation of the student’s t-distribution

Errors

If freedom <= 1.0

Formula

let variance = if v == INF {
    σ^2
} else if freedom > 2.0 {
    v * σ^2 / (v - 2)
} else {
    INF
}
sqrt(variance)

where σ is the scale and v is the freedom

Loading content...