distributions.Tweedie

Tweedie distribution with mean mu, dispersion phi and power

Usage

distributions.Tweedie()

1 < p < 2: variance phi * mu**p, a point mass at 0 and a continuous density above it.

It is a Poisson number of gamma losses, the GLM family for pure premium. P(Y = 0) = exp(-lambda_).

Parameters

mean: float
dispersion: float
power: float
In (1, 2).

Raises

ValueError
If a parameter is out of range.

Examples

>>> import math
>>> from prospicio.distributions import Tweedie
>>> y = Tweedie(500.0, 40.0, 1.6)
>>> abs(y.cdf(0.0) - math.exp(-y.lambda_)) < 1e-15

True

Attributes

Name Description
dispersion Dispersion phi.
lambda_ Poisson mean of the number of losses.
power Power p.
severity The gamma distribution of each loss.

dispersion

Dispersion phi.

dispersion: float


lambda_

Poisson mean of the number of losses.

lambda_: float


power

Power p.

power: float


severity

The gamma distribution of each loss.

severity: Gamma

Methods

Name Description
cdf() Distribution function P(X <= x).
from_poisson_gamma() The Tweedie equal to a Poisson(lambda_) number of
layer() Expected loss to the layer limit xs attachment.
layer_second_moment() Second moment of the loss to the layer limit xs
layer_variance() Variance of the loss to the layer limit xs attachment.
lev() Limited expected value E[min(X, limit)].
ln_pdf() Log density at y > 0; at y = 0, the log of the point mass.
mean() Mean of the distribution (inf if it does not exist).
quantile() Quantile: the smallest x with P(X <= x) >= p.
sample() n draws from stream stream of the generator keyed by
std() Standard deviation of the distribution.
stop_loss() Expected excess over a retention, E[max(X - retention, 0)].
survival() Survival function P(X > x), accurate far into the tail.
variance() Variance of the distribution (inf if it does not exist).

cdf()

Distribution function P(X <= x).

Usage

cdf(x)
Parameters
x: float
Returns
float

from_poisson_gamma()

The Tweedie equal to a Poisson(lambda_) number of

Usage

from_poisson_gamma(lambda_, shape, scale)

Gamma(shape, scale) losses.

Parameters
lambda_: float
shape: float
scale: float
Returns
Tweedie

layer()

Expected loss to the layer limit xs attachment.

Usage

layer(limit, attachment)
Parameters
limit: float

inf for an unlimited layer.

attachment: float
Returns
float

layer_second_moment()

Second moment of the loss to the layer limit xs

Usage

layer_second_moment(limit, attachment)
Parameters
limit: float
attachment: float
Returns
float

layer_variance()

Variance of the loss to the layer limit xs attachment.

Usage

layer_variance(limit, attachment)
Parameters
limit: float
attachment: float
Returns
float

lev()

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

Usage

lev(limit)
Parameters
limit: float
Returns
float

ln_pdf()

Log density at y > 0; at y = 0, the log of the point mass.

Usage

ln_pdf(y)
Parameters
y: float
Returns
float

mean()

Mean of the distribution (inf if it does not exist).

Usage

mean()
Returns
float

quantile()

Quantile: the smallest x with P(X <= x) >= p.

Usage

quantile(p)
Parameters
p: float
Probability in [0, 1].
Returns
float
Raises
ValueError
If p is outside [0, 1].

sample()

n draws from stream stream of the generator keyed by

Usage

sample(n, seed, stream=0)

seed.

Parameters
n: int
seed: int
stream: int = 0
Returns
list of float

std()

Standard deviation of the distribution.

Usage

std()
Returns
float

stop_loss()

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

Usage

stop_loss(retention)
Parameters
retention: float
Returns
float

survival()

Survival function P(X > x), accurate far into the tail.

Usage

survival(x)
Parameters
x: float
Returns
float

variance()

Variance of the distribution (inf if it does not exist).

Usage

variance()
Returns
float