Skip to main content

Severity

Trait Severity 

Source
pub trait Severity: Distribution {
    // Required methods
    fn lev(&self, limit: f64) -> f64;
    fn layer_second_moment(&self, limit: f64, attachment: f64) -> f64;

    // Provided methods
    fn stop_loss(&self, retention: f64) -> f64 { ... }
    fn layer(&self, limit: f64, attachment: f64) -> f64 { ... }
    fn layer_variance(&self, limit: f64, attachment: f64) -> f64 { ... }
}
Expand description

A non-negative loss severity with exact limited moments.

The first three methods are related by lev(d) + stop_loss(d) = mean() and layer(l, a) = stop_loss(a) - stop_loss(a + l). Implementations should compute stop_loss directly rather than as mean() - lev(d), which loses all precision for retentions far in the tail.

Required Methods§

Source

fn lev(&self, limit: f64) -> f64

Limited expected value E[min(X, limit)].

limit <= 0 gives limit (the loss is never below 0) and limit = +inf gives the mean.

Source

fn layer_second_moment(&self, limit: f64, attachment: f64) -> f64

Second moment of the loss to the layer limit xs attachment, E[min(max(X - attachment, 0), limit)^2]. limit = +inf gives the unlimited layer (infinite if the second moment is).

Provided Methods§

Source

fn stop_loss(&self, retention: f64) -> f64

Expected excess over a retention, E[max(X - retention, 0)].

Source

fn layer(&self, limit: f64, attachment: f64) -> f64

Expected loss to the layer limit xs attachment, E[min(max(X - attachment, 0), limit)].

Source

fn layer_variance(&self, limit: f64, attachment: f64) -> f64

Variance of the loss to the layer limit xs attachment.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Severity + ?Sized> Severity for Box<T>

Source§

fn lev(&self, limit: f64) -> f64

Source§

fn stop_loss(&self, retention: f64) -> f64

Source§

fn layer(&self, limit: f64, attachment: f64) -> f64

Source§

fn layer_second_moment(&self, limit: f64, attachment: f64) -> f64

Source§

fn layer_variance(&self, limit: f64, attachment: f64) -> f64

Implementors§