pub struct Weibull { /* fields omitted */ }
Implements the Weibull
distribution
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);
Constructs a new weibull distribution with a shape (k) of shape
and a scale (λ) of scale
Returns an error if shape
or scale
are NaN
.
Returns an error if shape <= 0.0
or scale <= 0.0
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
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
use statrs::distribution::Weibull;
let n = Weibull::new(10.0, 1.0).unwrap();
assert_eq!(n.scale(), 1.0);
Formats the value using the given formatter. Read more
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
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
Calculates the cumulative distribution function for the weibull
distribution at x
1 - e^-((x/λ)^k)
where k
is the shape and λ
is the scale
Returns the minimum value in the domain of the weibull
distribution representable by a double precision float
0
Returns the maximum value in the domain of the weibull
distribution representable by a double precision float
INF
Returns the mean of the weibull distribution
λΓ(1 + 1 / k)
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
Returns the variance of the weibull distribution
λ^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
sqrt(λ^2 * (Γ(1 + 2 / k) - Γ(1 + 1 / k)^2))
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
Returns the entropy of the weibull distribution
γ(1 - 1 / k) + ln(λ / k) + 1
where k
is the shape, λ
is the scale, and γ
is
the Euler-Mascheroni constant
Returns the skewness of the weibull distribution
(Γ(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
Returns the median of the weibull distribution
λ(ln(2))^(1 / k)
where k
is the shape and λ
is the scale
Returns the median of the weibull distribution
if k == 1 {
0
} else {
λ((k - 1) / k)^(1 / k)
}
where k
is the shape and λ
is the scale
Calculates the probability density function for the weibull
distribution at x
(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
ln((k / λ) * (x / λ)^(k - 1) * e^(-(x / λ)^k))
where k
is the shape and λ
is the scale