关于「原始读数为什么过度反应:噪音信号比与决策翻转」,《可穿戴读数与广告日报的卡尔曼滤波》给出的定量结论是什么?

结论:一个读数等于真实水平加测量误差。当误差的方差远大于真实水平的日变化方差时,按原始读数做的决定会频繁翻转,翻转的绝大部分是在回应误差;在噪音信号比为 16 的示意情形下,原始读数的翻转次数是滤波估计的 4.26 倍。好处的大小完全取决于噪音信号比:比值接近零时滤波没有用,比值越大越有用,也越迟钝。那么,这个按比例吸收误差的增益究竟从何而来,它与人们熟悉的七日均线和指数平滑又是什么关系?这是下一章的问题。

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

English version

对照数据表

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

sd of day-to-day change, true level0.502
sd of day-to-day change, readings2.858
reading error sd / true change sd4.0
call flips per 100 days
true4.9
raw23.6
kalman5.5
share of days the call disagrees with the true call
raw0.170
kalman0.100
raw flips / kalman flips4.26
theory sd of reading change sqrt(q + 2r)2.872

核心公式

\[\mu_{t+1}=\mu_t+\eta_t,\qquad \eta_t\sim N(0,q).\]
查看完整验算程序
# Chapter 1. p11: Raw daily readings flip a threshold call far more often.
# Model: local level. True level mu[t+1] = mu[t] + eta, eta ~ N(0, q);
# reading y[t] = mu[t] + eps, eps ~ N(0, r). Illustrative wearable-like
# scale: day-to-day true change sd 0.5, single-reading error sd 2.0, so
# the reading error is four times the true daily change. Call: "level
# above its starting value" (threshold 0). Compare the call made on the
# raw reading, on the Kalman estimate and on the true (unseen) level.
# 400 series of 120 days, fixed seed. All numbers are illustrative.
import math
import random
import statistics

SD_ETA, SD_EPS, DAYS, RUNS = 0.5, 2.0, 120, 400
Q, R = SD_ETA ** 2, SD_EPS ** 2
rng = random.Random(20261113)


def kalman(ys, q, r, m=0.0, p=4.0):
    out = []
    for y in ys:
        pp = p + q
        k = pp / (pp + r)
        m = m + k * (y - m)
        p = pp * (1 - k)
        out.append(m)
    return out


def flips(calls):
    n = 0
    for a, b in zip(calls, calls[1:]):
        if a != b:
            n += 1
    return n


fl = {"true": [], "raw": [], "kalman": []}
wrong = {"raw": [], "kalman": []}
dy, dmu = [], []
for _ in range(RUNS):
    mu, mus, ys = 0.0, [], []
    for _ in range(DAYS):
        mu += rng.gauss(0, SD_ETA)
        mus.append(mu)
        ys.append(mu + rng.gauss(0, SD_EPS))
    est = kalman(ys, Q, R)
    calls = {"true": [v > 0 for v in mus], "raw": [v > 0 for v in ys],
             "kalman": [v > 0 for v in est]}
    for k in fl:
        fl[k].append(flips(calls[k]) / (DAYS - 1))
    for k in wrong:
        bad = [a != b for a, b in zip(calls[k], calls["true"])]
        wrong[k].append(bad.count(True) / DAYS)
    dy += [b - a for a, b in zip(ys, ys[1:])]
    dmu += [b - a for a, b in zip(mus, mus[1:])]

print("sd of day-to-day change, true level : %.3f" % statistics.pstdev(dmu))
print("sd of day-to-day change, readings   : %.3f" % statistics.pstdev(dy))
print("reading error sd / true change sd   : %.1f" % (SD_EPS / SD_ETA))
print("call flips per 100 days")
for k in ("true", "raw", "kalman"):
    print("  %-7s %6.1f" % (k, 100 * statistics.fmean(fl[k])))
print("share of days the call disagrees with the true call")
for k in ("raw", "kalman"):
    print("  %-7s %6.3f" % (k, statistics.fmean(wrong[k])))
ratio = statistics.fmean(fl["raw"]) / statistics.fmean(fl["kalman"])
print("raw flips / kalman flips: %.2f" % ratio)
print("theory sd of reading change sqrt(q + 2r) = %.3f"
      % math.sqrt(Q + 2 * R))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《卡尔曼滤波状态空间同化、可穿戴读数观测噪音与广告归因真实信号提纯母典》第 1 章「原始读数为什么过度反应:噪音信号比与决策翻转」(版本 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}
}

本书其他章节结论