Skip to main content

nsevt — non-stationary extreme-value tail inference

CI PyPI Python versions License: MIT DOI

nsevt is a dependency-light Python package for four connected tasks:

  1. peaks-over-threshold generalized Pareto (GPD) estimation with an adaptive profile-likelihood interval for shape;
  2. a likelihood-ratio trend test calibrated by complete-block label permutation;
  3. Monte Carlo power and signed minimum-detectable-effect (MDE) analysis; and
  4. a pre-specified multi-source robustness analysis that distinguishes non-reproduction with adequate power from an unresolved comparison.

The package uses deliberately measured terminology. A negative GPD shape point estimate gives a finite model-conditional statistical endpoint. nsevt reports support for a negative shape only when the entire 95% profile interval lies below zero; neither result is called a physical ceiling.

Install

From PyPI:

pip install nsevt

For development or the optional Streamlit demonstration:

git clone https://github.com/GaiskaSalomon/nsevt.git
cd nsevt
pip install -e ".[dev,demo]"

Quick start

import numpy as np
import nsevt

rng = np.random.default_rng(7)
threshold, xi, sigma = 40.0, -0.25, 10.0
years = np.repeat(np.arange(1980, 2030), 12)
uniform = rng.uniform(size=years.size)
excess = sigma / xi * ((1 - uniform) ** (-xi) - 1)
values = threshold + excess

fit = nsevt.gpd_pot(values, threshold=threshold, n_boot=300)
print(fit.summary())
print("negative-shape estimate:", fit.bounded_estimate)
print("negative shape supported by 95% CI:", fit.bounded_supported)

trend = nsevt.trend_permutation(excess, years, n_perm=999)
print("LR permutation p:", trend["p_permutation"],
      "+/-", trend["p_permutation_mcse"])

mde = nsevt.min_detectable_effect(
    excess, years, direction="both", n_rep=200, n_perm_calibration=499
)
print("positive MDE:", mde["mde_positive"])
print("negative MDE:", mde["mde_negative"])

Multi-source robustness

Sources must be genuinely distinct products with comparable temporal support; early and late halves of one record are not substitutes.

result = nsevt.multisource_robustness(
    [("product A", values_a, years_a),
     ("product B", values_b, years_b)],
    threshold=40,
    reference="product A",
)
print(result.trend_status)
print(result.table())

Possible trend statuses include reproduced, inconsistent_direction, not_reproduced_with_power, not_resolved, and no_reference_signal. Agreement or disagreement across sources is a robustness result; it does not by itself attribute a discrepancy to instruments, homogenization, or physical change.

Stable and experimental functionality

status module purpose
stable nsevt.gpd GPD fit, profile interval, conditional endpoint bootstrap, return levels
stable nsevt.trend LR block-label permutation, power/MDE, descriptive block-bootstrap interval
stable nsevt.transportability multi-source robustness and power-aware status
stable with assumptions split_conformal upper tail bound for exchangeable calibration scores
experimental block_conformal block-aggregate dependence sensitivity diagnostic
experimental twoscale_trend residual-bootstrap distribution-valued trend diagnostic
experimental wasserstein_decomposition numerical quantile-grid energy decomposition

The exact assumptions and claim boundaries are documented in docs/assumptions.md. Experimental APIs are retained for evaluation but are not part of the package's central inferential claim.

Reproducibility and tests

The implementation was adapted from research pipelines and then regression- checked; it is not represented as a verbatim copy. Randomized routines accept a seed and report the number of successful replicates. Run the validation suite with:

pip install -e ".[dev]"
ruff check src tests demo
pytest --cov=nsevt --cov-report=term-missing --cov-fail-under=80
python -m build
python -m twine check dist/*

See docs/validation.md for what each test establishes and, equally importantly, what it does not establish.

Citation and license

Use CITATION.cff or the Zenodo DOI shown above. nsevt is released under the MIT License; 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.3.2.tar.gz (45.4 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.3.2-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nsevt-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a84f1b72fb4148be279f374090220844aeedb95b76eb5c1c85e2575a57c9046f
MD5 3395f916e6eac2c4e8d971409b9ece5a
BLAKE2b-256 0390a2b076620ca63c92b713d529da0d41c9bec7abd5237b12a332c7f486e2f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nsevt-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 28.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.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2b559b9b0681d0ccad080ef1b834e03d94bcd24832c4b375f4f01a306a2c0d70
MD5 9a1f8df54aec2fb6725c894585de3132
BLAKE2b-256 0455bca5b5b8cf4ed795c49804f3a9ebb6dbfd461860331cb5c5029552e2cbce

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

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

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