risk.PotTail

A peaks-over-threshold tail: draws above a threshold modelled by a

Usage

risk.PotTail()

fitted generalized Pareto distribution, for VaR and TVaR beyond the draws.

Make one with PotTail.fit(draws, level), which takes the threshold at the empirical level quantile.

Examples

>>> from prospicio.distributions import Lognormal, Sampled
>>> from prospicio.risk import PotTail
>>> d = Lognormal(0.0, 1.0)
>>> s = Sampled([d.quantile((i - 0.5) / 100_000) for i in range(1, 100_001)])
>>> tail = PotTail.fit(s, 0.95)
>>> abs(tail.var(0.999) / d.quantile(0.999) - 1) < 0.02

True

Attributes

Name Description
gpd The fitted GPD for the exceedances.
p_exceed Share of draws above the threshold.
threshold Threshold u.

gpd

The fitted GPD for the exceedances.

gpd: Gpd


p_exceed

Share of draws above the threshold.

p_exceed: float


threshold

Threshold u.

threshold: float

Methods

Name Description
fit() Fits a tail to the draws above their empirical level quantile.
tvar() TVaR at p >= 1 - p_exceed; infinite when xi >= 1.
var() VaR at p >= 1 - p_exceed.

fit()

Fits a tail to the draws above their empirical level quantile.

Usage

fit(draws, level)
Parameters
draws: Sampled
level: float
For example 0.95 for the top 5%.
Returns
PotTail

tvar()

TVaR at p >= 1 - p_exceed; infinite when xi >= 1.

Usage

tvar(p)
Parameters
p: float
Returns
float

var()

VaR at p >= 1 - p_exceed.

Usage

var(p)
Parameters
p: float
Returns
float