Struct statrs::distribution::Weibull[][src]

pub struct Weibull { /* fields omitted */ }

Implements the Weibull distribution

Examples

use statrs::distribution::{Weibull, Continuous};
use statrs::statistics::Mean;
use statrs::prec;

let n = Weibull::new(10.0, 1.0).unwrap();
assert!(prec::almost_eq(n.mean(),
0.95135076986687318362924871772654021925505786260884, 1e-15));
assert_eq!(n.pdf(1.0), 3.6787944117144232159552377016146086744581113103177);

Methods

impl Weibull
[src]

Constructs a new weibull distribution with a shape (k) of shape and a scale (λ) of scale

Errors

Returns an error if shape or scale are NaN. Returns an error if shape <= 0.0 or scale <= 0.0

Examples

use statrs::distribution::Weibull;

let mut result = Weibull::new(10.0, 1.0);
assert!(result.is_ok());

result = Weibull::new(0.0, 0.0);
assert!(result.is_err());

Returns the shape of the weibull distribution

Examples

use statrs::distribution::Weibull;

let n = Weibull::new(10.0, 1.0).unwrap();
assert_eq!(n.shape(), 10.0);

Returns the scale of the weibull distribution

Examples

use statrs::distribution::Weibull;

let n = Weibull::new(10.0, 1.0).unwrap();
assert_eq!(n.scale(), 1.0);

Trait Implementations

impl Debug for Weibull
[src]

Formats the value using the given formatter. Read more

impl Copy for Weibull
[src]

impl Clone for Weibull
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Weibull
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Distribution<f64> for Weibull
[src]

Generate a random value of T, using rng as the source of randomness.

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

impl Univariate<f64, f64> for Weibull
[src]

Calculates the cumulative distribution function for the weibull distribution at x

Formula

This example is not tested
1 - e^-((x/λ)^k)

where k is the shape and λ is the scale

impl Min<f64> for Weibull
[src]

Returns the minimum value in the domain of the weibull distribution representable by a double precision float

Formula

This example is not tested
0

impl Max<f64> for Weibull
[src]

Returns the maximum value in the domain of the weibull distribution representable by a double precision float

Formula

This example is not tested
INF

impl Mean<f64> for Weibull
[src]

Returns the mean of the weibull distribution

Formula

This example is not tested
λΓ(1 + 1 / k)

where k is the shape, λ is the scale, and Γ is the gamma function

impl Variance<f64> for Weibull
[src]

Returns the variance of the weibull distribution

Formula

This example is not tested
λ^2 * (Γ(1 + 2 / k) - Γ(1 + 1 / k)^2)

where k is the shape, λ is the scale, and Γ is the gamma function

Returns the standard deviation of the weibull distribution

Formula

This example is not tested
sqrt(λ^2 * (Γ(1 + 2 / k) - Γ(1 + 1 / k)^2))

where k is the shape, λ is the scale, and Γ is the gamma function

impl Entropy<f64> for Weibull
[src]

Returns the entropy of the weibull distribution

Formula

This example is not tested
γ(1 - 1 / k) + ln(λ / k) + 1

where k is the shape, λ is the scale, and γ is the Euler-Mascheroni constant

impl Skewness<f64> for Weibull
[src]

Returns the skewness of the weibull distribution

Formula

This example is not tested
(Γ(1 + 3 / k) * λ^3 - 3μσ^2 - μ^3) / σ^3

where k is the shape, λ is the scale, and Γ is the gamma function, μ is the mean of the distribution. and σ the standard deviation of the distribution

impl Median<f64> for Weibull
[src]

Returns the median of the weibull distribution

Formula

This example is not tested
λ(ln(2))^(1 / k)

where k is the shape and λ is the scale

impl Mode<f64> for Weibull
[src]

Returns the median of the weibull distribution

Formula

This example is not tested
if k == 1 {
    0
} else {
    λ((k - 1) / k)^(1 / k)
}

where k is the shape and λ is the scale

impl Continuous<f64, f64> for Weibull
[src]

Calculates the probability density function for the weibull distribution at x

Formula

This example is not tested
(k / λ) * (x / λ)^(k - 1) * e^(-(x / λ)^k)

where k is the shape and λ is the scale

Calculates the log probability density function for the weibull distribution at x

Formula

This example is not tested
ln((k / λ) * (x / λ)^(k - 1) * e^(-(x / λ)^k))

where k is the shape and λ is the scale

Auto Trait Implementations

impl Send for Weibull

impl Sync for Weibull