What does Acquirer Risk Steps and Reserve Survival conclude, in numbers, about “Jumps: Cumulative Sums, Exponentially Weighted Averages and Bayesian Online Change Points”?

Answer: Chapter 3 detects jumps in takings with CUSUM, EWMA and Bayesian online changepoints; at one false alarm a year a one-standard-deviation rise is seen in 8.5 days on average.

Scope of the numbers: Parameters are illustrative; all calculations come from the book's programs. This is general risk analysis, not legal, financing or investment advice, and promises no income.

中文版

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: 8.5

upper CUSUM, K = 0.5, SIGMA = 0.25 on log takings
target ARL0hARL1 at delta = 0.51.02.03.0
1002.84916.16.12.61.7
3654.08327.58.53.42.2
7304.76135.19.93.82.5
takings factor: 0.5 -> 1.133, 1.0 -> 1.284, 2.0 -> 1.649, 3.0 -> 2.117
false alarms a year at ARL0 365: about 1.00

Key formula

\[S_t = \max(0,\; S_{t-1} + z_t - K),\]
Show the full program
# Chapter 3. p31: Page's CUSUM on daily log takings, threshold by ARL.
# x_t = log(daily takings); in control x_t ~ N(mu, SIGMA), SIGMA = 0.25
# (illustrative). z_t = (x_t - mu) / SIGMA. Upper CUSUM:
#   S_t = max(0, S_{t-1} + z_t - K),  alarm when S_t > h,  K = 0.5.
# Average run lengths (ARL) by the Brook-Evans Markov chain with M
# states, solved by Gaussian elimination. ARL0 = mean days between
# false alarms with no change; ARL1 = mean days to alarm after a step
# of delta standard deviations (delta = 1 is takings x exp(0.25)).
import math

SIGMA, K, M = 0.25, 0.5, 90


def phi(x):
    return 0.5 * (1.0 + math.erf(x / math.sqrt(2.0)))


def solve(a, b):
    n = len(b)
    a = [row[:] + [b[i]] for i, row in enumerate(a)]
    for c in range(n):
        piv = max(range(c, n), key=lambda r: abs(a[r][c]))
        a[c], a[piv] = a[piv], a[c]
        for r in range(c + 1, n):
            f = a[r][c] / a[c][c]
            if f:
                for j in range(c, n + 1):
                    a[r][j] -= f * a[c][j]
    x = [0.0] * n
    for r in range(n - 1, -1, -1):
        tail = math.fsum([a[r][j] * x[j] for j in range(r + 1, n)])
        x[r] = (a[r][n] - tail) / a[r][r]
    return x


def cusum_arl(h, delta):
    w = 2.0 * h / (2 * M - 1)
    mat = []
    for i in range(M):
        ci = i * w
        row = []
        for j in range(M):
            if j == 0:
                pij = phi(0.5 * w - ci + K - delta)
            else:
                pij = (phi((j + 0.5) * w - ci + K - delta)
                       - phi((j - 0.5) * w - ci + K - delta))
            row.append((1.0 if i == j else 0.0) - pij)
        mat.append(row)
    return solve(mat, [1.0] * M)[0]


def h_for(arl0):
    lo, hi = 1.0, 8.0
    for _ in range(40):
        mid = 0.5 * (lo + hi)
        if cusum_arl(mid, 0.0) < arl0:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)


def main():
    print("upper CUSUM, K = 0.5, SIGMA = 0.25 on log takings")
    print("target ARL0      h    ARL1 at delta = 0.5    1.0    2.0    3.0")
    for arl0 in (100, 365, 730):
        h = h_for(arl0)
        a1 = [cusum_arl(h, d) for d in (0.5, 1.0, 2.0, 3.0)]
        print("{:>10}   {:.3f}          {:>7.1f}  {:>5.1f}  {:>5.1f}"
              "  {:>5.1f}".format(arl0, h, *a1))
    print("takings factor: " + ", ".join(
        "{} -> {:.3f}".format(d, math.exp(d * SIGMA))
        for d in (0.5, 1.0, 2.0, 3.0)))
    h = h_for(365)
    print("false alarms a year at ARL0 365: about {:.2f}".format(
        365.0 / cusum_arl(h, 0.0)))


if __name__ == "__main__":
    main()

Single source and citation

Fan, Y. (2026). Payment-Acquirer Risk Step-Functions, Multi-Gateway Hot Failover and Rolling-Reserve Survival for Digital Fleets (Version 1.0.0), Chapter 3: Jumps: Cumulative Sums, Exponentially Weighted Averages and Bayesian Online Change Points. 5D Library. DOI pending

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

BibTeX
@book{fan2026397,
  author    = {Fan, Yafu},
  title     = {Payment-Acquirer Risk Step-Functions, Multi-Gateway Hot Failover and Rolling-Reserve Survival for Digital Fleets},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book