risk.Gpd

The generalized Pareto distribution, as SciPy’s

Usage

risk.Gpd()

genpareto(c=xi, scale=beta).

P(X > x) = (1 + xi x / beta)**(-1 / xi) for x >= 0.

Parameters

xi: float

Shape; moments of order 1 / xi and above are infinite.

beta: float
Scale, positive.

Examples

>>> from prospicio.risk import Gpd
>>> g = Gpd(0.5, 2.0)
>>> g.mean()

4.0

>>> fit = Gpd.fit([g.quantile((i - 0.5) / 1000) for i in range(1, 1001)])
>>> round(fit.xi, 2), round(fit.beta, 2)

(0.5, 2.0)

Attributes

Name Description
beta Scale.
xi Shape.

beta

Scale.

beta: float


xi

Shape.

xi: float

Methods

Name Description
cdf() Distribution function.
fit() Maximum likelihood fit to exceedances (values over a threshold,
mean() Mean, beta / (1 - xi); infinite for xi >= 1.
quantile() Quantile function.

cdf()

Distribution function.

Usage

cdf(x)
Parameters
x: float
Returns
float

fit()

Maximum likelihood fit to exceedances (values over a threshold,

Usage

fit(exceedances)

minus the threshold).

Parameters
exceedances: list of float
At least 3, non-negative, not all equal.
Returns
Gpd

mean()

Mean, beta / (1 - xi); infinite for xi >= 1.

Usage

mean()

quantile()

Quantile function.

Usage

quantile(p)
Parameters
p: float
Returns
float