What does Branching Ratios of Comment Cascades conclude, in numbers, about “Thinning and Time Rescaling: Simulating a Comment Stream, Then Auditing It”?

Answer: Chapter 3 simulates comment streams by Ogata's thinning and audits fits by time rescaling, finding that the gap test can hardly see clumping while the count-dispersion test rejects a flat Poisson model 0.646 of the time.

Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.

中文版

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.646

post 1 (260 comments), Hawkes  KS 0.037  dispersion 19.23
post 1 (260 comments), Poisson KS 0.055  dispersion 48.95
500 posts, share rejected at 5%:
  Hawkes   KS 0.042   dispersion 0.066
  Poisson  KS 0.024   dispersion 0.646
gap-based KS barely sees two hours of clumping; counts per slice
do. Audit a fit with both, and never with KS alone.
Show the full program
# Chapter 3. p32: Time rescaling: does a fitted model explain the clumps?
# If the intensity model is right, the compensator values
#   s_i = Lambda(t_i)  form a unit-rate Poisson process on [0, Lambda(T)]
# (Ogata 1988; Brown et al. 2002). Two checks on the rescaled points:
# (a) Kolmogorov-Smirnov distance of the gaps, 1 - exp(-gap) against
#     uniform, 5% critical value 1.36 / sqrt(N);
# (b) dispersion: counts in 12 equal slices of [0, Lambda(T)], chi-square
#     sum (c - m)^2 / m on 11 df, 5% critical value 19.675.
# Models on the same simulated posts: the true Hawkes model (mu 1.0,
# n 0.6, beta 0.1) and a flat Poisson rate N / T. Fixed seed.
import math
import random

MU, N, BETA, T, SLICES = 1.0, 0.6, 0.1, 120.0, 12


def simulate(mu, n, beta, horizon, rng):
    t, excess, times = 0.0, 0.0, []
    while True:
        bound = mu + excess
        w = rng.expovariate(bound)
        t += w
        if t > horizon:
            return times
        excess *= math.exp(-beta * w)
        if rng.random() * bound <= mu + excess:
            times.append(t)
            excess += n * beta


def rescale(times, mu, n, beta, horizon):
    inc, prev, excess = [], 0.0, 0.0
    for t in times + [horizon]:
        d = t - prev
        inc.append(mu * d + excess / beta * (1 - math.exp(-beta * d)))
        excess = excess * math.exp(-beta * d) + n * beta
        prev = t
    out = [math.fsum(inc[:k + 1]) for k in range(len(inc))]
    return out[:-1], out[-1]


def ks(s):
    gaps = [b - a for a, b in zip([0.0] + s[:-1], s)]
    u = sorted(1 - math.exp(-g) for g in gaps)
    m = len(u)
    return max(max((i + 1) / m - v, v - i / m) for i, v in enumerate(u))


def dispersion(s, total):
    c = [0] * SLICES
    for x in s:
        c[min(int(x / total * SLICES), SLICES - 1)] += 1
    m = len(s) / SLICES
    return math.fsum((k - m) ** 2 for k in c) / m


rng = random.Random(20261121)
rows = {"Hawkes": [0, 0], "Poisson": [0, 0]}
first = None
for rep in range(500):
    ts = simulate(MU, N, BETA, T, rng)
    crit = 1.36 / math.sqrt(len(ts))
    for name, mu, n in (("Hawkes", MU, N), ("Poisson", len(ts) / T, 0.0)):
        s, tot = rescale(ts, mu, n, BETA, T)
        k, d = ks(s), dispersion(s, tot)
        rows[name][0] += k > crit
        rows[name][1] += d > 19.675
        if rep == 0:
            print("post 1 (%d comments), %-7s KS %.3f  dispersion %.2f"
                  % (len(ts), name, k, d))
print("500 posts, share rejected at 5%:")
for name in ("Hawkes", "Poisson"):
    print("  %-7s  KS %.3f   dispersion %.3f"
          % (name, rows[name][0] / 500, rows[name][1] / 500))
print("gap-based KS barely sees two hours of clumping; counts per slice")
print("do. Audit a fit with both, and never with KS alone.")

Single source and citation

Fan, Y. (2026). Hawkes Self-Exciting Point Processes: Branching-Ratio Criticality in Comment Cascades and the Aftershock Half-Life of Livestream Herd Buying (Version 1.0.0), Chapter 3: Thinning and Time Rescaling: Simulating a Comment Stream, Then Auditing It. 5D Library. DOI pending

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

BibTeX
@book{fan2026234,
  author    = {Fan, Yafu},
  title     = {Hawkes Self-Exciting Point Processes: Branching-Ratio Criticality in Comment Cascades and the Aftershock Half-Life of Livestream Herd Buying},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book