pub struct Weibull { /* private fields */ }Expand description
Weibull distribution with shape k and scale λ:
P(X > x) = exp(-(x/λ)^k), as SciPy’s weibull_min(c=k, scale=λ) and
R’s dweibull(shape, scale).
Below shape 1 the tail is heavier than exponential (but every moment
exists); above 1 it is lighter. Layer moments use the regularized
incomplete gamma: with z = (u/λ)^k,
E[X^j; X > u] = λ^j Γ(1 + j/k) Q(1 + j/k, z).
use prospicio_prob::{Distribution, Severity, Weibull};
// Shape 1 is the exponential.
let e = Weibull::new(1.0, 2.0).unwrap();
assert!((e.mean() - 2.0).abs() < 1e-14);
assert!((e.stop_loss(3.0) - 2.0 * (-1.5f64).exp()).abs() < 1e-14);Implementations§
Trait Implementations§
impl Copy for Weibull
Source§impl Distribution for Weibull
impl Distribution for Weibull
Source§fn quantile(&self, p: f64) -> Result<f64>
fn quantile(&self, p: f64) -> Result<f64>
λ (-ln(1 - p))^(1/k), with ln(1 - p) taken as ln_1p(-p).
Source§fn survival(&self, x: f64) -> f64
fn survival(&self, x: f64) -> f64
P(X > x). Representations with a direct form override the
default 1 - cdf(x), which loses all precision far in the tail.Source§fn sample(&self, rng: &mut StreamRng, n: usize) -> Vec<f64>
fn sample(&self, rng: &mut StreamRng, n: usize) -> Vec<f64>
n draws from stream rng, by inverse transform unless the family
overrides it (crate::Gamma draws by Marsaglia and Tsang). Read moreSource§fn is_parallel_safe(&self) -> bool
fn is_parallel_safe(&self) -> bool
Whether the distribution may be evaluated on several threads at
once. True for every native family; false for a
crate::Custom
whose callbacks must stay on the calling thread (an R function), so
the parallel simulations run single-threaded when they meet one.Source§impl Severity for Weibull
impl Severity for Weibull
Source§fn stop_loss(&self, retention: f64) -> f64
fn stop_loss(&self, retention: f64) -> f64
From the tail, so it does not cancel against the mean.
Source§fn layer(&self, limit: f64, attachment: f64) -> f64
fn layer(&self, limit: f64, attachment: f64) -> f64
LEV differences below the mean, stop-loss differences above it.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more