pub struct Loglogistic { /* private fields */ }Expand description
Loglogistic distribution with shape α and scale θ:
F(x) = (x/θ)^α / (1 + (x/θ)^α), as SciPy’s fisk(c=α, scale=θ) and
actuar’s dllogis(shape, scale). Its median is θ.
It is also the growth curve of Clark’s LDF method, G(t) = t^ω / (t^ω + θ^ω),
so a fitted curve is this distribution’s cdf.
The tail is Pareto-like: E[X^j] is finite only for j < α, so the
mean is infinite for α <= 1 and the variance for α <= 2. Limited and
layer moments are finite for every α. With v = F(u),
E[min(X, u)^j] = θ^j B(1 + j/α, 1 - j/α; v) + u^j (1 - v), using the
unnormalized incomplete beta, which for j >= α has a non-positive
second argument and is reached by recurrence.
use prospicio_prob::{Distribution, Loglogistic, Severity};
// Shape 1: F(x) = x / (x + θ) and E[min(X, u)] = θ ln(1 + u/θ).
let d = Loglogistic::new(1.0, 2.0).unwrap();
assert!((d.cdf(3.0) - 0.6).abs() < 1e-15);
assert!((d.lev(3.0) - 2.0 * 2.5f64.ln()).abs() < 1e-13);
assert!(d.mean().is_infinite());Implementations§
Trait Implementations§
Source§impl Clone for Loglogistic
impl Clone for Loglogistic
Source§fn clone(&self) -> Loglogistic
fn clone(&self) -> Loglogistic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Loglogistic
Source§impl Debug for Loglogistic
impl Debug for Loglogistic
Source§impl Distribution for Loglogistic
impl Distribution for Loglogistic
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
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 From<Loglogistic> for Dist
impl From<Loglogistic> for Dist
Source§fn from(d: Loglogistic) -> Self
fn from(d: Loglogistic) -> Self
Source§impl PartialEq for Loglogistic
impl PartialEq for Loglogistic
Source§impl Severity for Loglogistic
impl Severity for Loglogistic
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; infinite for
α <= 1.
Source§fn layer(&self, limit: f64, attachment: f64) -> f64
fn layer(&self, limit: f64, attachment: f64) -> f64
∫_a^(a+l) S(x) dx, by the tail series in the tail.
impl StructuralPartialEq for Loglogistic
Auto Trait Implementations§
impl Freeze for Loglogistic
impl RefUnwindSafe for Loglogistic
impl Send for Loglogistic
impl Sync for Loglogistic
impl Unpin for Loglogistic
impl UnsafeUnpin for Loglogistic
impl UnwindSafe for Loglogistic
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
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> ⓘ
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> ⓘ
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