What does Extreme Tails and Chargeback Reserves conclude, in numbers, about “Closing the Empirical Loop: a Monthly Tail Check-Up, the Tail Reserve Estimator and Pre-Registered Tests”?
Answer: Chapter 8 gives a monthly tail check-up, the Tail Reserve Estimator and pre-registered tests: testing the normal one-in-a-thousand line needs only 280 orders, testing the peaks-over-threshold line 9100. Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.
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: 280, 9100
| test | p0 | p1 | n | reject if >= | size | power |
| A | 0.00100 | 0.01095 | 280 | 2 | 0.0325 | 0.8121 |
| B | 0.00100 | 0.00200 | 9100 | 15 | 0.0447 | 0.8050 |
| C | 0.04167 | 0.12500 | 62 | 6 | 0.0441 | 0.8030 |
| in months of 1,800 orders: A 0.16, B 5.1 |
Show the full program
# Chapter 8. p82: sample sizes for the pre-registered tests.
# Exact one-sided binomial tests at level 0.05 and power 0.8. For each
# test we find the smallest count n (orders or months) with a critical
# value c such that P(X >= c | p0) <= 0.05 and P(X >= c | p1) >= 0.8.
# Test A: the share of orders above the normal 99.9% line is 0.001
# (p0) against the 0.01095 of the illustrative tail (p11).
# Test B: the share above the GPD 99.9% line is 0.001 (p0) against a
# doubled 0.002 (an under-reserve the shop must catch).
# Test C: months whose chargeback bill beats a 1-in-24-month reserve,
# 1/24 (p0) against 3/24. All rates are illustrative planning values.
import math
def tail_ge(n, c, p):
# P(X >= c) for X ~ Binomial(n, p), terms in log space, exact fsum
if c <= 0:
return 1.0
lp, lq = math.log(p), math.log1p(-p)
terms = []
for k in range(c, n + 1):
lt = (math.lgamma(n + 1) - math.lgamma(k + 1)
- math.lgamma(n - k + 1) + k * lp + (n - k) * lq)
terms.append(math.exp(lt))
if k > c + 50 and terms[-1] < 1e-18 * terms[0]:
break
return math.fsum(terms)
def plan(p0, p1, step, start):
n = start
while True:
c = 0
while tail_ge(n, c, p0) > 0.05:
c += 1
pw = tail_ge(n, c, p1)
if pw >= 0.8:
return n, c, tail_ge(n, c, p0), pw
n += step
print("test p0 p1 n reject if >= size power")
for name, p0, p1, step, start in (("A", 0.001, 0.01095, 10, 10),
("B", 0.001, 0.002, 100, 1000),
("C", 1 / 24.0, 3 / 24.0, 1, 2)):
n, c, a, pw = plan(p0, p1, step, start)
print(" %s %.5f %.5f %6d %6d %.4f %.4f"
% (name, p0, p1, n, c, a, pw))
print("in months of 1,800 orders: A %.2f, B %.1f"
% (plan(0.001, 0.01095, 10, 10)[0] / 1800.0,
plan(0.001, 0.002, 100, 1000)[0] / 1800.0))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 8: Closing the Empirical Loop: a Monthly Tail Check-Up, the Tail Reserve Estimator and Pre-Registered Tests. 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
- Chapter 1 · The Blind Spot of Mean Plus Three Standard Deviations: the One-in-a-Thousand Quantile and Whale Orders under Heavy Tails
- Chapter 2 · Peaks over Thresholds: the Pickands-Balkema-de Haan Theorem and the Convergence of Excesses
- Chapter 3 · Probability-Weighted Moments: Estimating the Two Generalised Pareto Parameters with the Standard Library
- Chapter 4 · Return Levels: How Large Is the Whale Order That Comes Once in So Many Months
- Chapter 5 · The Mean Excess Plot and the Choice of Threshold: Bias, Variance and the Lognormal Trap
- Chapter 6 · Chargeback Reserves and Server Headroom: Writing Return Levels into the Ledger and the Server Room
- Chapter 7 · Classical Sources East and West: "Treading on Frost, Hard Ice Comes" and the Extreme-Value Laws of Fisher and Tippett