pub struct LargeLosses { /* private fields */ }Expand description
Large losses for maximum likelihood fits: values, and optionally a reporting threshold, a censoring flag and a weight per loss.
use prospicio_prob::{LargeLosses, Pareto};
let data = LargeLosses::new(vec![1500.0, 2500.0, 4000.0, 10_000.0])
.unwrap()
.censored(vec![false, false, false, true])
.unwrap();
// α = (uncensored count) / Σ ln(y / t) = 3 / ln(1.5 · 2.5 · 4 · 10).
let fit = Pareto::fit(1000.0, &data, None).unwrap();
assert!((fit.alpha() - 3.0 / 150f64.ln()).abs() < 1e-14);Implementations§
Source§impl LargeLosses
impl LargeLosses
Sourcepub fn new(values: Vec<f64>) -> Result<Self>
pub fn new(values: Vec<f64>) -> Result<Self>
Losses (finite, positive), uncensored, with weight 1 and no reporting threshold beyond the fitted distribution’s own.
Sourcepub fn reporting_thresholds(self, reporting: Vec<f64>) -> Result<Self>
pub fn reporting_thresholds(self, reporting: Vec<f64>) -> Result<Self>
Per-loss reporting thresholds r_i ≤ y_i (finite, non-negative).
Sourcepub fn censored(self, censored: Vec<bool>) -> Result<Self>
pub fn censored(self, censored: Vec<bool>) -> Result<Self>
Per-loss censoring: true where the loss was capped by a policy
limit at its recorded value.
pub fn values(&self) -> &[f64]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for LargeLosses
impl Clone for LargeLosses
Source§fn clone(&self) -> LargeLosses
fn clone(&self) -> LargeLosses
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LargeLosses
impl Debug for LargeLosses
Source§impl PartialEq for LargeLosses
impl PartialEq for LargeLosses
impl StructuralPartialEq for LargeLosses
Auto Trait Implementations§
impl Freeze for LargeLosses
impl RefUnwindSafe for LargeLosses
impl Send for LargeLosses
impl Sync for LargeLosses
impl Unpin for LargeLosses
impl UnsafeUnpin for LargeLosses
impl UnwindSafe for LargeLosses
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