What does Kalman Filtering for Readings and Ad Reports conclude, in numbers, about “The Advertising Report: Attribution Noise, On/Off Flighting and Budget Switching”?

Answer: Chapter 6 turns to advertising reports: switching the budget on the raw report changes level 33.8 times in ninety days and earns 0.714 of the ideal, switching on the filtered estimate changes only 5.6 times and earns 0.903, and with constant spend no method learns the effect of advertising.

Scope of the numbers: Its noise variances, drifts, returns and budgets are illustrative parameters; all calculations are generated by its programs. On wearable readings it is not medical advice, claims no effect, judges no one's state of health, and asks readers to consult a licensed physician before any self-experiment; on advertising attribution it is not individual business advice.

中文版

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: 0.714, 0.903, 33.8, 5.6

estimateswitches/90dwrong-day shareprofit (yuan)vs oracle
raw33.80.299111180.714
mean77.60.190137760.885
kalman5.60.175140600.903
oracle5.00.000155641.000
steady Kalman gain here: 0.1130
Show the full program
# Chapter 6. p62: Switching the budget on raw vs filtered daily returns.
# True incremental margin per yuan of spend ("true return") starts at
# 1.05 and drifts as a random walk (sd 0.03 a day). The daily report
# shows true return + attribution noise (sd 0.25). Rule each morning:
# if the estimate of today's return is above 1, spend 2000 yuan, else
# 300 yuan (a floor that keeps the campaign measurable). Profit of a
# day = (true return - 1) x spend. Estimates: yesterday's raw report,
# trailing 7-day mean, Kalman (q = 0.03^2, r = 0.25^2), and the oracle
# that sees the true return. 1000 runs of 90 days, fixed seed.
import math
import random
import statistics

SD_Q, SD_R, DAYS, HI, LO = 0.03, 0.25, 90, 2000.0, 300.0
rng = random.Random(20261124)
res = {k: ([], [], []) for k in ("raw", "mean7", "kalman", "oracle")}
for _ in range(1000):
    rho, path, rep = 1.05, [], []
    for _ in range(DAYS + 1):
        path.append(rho)
        rep.append(rho + rng.gauss(0, SD_R))
        rho += rng.gauss(0, SD_Q)
    m, p = rep[0], SD_R ** 2
    kal = [m]
    for y in rep[1:]:
        pp = p + SD_Q ** 2
        k = pp / (pp + SD_R ** 2)
        m, p = m + k * (y - m), pp * (1 - k)
        kal.append(m)
    ests = {"raw": rep, "kalman": kal, "oracle": path[1:] + [0.0],
            "mean7": [statistics.fmean(rep[max(0, t - 6):t + 1])
                      for t in range(DAYS + 1)]}
    for name, e in ests.items():
        prof, flips, wrong, last = [], 0, 0, None
        for t in range(1, DAYS + 1):
            hi = e[t - 1] > 1.0
            prof.append((path[t] - 1) * (HI if hi else LO))
            wrong += hi != (path[t] > 1.0)
            if last is not None and hi != last:
                flips += 1
            last = hi
        res[name][0].append(math.fsum(prof))
        res[name][1].append(flips)
        res[name][2].append(wrong / DAYS)
top = statistics.fmean(res["oracle"][0])
print("estimate  switches/90d  wrong-day share  profit (yuan)  vs oracle")
for name in ("raw", "mean7", "kalman", "oracle"):
    pr = statistics.fmean(res[name][0])
    print("%-8s  %11.1f   %14.3f   %12.0f   %8.3f"
          % (name, statistics.fmean(res[name][1]),
             statistics.fmean(res[name][2]), pr, pr / top))
pss = (SD_Q ** 2 + math.sqrt(SD_Q ** 4 + 4 * SD_Q ** 2 * SD_R ** 2)) / 2
print("steady Kalman gain here: %.4f" % (pss / (pss + SD_R ** 2)))

Single source and citation

Fan, Y. (2026). Kalman Filtering and State-Space Assimilation: Separating Observation Noise from True Signals in Wearable Readings and Advertising Reports (Version 1.0.0), Chapter 6: The Advertising Report: Attribution Noise, On/Off Flighting and Budget Switching. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book