pub struct Weibull { /* private fields */ }Expand description
Weibull distribution with shape parameter β (> 0) and scale parameter η (> 0).
Widely used in reliability engineering and survival analysis.
§Mathematical Definition
- PDF: f(t) = (β/η)·(t/η)^(β−1)·exp(−(t/η)^β) for t ≥ 0
- CDF: F(t) = 1 − exp(−(t/η)^β)
- Quantile: t = η·(−ln(1−p))^(1/β)
- Mean: η·Γ(1 + 1/β)
- Variance: η²·[Γ(1 + 2/β) − Γ(1 + 1/β)²]
§Special Cases
- β = 1: Exponential distribution with rate 1/η
- β = 2: Rayleigh distribution
- β ≈ 3.6: Approximates a normal distribution
Reference: Weibull (1951), “A Statistical Distribution Function of Wide Applicability”, Journal of Applied Mechanics 18(3), pp. 293–297.
Implementations§
Source§impl Weibull
impl Weibull
Sourcepub fn new(shape: f64, scale: f64) -> Result<Self, DistributionError>
pub fn new(shape: f64, scale: f64) -> Result<Self, DistributionError>
Creates a new Weibull distribution with the given shape (β) and scale (η).
§Errors
Returns Err if shape ≤ 0, scale ≤ 0, or either is not finite.
Sourcepub fn quantile(&self, p: f64) -> Option<f64>
pub fn quantile(&self, p: f64) -> Option<f64>
Quantile (inverse CDF): t = η·(−ln(1−p))^(1/β).
Returns None if p is outside [0, 1).
Sourcepub fn hazard_rate(&self, t: f64) -> f64
pub fn hazard_rate(&self, t: f64) -> f64
Hazard rate (failure rate): λ(t) = (β/η)·(t/η)^(β−1).
- β < 1: Decreasing failure rate (infant mortality)
- β = 1: Constant failure rate (random failures)
- β > 1: Increasing failure rate (wear-out)
Sourcepub fn reliability(&self, t: f64) -> f64
pub fn reliability(&self, t: f64) -> f64
Reliability (survival) function: R(t) = 1 − F(t) = exp(−(t/η)^β).
Trait Implementations§
impl StructuralPartialEq for Weibull
Auto Trait Implementations§
impl Freeze for Weibull
impl RefUnwindSafe for Weibull
impl Send for Weibull
impl Sync for Weibull
impl Unpin for Weibull
impl UnsafeUnpin for Weibull
impl UnwindSafe for Weibull
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more