Struct statrs::distribution::Weibull [−][src]
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);
Implementations
impl Weibull
[src]
pub fn new(shape: f64, scale: f64) -> Result<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());
pub fn shape(&self) -> f64
[src]
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);
pub fn scale(&self) -> f64
[src]
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 Clone for Weibull
[src]
impl Continuous<f64, f64> for Weibull
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the weibull
distribution at x
Formula
(k / λ) * (x / λ)^(k - 1) * e^(-(x / λ)^k)
where k
is the shape and λ
is the scale
fn ln_pdf(&self, x: f64) -> f64
[src]
Calculates the log probability density function for the weibull
distribution at x
Formula
ln((k / λ) * (x / λ)^(k - 1) * e^(-(x / λ)^k))
where k
is the shape and λ
is the scale
impl Copy for Weibull
[src]
impl Debug for Weibull
[src]
impl Distribution<f64> for Weibull
[src]
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> f64
[src]
pub fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Entropy<f64> for Weibull
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the weibull distribution
Formula
γ(1 - 1 / k) + ln(λ / k) + 1
where k
is the shape, λ
is the scale, and γ
is
the Euler-Mascheroni constant
impl Max<f64> for Weibull
[src]
fn max(&self) -> f64
[src]
Returns the maximum value in the domain of the weibull distribution representable by a double precision float
Formula
INF
impl Mean<f64> for Weibull
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the weibull distribution
Formula
λΓ(1 + 1 / k)
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
impl Median<f64> for Weibull
[src]
fn median(&self) -> f64
[src]
Returns the median of the weibull distribution
Formula
λ(ln(2))^(1 / k)
where k
is the shape and λ
is the scale
impl Min<f64> for Weibull
[src]
fn min(&self) -> f64
[src]
Returns the minimum value in the domain of the weibull distribution representable by a double precision float
Formula
0
impl Mode<f64> for Weibull
[src]
fn mode(&self) -> f64
[src]
Returns the median of the weibull distribution
Formula
if k == 1 { 0 } else { λ((k - 1) / k)^(1 / k) }
where k
is the shape and λ
is the scale
impl PartialEq<Weibull> for Weibull
[src]
impl Skewness<f64> for Weibull
[src]
fn skewness(&self) -> f64
[src]
Returns the skewness of the weibull distribution
Formula
(Γ(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 StructuralPartialEq for Weibull
[src]
impl Univariate<f64, f64> for Weibull
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the weibull
distribution at x
Formula
1 - e^-((x/λ)^k)
where k
is the shape and λ
is the scale
impl Variance<f64> for Weibull
[src]
fn variance(&self) -> f64
[src]
Returns the variance of the weibull distribution
Formula
λ^2 * (Γ(1 + 2 / k) - Γ(1 + 1 / k)^2)
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
fn std_dev(&self) -> f64
[src]
Returns the standard deviation of the weibull distribution
Formula
sqrt(λ^2 * (Γ(1 + 2 / k) - Γ(1 + 1 / k)^2))
where k
is the shape, λ
is the scale, and Γ
is
the gamma function
Auto Trait Implementations
impl RefUnwindSafe for Weibull
impl Send for Weibull
impl Sync for Weibull
impl Unpin for Weibull
impl UnwindSafe for Weibull
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,