What does Extreme Tails and Chargeback Reserves conclude, in numbers, about “Probability-Weighted Moments: Estimating the Two Generalised Pareto Parameters with the Standard Library”?

Answer: Chapter 3 derives probability-weighted moments, whose root mean square error with 50 excesses is 0.169 against 0.209 for maximum likelihood.

Scope of the numbers: Chapter 5 chooses the threshold with the mean excess plot and 150 simulated shops; the log error of the ten-year level is smallest at the ninetieth percentile, at 0.194. Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.169, 0.209, 50

true xi 0.4; 1-in-1000 excess level 37.122; 300 reps
    n  | bias / rmse of xi:  PWM          mom          ML
    50  | -0.043 0.169 -0.160 0.200 -0.041 0.209
   100  | -0.022 0.137 -0.124 0.157 -0.011 0.152
   200  | -0.025 0.101 -0.102 0.128 -0.018 0.106
   500  | -0.003 0.063 -0.064 0.088 +0.002 0.062
estimated / true 1-in-1000 level (5% 50% 95%)
    50  0.28 0.81 2.75  0.25 0.60 1.47  0.24 0.84 3.69
   100  0.37 0.92 2.23  0.34 0.67 1.34  0.36 0.94 3.01
   200  0.49 0.89 1.85  0.43 0.69 1.20  0.49 0.92 2.09
   500  0.68 0.98 1.58  0.57 0.80 1.23  0.69 1.00 1.61
Show the full program
# Chapter 3. p32: PWM, moments and ML on small samples of excesses.
# Model: excesses drawn from an exact GPD(xi = 0.4, sigma = 1), the
# shape of the illustrative order tail; 300 replications per sample
# size n = 50, 100, 200, 500, fixed seed. For each method: bias and
# root mean square error of xi, and the 5%, 50% and 95% points of the
# estimated 1-in-1000 excess level over its true value 37.122.

import math
import random

XI0 = 0.4
REPS = 300
TRUE_Q = ((0.001) ** (-XI0) - 1.0) / XI0


def gpd_draw(rng, n):
    return [((1.0 - rng.random()) ** (-XI0) - 1.0) / XI0 for _ in range(n)]


def gpd_pwm(y):
    ys = sorted(y)
    n = len(ys)
    a0 = math.fsum(ys) / n
    a1 = math.fsum(v * (n - 1 - j) / (n - 1) for j, v in enumerate(ys)) / n
    xi = 2.0 - a0 / (a0 - 2.0 * a1)
    return xi, 2.0 * a0 * a1 / (a0 - 2.0 * a1)


def gpd_mom(y):
    n = len(y)
    m = math.fsum(y) / n
    v = math.fsum((x - m) ** 2 for x in y) / (n - 1)
    return 0.5 * (1.0 - m * m / v), 0.5 * m * (m * m / v + 1.0)


def profile(theta, y):
    xi = math.fsum(math.log1p(theta * v) for v in y) / len(y)
    return -len(y) * (math.log(xi / theta) + 1.0 + xi), xi, xi / theta


def gpd_mle(y):
    m, top = math.fsum(y) / len(y), max(y)
    lo, hi = -0.999 * m / top, 20.0
    g = (math.sqrt(5.0) - 1.0) / 2.0

    def f(t):
        return profile(t / m, y)[0] if abs(t) > 1e-9 else -1e300
    a, b = hi - g * (hi - lo), lo + g * (hi - lo)
    fa, fb = f(a), f(b)
    for _ in range(60):
        if fa > fb:
            hi, b, fb = b, a, fa
            a = hi - g * (hi - lo)
            fa = f(a)
        else:
            lo, a, fa = a, b, fb
            b = lo + g * (hi - lo)
            fb = f(b)
    _, xi, sig = profile(0.5 * (lo + hi) / m, y)
    return xi, sig


def pct(xs, p):
    ys = sorted(xs)
    return ys[min(len(ys) - 1, int(p * len(ys)))]


rng = random.Random(20261118)
meths = (("PWM", gpd_pwm), ("mom", gpd_mom), ("ML", gpd_mle))
print("true xi 0.4; 1-in-1000 excess level %.3f; %d reps" % (TRUE_Q, REPS))
print("    n  | bias / rmse of xi:  PWM          mom          ML")
qrows = []
for n in (50, 100, 200, 500):
    xs_ = {k: [] for k, _ in meths}
    qs_ = {k: [] for k, _ in meths}
    for _ in range(REPS):
        y = gpd_draw(rng, n)
        for name, fit in meths:
            xi, sig = fit(y)
            xs_[name].append(xi)
            qs_[name].append(sig / xi * ((0.001) ** (-xi) - 1.0) / TRUE_Q)
    cells = []
    for name, _ in meths:
        e = [x - XI0 for x in xs_[name]]
        bias = math.fsum(e) / REPS
        rmse = math.sqrt(math.fsum(d * d for d in e) / REPS)
        cells.append("%+.3f %.3f" % (bias, rmse))
    print("  %4d  |%s" % (n, "".join("%13s" % c for c in cells)))
    qrows.append((n, [(pct(qs_[k], 0.05), pct(qs_[k], 0.5),
                       pct(qs_[k], 0.95)) for k, _ in meths]))
print("estimated / true 1-in-1000 level (5% 50% 95%)")
for n, cols in qrows:
    print("  %4d  " % n + "  ".join("%.2f %.2f %.2f" % c for c in cols))

Single source and citation

Fan, Y. (2026). Extreme-Value Theory and Generalised Pareto Tails: Whale-Order Ceilings and Reserves for Extreme Chargebacks (Version 1.0.0), Chapter 3: Probability-Weighted Moments: Estimating the Two Generalised Pareto Parameters with the Standard Library. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-244 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026244,
  author    = {Fan, Yafu},
  title     = {Extreme-Value Theory and Generalised Pareto Tails: Whale-Order Ceilings and Reserves for Extreme Chargebacks},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book