Threshold selection diagnostics for peaks-over-threshold analysis
Source:R/data.R
threshold_diagnostics.RdThe two standard plots for choosing a peaks-over-threshold cutoff. 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.
Usage
threshold_diagnostics(
x,
u_min,
u_max,
n_thresholds = 20,
confidence_level = 0.95,
method = c("mean_residual_life", "parameter_stability")
)Value
A named list of parallel vectors. 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.
Details
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 vectors are usually shorter than n_thresholds.
References
Coles (2001), An Introduction to Statistical Modeling of Extreme Values, Section 4.3; Davison and Smith (1990).
Examples
d <- distribution("GeneralizedPareto", c(0, 100, 0.1))
x <- dist_random(d, 500, seed = 42)
mrl <- threshold_diagnostics(x, u_min = 0, u_max = 200, n_thresholds = 10)
data.frame(threshold = mrl$threshold, mean_excess = mrl$mean_excess)
#> threshold mean_excess
#> 1 0.00000 92.23722
#> 2 22.22222 89.63642
#> 3 44.44444 89.90720
#> 4 66.66667 86.18157
#> 5 88.88889 85.77808
#> 6 111.11111 87.18757
#> 7 133.33333 87.71434
#> 8 155.55556 83.13719
#> 9 177.77778 77.51777
#> 10 200.00000 72.51115