Skip to main content

nsevt — non-stationary extreme-value tail risk with honest uncertainty

CI PyPI Python versions License: MIT

nsevt is a small, dependency-light Python package (NumPy + SciPy) for the honest analysis of trends in environmental extremes. It packages a workflow that existing EVT tools (extRemes, ismev, POT, pyextremes, texmex) do not offer as a single, tested pipeline:

  1. Bounded-tail detection — a peaks-over-threshold GPD fit with a profile-likelihood interval for the shape and a bootstrap of the finite upper endpoint (ξ<0 ⇒ a finite physical ceiling).
  2. A permutation-calibrated trend test on the tail scale — exact in finite samples, avoiding the unreliable asymptotic χ² for a boundary-adjacent parameter on a few hundred exceedances.
  3. Power / minimum-detectable-effect — turns any non-rejection into a quantitative statement of what the record can resolve.
  4. Multi-source transportability ("evidence arena") — does an apparent trend survive changing the data source, or is it an instrumental artifact?
  5. Block-conformal prediction bands — distribution-free coverage for extreme quantiles under temporal dependence.
  6. A two-scale Wasserstein trend test for a series of distributions each estimated from a small per-period sample, with an exact location/scale/shape energy decomposition.

The numerics of the GPD and permutation machinery are ported verbatim from the frozen, unit-tested research code, so results are reproducible and identical.

Install

pip install -e .            # from this directory
pip install -e ".[demo]"    # also install the Streamlit demo dependencies

Quick start

import numpy as np, nsevt

rng = np.random.default_rng(0)
# 500 observations; tail excesses above u=40 are bounded (xi<0)
x = 40 + rng.gamma(2.0, 8.0, size=500)

fit = nsevt.gpd_pot(x, threshold=40)
print(fit.summary())
print("1-in-100 return level:", fit.return_level(100, rate=(x > 40).mean()))

# is there a trend in the tail scale? (block = year label per observation)
year = rng.integers(1980, 2024, size=500)
tr = nsevt.trend_permutation(x[x > 40] - 40, year[x > 40])
print("trend/decade:", round(tr["trend_per_decade"], 3),
      "p_perm:", tr["p_permutation"])

# what can the record resolve?
mde = nsevt.min_detectable_effect(x[x > 40] - 40, year[x > 40])
print("MDE per decade:", mde["mde_per_decade"])

# distribution-free 90% prediction band under dependence
band = nsevt.block_conformal(x, threshold=40, alpha=0.10)
print("upper bound at sigma:", band.predict_upper(fit.sigma))

The multi-source arena

arena = nsevt.transportability(
    [("operational", x_op, year_op),
     ("independent", x_ind, year_ind),
     ("homogenized", x_homog, year_homog)],
    threshold=40)
print(arena.table())

The verdict distinguishes a robust bounded tail (shape reproduces in every source) from an apparent trend that does not survive the change of source — the core methodological contribution of the accompanying research.

Modules

module purpose
nsevt.gpd POT-GPD fit, profile CI for ξ, endpoint bootstrap, return levels
nsevt.trend permutation trend test, power/MDE, block-bootstrap trend CI
nsevt.transportability multi-source evidence arena
nsevt.conformal block / split conformal prediction bands for tails
nsevt.twoscale two-scale Wasserstein distributional trend test + energy split

Tests

pip install ".[test]" && pytest

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

nsevt-0.1.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

nsevt-0.1.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file nsevt-0.1.0.tar.gz.

File metadata

  • Download URL: nsevt-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for nsevt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da9acfaaf9fb93e765a81832b452fb17e08760fe153a9520c123488eb9e2ec57
MD5 4e2fc97975e06b18f6636b81dfc0436d
BLAKE2b-256 d3269d99cbb3981b4c7c8de4d74afbf8281033b2f4b442b15be9fa40e6a1fa64

See more details on using hashes here.

File details

Details for the file nsevt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nsevt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for nsevt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 155edee3735bfe7e9d14f7a201bc68e35e5594f27612a86ab92ef51645708584
MD5 6654f6e2023f5b6ae7f7cf564b08d4f7
BLAKE2b-256 075f9228106c6977a273e8be1c55e0676e7381310d8e6e88f7d248429c8987b2

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page