Skip to main content

extremeloss

Extreme value analysis for insurance losses: POT/GPD, GEV, and tail risk with uncertainty.

CI PyPI Python

Overview

extremeloss estimates the part of the distribution the data barely shows you: peaks-over-threshold fitting of the generalized Pareto distribution, block-maxima fitting of the GEV with uncertainty quantification, threshold selection diagnostics, tail-index estimators, return periods and levels, and body–tail splicing that plugs a fitted tail onto any lossmodels severity.

Fits report parameter uncertainty rather than point estimates alone, and the tail measures (VaR, TVaR, tail probabilities, return levels) quote unconditional, ground-up results.

Installation

pip install extremeloss

Diagnostic plots require the plotting extra:

pip install "extremeloss[plot]"

Requires Python 3.10 or newer.

Quick start

import numpy as np
from extremeloss import fit_pot

losses = np.random.default_rng(0).pareto(2.5, 50_000) * 1000  # heavy-tailed sample

fit = fit_pot(losses, threshold=np.quantile(losses, 0.95))    # -> GPD fit
print("shape xi      :", fit.xi)
print("scale beta    :", fit.beta)
print("99.5% VaR     :", fit.var(0.995))
print("99.5% TVaR    :", fit.tvar(0.995))
print("P(loss > 50k) :", fit.tail_probability(50_000))
print(fit.summary())

What's inside

  • Peaks over threshold — GPD fitting with parameter uncertainty and functional forms when parameters are already known.
  • Block maxima — GEV fitting, diagnostics, and uncertainty quantification.
  • Threshold selection — mean-excess and stability diagnostics.
  • Tail indices — Hill-type and related estimators.
  • Tail measures — VaR, TVaR, tail probabilities, return periods and levels, importance sampling for rare events.
  • Integration — body–tail splicing onto lossmodels severities; optional plotting via the plot extra.

The full API reference and end-to-end worked examples live at openactuarial.org/extremeloss.html.

The OpenActuarial ecosystem

extremeloss is one of seven packages that share conventions — tidy tables, explicit distribution parameterizations, reproducible random-number handling — and compose across package seams:

Package Role
actuarialpy Calculation primitives the workflow packages build on
experiencestudies Experience reporting, actual-vs-expected, claimant and concentration analysis
projectionmodels Claim, premium, and expense projection over a renewal horizon
ratingmodels Manual and experience rating, credibility, indication, GLM relativities
lossmodels Severity and frequency fitting, aggregate loss distributions
extremeloss Extreme-value tails: POT/GPD, GEV, return levels, splicing
risksim Portfolio Monte Carlo, dependence, reinsurance contracts, risk measures

Install everything at once with pip install openactuarial.

Development

git clone https://github.com/OpenActuarial/extremeloss
cd extremeloss
python -m pip install -e ".[dev]"
pytest
ruff check src tests

CI runs the same gate on Python 3.10–3.14 across Linux and Windows.

Versioning and stability

All ecosystem packages are pre-1.0: minor releases may change APIs, and every release is documented in CHANGELOG.md. Current per-package API stability is tracked at openactuarial.org/stability.html.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

extremeloss-0.7.1.tar.gz (63.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

extremeloss-0.7.1-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file extremeloss-0.7.1.tar.gz.

File metadata

  • Download URL: extremeloss-0.7.1.tar.gz
  • Upload date:
  • Size: 63.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for extremeloss-0.7.1.tar.gz
Algorithm Hash digest
SHA256 00e796fdcbff107fa1e9f82a296445a5b5ec125641ce1aae0bacb715f5c7d885
MD5 0d2fdda487b265c51ac1f6e6e061777b
BLAKE2b-256 90b0fd7a1110042b7348a7adf4d8b37cbe016a9bcc20d0b20679bd6106d9c298

See more details on using hashes here.

Provenance

The following attestation bundles were made for extremeloss-0.7.1.tar.gz:

Publisher: release.yml on OpenActuarial/extremeloss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file extremeloss-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: extremeloss-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for extremeloss-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd4bac1391549ecf42a3f092ae05a12d10785a153dfe932c647f1e82f5909a94
MD5 0ef723b1fabf8af2bb088a54a3686f04
BLAKE2b-256 840b5c8c37e72d5b8adf4706d3f8d55dd47a9ca5935ce84d0068ee8dd3f35cb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for extremeloss-0.7.1-py3-none-any.whl:

Publisher: release.yml on OpenActuarial/extremeloss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page