关于「布鲁克与埃文斯的马尔可夫链:把平均运行长度写成线性方程组」,《累积和告警》给出的定量结论是什么?

结论:第三章用手写高斯消元求解布鲁克与埃文斯马尔可夫链,并指出平均一年误报一次的累积和在一年内至少误报一次的概率是 0.628。

数据口径:书中参数为示意;全部计算由书中程序生成;本书属于非个人化经营建议,第八章只做离线模型,不访问任何服务器。 书中以标注框区分已发表的证据、可运行的 Python 计算(23 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.628

in control (ARL0370):
P(false alarm by day30) = 0.068
P(false alarm by day90) = 0.209
P(false alarm by day 180)0.382
P(false alarm by day 365)0.628
median run length258 days
10th percentile43 days
geometric P(by day 365)0.628
after a 0.5-sigma shift (ARL127.7):
P(alarm by day7) = 0.110
P(alarm by day 14)0.334
P(alarm by day 30)0.673
P(alarm by day 60)0.914
90th percentile57 days
查看完整验算程序
# Chapter 3. p33: the whole run-length distribution, not just its mean.
# Model: with R the substochastic transition matrix of p31 (k = 0.5,
# h = 4.096, m = 80), the survival P(RL > t) from S = 0 is the first
# entry of R^t 1, iterated one day at a time (each matrix row is added
# with math.fsum). In control the run length is close to geometric, so
# an ARL0 of 370 still puts many false alarms in the first months.
import math


def cdf(x):
    return 0.5 * math.erfc(-x / math.sqrt(2.0))


def upper(x):
    return 0.5 * math.erfc(x / math.sqrt(2.0))


def matrix(k, h, delta, m=80):
    w = 2.0 * h / (2 * m - 1)
    rows = []
    for i in range(m):
        c = i * w - k + delta
        row = [cdf(w / 2.0 - c)]
        for j in range(1, m):
            row.append(cdf(j * w + w / 2.0 - c) - cdf(j * w - w / 2.0 - c))
        rows.append(row)
    return rows


def survival(k, h, delta, days):
    r = matrix(k, h, delta)
    v = [1.0] * len(r)
    out = [1.0]
    for _ in range(days):
        v = [math.fsum(a * b for a, b in zip(row, v)) for row in r]
        out.append(v[0])
    return out


def first_day(surv, q):
    for t, s in enumerate(surv):
        if 1.0 - s >= q:
            return t
    return None


if __name__ == "__main__":
    k, h = 0.5, 4.096
    s0 = survival(k, h, 0.0, 1100)
    print("in control (ARL0 = 370):")
    for t in (30, 90, 180, 365):
        print("  P(false alarm by day {:3d}) = {:.3f}".format(t, 1.0 - s0[t]))
    print("  median run length = {} days".format(first_day(s0, 0.5)))
    print("  10th percentile = {} days".format(first_day(s0, 0.1)))
    print("  geometric P(by day 365) = {:.3f}".format(
        1.0 - (1.0 - 1.0 / 370.0) ** 365))
    s1 = survival(k, h, 0.5, 200)
    print("after a 0.5-sigma shift (ARL1 = 27.7):")
    for t in (7, 14, 30, 60):
        print("  P(alarm by day {:2d}) = {:.3f}".format(t, 1.0 - s1[t]))
    print("  90th percentile = {} days".format(first_day(s1, 0.9)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《累积和控制图与平均运行长度、延迟漂移与转化暗降的最快无误报告警母典》第 3 章「布鲁克与埃文斯的马尔可夫链:把平均运行长度写成线性方程组」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-305 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026305,
  author    = {Fan, Yafu},
  title     = {CUSUM Control Charts and Average Run Length: the Fastest Alarm within a False-Alarm Budget for Latency Drift and Silent Conversion Drops},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论