Skip to content

module probextreme.frequentist_extreme

S. Filhol and F. Doussot, Sept. 2024


function fit_model

fit_model(data, model='gev', **kwargs)

Function to fit GEV, Gumbel or Pareto distribution model to data. Fitting is performed with Scipy method. See scipy documentation

Args:

  • data (float): numpy array of float
  • model (str): name of distribution to fit
  • **kwargs: keyword for additional arguments of the fit function

Returns:


function get_return_periods

get_return_periods(
    data,
    return_levels,
    model='gev',
    threshold=None,
    nb_years=None,
    **kwargs
)

function get_return_levels

get_return_levels(
    data,
    return_periods,
    model='gev',
    threshold=None,
    nb_years=None,
    **kwargs
)

function get_POT_values

get_POT_values(ts, threshold, mtd='5D')

Function to extract values from timseries for the GPD analysis

Args:

  • ts (float): time series
  • threshold (float): threshold over which values of ts are considered extreme values and considered in GPD processing
  • mtd (freq): minimal time distance between 2 max Return: POT values

function get_BM_values

get_BM_values(ts, freq='365.25D', origin='start')

function prob_exceedance_GPD

prob_exceedance_GPD(shape, scale, threshold, value)

class extreme_values

method __init__

__init__(
    ts,
    BM_window='365.25D',
    origin_BM='start',
    POT_threshold=None,
    mtd='96H',
    models=['gev', 'gumbel', 'gpd'],
    verbose=True
)

Class for analyzing a timeseries using the extreme value theory. Available approaches are Block Maxima (GEV) and Threshold (GPD).

Args:

  • ts (float): pandas timeseries of values to analyze
  • BM_window (freq): Block maxima window, default is 1 year
  • origin_BM (str): date of the origin for the BM computation. Default 'start' POT_threshold (float): mtd (freq):
  • models (str): list

method execute_bootstrapping

execute_bootstrapping(n_iterations=1000, confidence=95)

Function to compute bootstrapping method to derive confidence intervals of return levels and return periods

Args:

  • n_iterations (int): number of boostrap iteration
  • confidence (float): confidence level. between 0 and 100%

method find_POT_threshold

find_POT_threshold(
    threshold_range=None,
    mtd=None,
    plot='plt',
    nb_peaks_min=None
)

Function to find POT threshold based on the mean excess and threshold value. The threshold value to choose should be as small as possible in order to get some linearity in the mean residual life plot

Args:

  • threshold_range (float): numpy array of threshold for which to compute mean excess
  • mtd: cf get_POT_values

method get_return_levels

get_return_levels(return_periods=None)

Function to compute return levels for given return periods

Args:

  • return_periods (float): numpy array of return periods

method plot_QQ_plot

plot_QQ_plot(plot='plt', models=None)

:param plt: 'plt' to plot the graph :return: r_value**2


method plot_diagnostic

plot_diagnostic()

method plot_distribution

plot_distribution(ax)

method plot_extremes

plot_extremes()

method plot_return_levels

plot_return_levels(ax)

method print_summary

print_summary()

method redefine_threshold

redefine_threshold(threshold)

class model

Python class to perform GEV analysis on annual extreme values WARNING: currently only support maximum extremes

TODO:

  • [ ] add plotting tools
  • [ ] print summary function

method __init__

__init__(ts, model_type='gev')

Python class to perform GEV analysis on annual extreme values WARNING: currently only support maximum extremes

Args:

  • ts: annual extremes (maximum) model_type:

method bootstrap_distribution_parameters

bootstrap_distribution_parameters(n_bootstrap=1000, **fit_kwargs)

Function to study the confidence intervals on the distribution parameters

Args: n_bootstrap: **fit_kwargs:


method bootstrap_return_levels

bootstrap_return_levels(
    return_periods=None,
    n_bootstrap=1000,
    lower_percentile=2.5,
    upper_percentile=97.5,
    **fit_kwargs
)

Function to compute confidence intervals (CI) of return levels at set return periods using boostrap method

Args:

  • return_periods (float): array of return periods for which to compute CI of return levels
  • n_bootstrap (int): number of boostrap iterations
  • upper_percentile (float): upper percentile to extract. Default = 0.95
  • lower_percentile (float): lower percentile to extract. Default = 0.05
  • **fit_kwargs: kwargs for distribution to fit. See function genextreme for GEV, and gumbel_r of Scipy

Returns: array of the lower and upper percentile return levels


method compute_pdf

compute_pdf(x_values=None)

method fit_distribution

fit_distribution(verbose=True, **kwargs)

method get_return_levels

get_return_levels(return_periods=None)

Function to get return levels of corresponding return periods based on the fitted model

Args: return_periods:

Returns: numpy array - return levels


method get_return_periods

get_return_periods(return_levels=None)

method probability_exceedance_GPD

probability_exceedance_GPD(value)

This file was automatically generated via lazydocs.