关于「实证闭环:四周滤波日志、广告日报滤波与预注册检验」,《可穿戴读数与广告日报的卡尔曼滤波》给出的定量结论是什么?

结论:第八章给出四周滤波日志与广告日报滤波的闭环、小工具「噪音读数滤波器」与两份预注册方案(广告账户保守需要 96 个,个人日志需要 57 份)。书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。

数据口径:本书用局部水平与局部趋势的状态空间模型检验这一常识:一个读数等于真实水平加测量误差,当误差方差远大于真实日变化方差时,按原始读数做是或否的决定会对噪音过度反应;示意参数下原始读数每百天翻转 23.6 次,卡尔曼滤波估计只翻转 5.5 次。 书中的噪音方差、漂移、回报率与预算均为示意参数;全部计算由书中程序生成。

English version

对照数据表

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

as in p62 mean gain1963.1 yuan, sd 1506.4, d 1.303, wins 0.918
clean mean gain728.9 yuan, sd 636.3, d 1.146, wins 0.913
accounts for 80 % power in the clean world6
accounts if the true gain is only a quarter of that96
simulated power with 3 accounts0.587
simulated power with 6 accounts0.887
查看完整验算程序
# Chapter 8. p82: How many ad accounts does a fair split test need?
# Each account's audience is split at random into two halves (regions
# or user groups) that share the same true return path. One half runs
# the switching rule of p62 on its own raw daily report, the other on
# the Kalman estimate of its own report; each half spends half of 2000
# or 300 yuan, so its report noise is larger by sqrt(2). Accounts draw
# drift sd U(0.02, 0.04), start return U(0.95, 1.15) and full-account
# noise sd U(0.15, 0.35) ("as in p62") or U(0.05, 0.15) ("clean", the
# pessimistic world used for the design); q and r are mis-set by a
# factor e^N(0, 0.5) each. Outcome: paired difference in 90-day profit
# (yuan). Sample size from the clean world, checked by simulation.
# Fixed seed; illustrative values.
import math
import random
import statistics

DAYS, HI, LO = 90, 1000.0, 150.0
rng = random.Random(20261128)
Z = statistics.NormalDist()


def account(lo, hi):
    sq = rng.uniform(0.02, 0.04)
    sr = rng.uniform(lo, hi) * math.sqrt(2)
    q = sq * sq * math.exp(rng.gauss(0, 0.5))
    r = sr * sr * math.exp(rng.gauss(0, 0.5))
    rho = rng.uniform(0.95, 1.15)
    m, p, gain = None, r, []
    for _ in range(DAYS):
        ya, yb = rho + rng.gauss(0, sr), rho + rng.gauss(0, sr)
        if m is None:
            m = yb
        else:
            pp = p + q
            k = pp / (pp + r)
            m, p = m + k * (yb - m), pp * (1 - k)
        rho += rng.gauss(0, sq)
        sb = HI if m > 1.0 else LO
        sa = HI if ya > 1.0 else LO
        gain.append((rho - 1) * (sb - sa))
    return math.fsum(gain)


za, zb = Z.inv_cdf(0.975), Z.inv_cdf(0.80)
for name, lo, hi in (("as in p62", 0.15, 0.35), ("clean", 0.05, 0.15)):
    pilot = [account(lo, hi) for _ in range(3000)]
    mu, sd = statistics.fmean(pilot), statistics.stdev(pilot)
    d = mu / sd
    n = math.ceil((za + zb) ** 2 / d ** 2)
    win = [g > 0 for g in pilot].count(True) / len(pilot)
    print("%-9s mean gain %7.1f yuan, sd %7.1f, d %.3f, wins %.3f"
          % (name, mu, sd, d, win))
print("accounts for 80 %% power in the clean world: %d" % n)
print("accounts if the true gain is only a quarter of that: %d"
      % math.ceil((za + zb) ** 2 / (d / 4) ** 2))
for k in (n // 2, n):
    hits = 0
    for _ in range(300):
        g = [account(0.05, 0.15) for _ in range(k)]
        if statistics.fmean(g) / (statistics.stdev(g) / math.sqrt(k)) > za:
            hits += 1
    print("simulated power with %d accounts: %.3f" % (k, hits / 300))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《卡尔曼滤波状态空间同化、可穿戴读数观测噪音与广告归因真实信号提纯母典》第 8 章「实证闭环:四周滤波日志、广告日报滤波与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026245,
  author    = {Fan, Yafu},
  title     = {Kalman Filtering and State-Space Assimilation: Separating Observation Noise from True Signals in Wearable Readings and Advertising Reports},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论