mean_excess() is the empirical mean-excess function
e(u) = E[X - u | X > u] at each threshold (linear above a threshold where
a generalized Pareto fits); hill_estimator() gives Hill estimates of the
tail index xi (1 / alpha) from the k largest values. Both help
choose a threshold for pot_tail().
Usage
mean_excess(x, thresholds)
hill_estimator(x, k)
Arguments
- x
Numeric vector of losses or draws.
- thresholds
Thresholds.
- k
Numbers of top values to use.
Value
mean_excess(): a data frame with threshold, mean_excess
(NaN where no value exceeds it) and n_above. hill_estimator(): a
numeric vector, one estimate per k.
Examples
mean_excess(c(1, 2, 3, 4), 2)
#> threshold mean_excess n_above
#> 1 2 1.5 2
x <- (1 - (seq_len(2000) - 0.5) / 2000)^-0.5
hill_estimator(x, c(100, 200))
#> [1] 0.5007630 0.5003825