Skip to main content

FrequencyDistribution

Enum FrequencyDistribution 

Source
pub enum FrequencyDistribution {
    Poisson {
        lambda: f64,
    },
    Binomial {
        m: u64,
        q: f64,
    },
    NegativeBinomial {
        r: f64,
        beta: f64,
    },
}
Expand description

Claim-count frequency distribution in the Panjer (a, b, 0) class.

Variants§

§

Poisson

Poisson(lambda): E[N] = Var(N) = lambda, a = 0, b = lambda.

Fields

§lambda: f64

Poisson mean intensity lambda > 0.

§

Binomial

Binomial(m, q): E[N] = m q, Var(N) = m q (1 - q), a = -q / (1 - q), b = (m + 1) q / (1 - q).

Fields

§m: u64

Number of trials m >= 1.

§q: f64

Per-trial claim probability q in (0, 1).

§

NegativeBinomial

Negative Binomial(r, beta) in Klugman–Panjer–Willmot parameterization: E[N] = r * beta, Var(N) = r * beta * (1 + beta), a = beta / (1 + beta), b = (r - 1) * beta / (1 + beta).

Fields

§r: f64

Shape / dispersion parameter r > 0.

§beta: f64

Scale parameter beta > 0.

Implementations§

Source§

impl FrequencyDistribution

Source

pub const fn poisson(lambda: f64) -> Self

Construct a Poisson(lambda) frequency distribution.

Source

pub const fn binomial(m: u64, q: f64) -> Self

Construct a Binomial(m, q) frequency distribution.

Source

pub const fn negative_binomial(r: f64, beta: f64) -> Self

Construct a NegativeBinomial(r, beta) frequency distribution.

Source

pub fn compound_panjer( self, severity_pmf: &[f64], step: f64, n_steps: usize, ) -> Result<AggregateLossDistribution, ValidationError>

Evaluate the compound aggregate distribution via exact Panjer (a, b, 0) recursion.

Source

pub fn compound_fft( self, severity_pmf: &[f64], step: f64, fft_size: usize, tilt: Option<f64>, ) -> Result<AggregateLossDistribution, ValidationError>

Evaluate the compound aggregate distribution via exponentially tilted radix-2 FFT.

Source

pub fn negative_binomial_from_mean_variance( mean: f64, variance: f64, ) -> Result<Self, ValidationError>

Construct a Negative Binomial distribution matching a target mean > 0 and overdispersed variance > mean.

Source

pub fn validate(&self) -> Result<(), ValidationError>

Validate distribution parameters.

Source

pub fn panjer_ab(&self) -> (f64, f64)

Panjer (a, b) recursion parameters.

Source

pub fn mean(&self) -> f64

Theoretical frequency mean E[N].

Source

pub fn variance(&self) -> f64

Theoretical frequency variance Var(N).

Source

pub fn pgf_real(&self, z: f64) -> f64

Real probability generating function P_N(z) for real z in [0, 1].

Trait Implementations§

Source§

impl Clone for FrequencyDistribution

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FrequencyDistribution

Source§

impl Debug for FrequencyDistribution

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FrequencyDistribution

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FrequencyDistribution

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for FrequencyDistribution

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FrequencyDistribution

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.