Skip to content

pyextremes

pyextremes

Extreme Value Analysis (EVA) in Python

Test Coverage PyPI Package Anaconda Package


pyextremes is a Python library aimed at performing univariate Extreme Value Analysis (EVA)


Features

pyextremes provides tools necessary to perform a wide range of tasks required to perform univariate EVA, such as:

  • extraction of extreme events from time series using methods such as Block Maxima (BM) or Peaks Over Threshold (POT)
  • fitting continuous distributions, such as GEVD, GPD, or user-specified continous distributions to the extracted extreme events
  • visualization of model inputs, results, and goodness-of-fit statistics
  • estimation of extreme events of given probability or return period (e.g. 100-year event) and of corresponding confidence intervals
  • tools assisting with model selection and tuning, such as selection of block size in BM and threshold in POT

Framework provided by the pyextremes library is easy to use and requires minimum user input to get production-ready results. Its default parameters are configured in compliance with best industry standards and underlying models are heavily based in the Extreme Value theory. The largest source of inspiration for this library was the book "An Introduction to Statistical Modeling of Extreme Values" by Stuart Coles.

In addition to the easy-to-use interface, the library provides interface to underlying tools which can be used to build custom models. All scipy continuous distributions are supported out-of-the-box. Custom distributions can be also provided by subclassing scipy.stats.rv_continuous. Any parameter of a distribution may be frozen to investigate degenerate models (e.g. GEVD -> Gumbel or GPD -> Exponential).

Multiple ways of fitting the continuous distributions to the data are supported:

  • MLE (default model) - Maximum Likelihood Estimate, uses SciPy
  • Emcee - Markov Chain Monte Calro, see Emcee package by Dan Foreman-Mackey

Installation

Get latest version from PyPI:

pip install pyextremes

Install with optional dependencies:

pip install pyextremes[full]

Get latest experimental build from GitHub:

pip install "git+https://github.com/georgebv/pyextremes.git#egg=pyextremes"

For Anaconda Python distributions:

conda install -c conda-forge pyextremes

Dependencies

Package Description
emcee fit models using the Markov Chain Monte Carlo method
matplotlib produce figures
numpy perform efficient operations with arrays
pandas Series and DataFrame objects for model intput and output
scipy statistical models and mathematic functions

Optional Dependencies

Optional dependencies can be installed using the full tag as shown above or manually:

Package Description
tqdm progress bar for slow processes

License

This project is licensed under the terms of the MIT license.