threshold_diagnostics

threshold_diagnostics(
    x,
    u_min,
    u_max,
    n_thresholds=20,
    confidence_level=0.95,
    method='mean_residual_life',
)

Threshold selection diagnostics for peaks-over-threshold analysis.

The mean residual life plot is the sample mean of excesses above each candidate threshold, which is linear in the threshold once a generalized Pareto model holds. The parameter stability plot fits a generalized Pareto distribution at each candidate threshold; the modified scale and the shape are approximately constant above the true threshold.

Candidate thresholds with too few exceedances are dropped (fewer than 5 for mean residual life, fewer than 10 for parameter stability), as are thresholds where the fit fails, so the returned lists are usually shorter than n_thresholds.

Parameters

Name Type Description Default
x array_like Observations. required
u_min float The range of candidate thresholds to scan. required
u_max float The range of candidate thresholds to scan. required
n_thresholds int Number of equally spaced candidate thresholds in [u_min, u_max]. 20
confidence_level float Confidence level for the interval bands. 0.95
method ('mean_residual_life', 'parameter_stability') Which diagnostic to compute. "mean_residual_life"

Returns

Name Type Description
dict Parallel lists. Both methods return threshold and exceedance_count; "mean_residual_life" adds mean_excess, lower_ci, and upper_ci, and "parameter_stability" adds modified_scale, shape, and their confidence bounds. The columns the chosen method does not populate come back empty.

References

Coles (2001), An Introduction to Statistical Modeling of Extreme Values, Section 4.3; Davison and Smith (1990).