What does Branching Ratios of Comment Cascades conclude, in numbers, about “Half-Life and the Stock of Aftershocks: Forecasting the Tail of a Post”?
Answer: Chapter 5 computes the stock and half-life of aftershocks once outside traffic stops; in a backtest, shrinkage toward the account mean cuts the median forecast error from 0.589 to 0.418, and convexity lifts the expected multiplier to 3.40.
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.418, 0.589
| shrink weight w = 0.394 | ||
| comments after minute 120: median 39, p10 9, p90 159 | ||
| forecast | median abs error | share within 30% |
| truth | 0.270 | 0.550 |
| fitted | 0.589 | 0.260 |
| shrunk | 0.418 | 0.363 |
| account | 0.526 | 0.300 |
| zero | 1.000 | 0.000 |
| flat | 39.090 | 0.000 |
Show the full program
# Chapter 5. p52: Forecasting the tail of a post from its first two hours.
# Simulated posts: outside traffic mu = 1.0 per minute for 120 minutes,
# then none; each post has its own true n ~ Normal(0.6, 0.15) clipped
# to [0.2, 0.9] (between-post spread tau = 0.15, illustrative); beta =
# 0.1. Target: comments after minute 120 (to minute 720). Forecasts:
# truth E / (beta (1 - n)) with the post's own true n
# fitted the same with n fitted on minutes 0-120 (p42, beta fixed)
# shrunk n = 0.6 + w (fitted - 0.6), w = tau^2 / (tau^2 + s^2),
# s = 0.186 the two-hour sampling sd from p43
# account n = 0.6 for every post
# zero "the push stopped, so the post is over"
# flat "the heat goes on": last 20 minutes' rate for 600 minutes
# Score: median |forecast / actual - 1| over 300 posts. Fixed seed.
import math
import random
MU, BETA, T, END, TAU, S = 1.0, 0.1, 120.0, 720.0, 0.15, 0.186
G = (math.sqrt(5) - 1) / 2
def simulate_off(mu, n, beta, t_off, horizon, rng):
t, excess, times = 0.0, 0.0, []
while True:
bound = (mu if t < t_off else 0.0) + excess
if bound <= 0:
return times
w = rng.expovariate(bound)
t += w
if t > horizon:
return times
excess *= math.exp(-beta * w)
if rng.random() * bound <= (mu if t < t_off else 0.0) + excess:
times.append(t)
excess += n * beta
def stats(times, beta, horizon):
a, prev, out = 0.0, None, []
for t in times:
if prev is not None:
a = math.exp(-beta * (t - prev)) * (1 + a)
out.append(a)
prev = t
s = math.fsum(1 - math.exp(-beta * (horizon - t)) for t in times)
return out, s
def loglik(mu, n, beta, a_list, s, horizon):
terms = [math.log(mu + n * beta * a) for a in a_list]
return math.fsum(terms) - mu * horizon - n * s
def golden_max(f, lo, hi, iters=40):
x1, x2 = hi - G * (hi - lo), lo + G * (hi - lo)
f1, f2 = f(x1), f(x2)
for _ in range(iters):
if f1 < f2:
lo, x1, f1 = x1, x2, f2
x2 = lo + G * (hi - lo)
f2 = f(x2)
else:
hi, x2, f2 = x2, x1, f1
x1 = hi - G * (hi - lo)
f1 = f(x1)
x = (lo + hi) / 2
return x, f(x)
def fit_n(times, beta, horizon):
a_list, s = stats(times, beta, horizon)
cnt = len(times)
hi = min(0.999, cnt / s - 1e-9)
n, ll = golden_max(lambda v: loglik((cnt - v * s) / horizon, v, beta,
a_list, s, horizon), 0.0, hi)
return n, (cnt - n * s) / horizon, ll
def to_come(times, n, beta, horizon):
e = math.fsum(n * beta * math.exp(-beta * (horizon - t)) for t in times)
return e / (beta * (1 - n))
rng = random.Random(20261113)
W = TAU ** 2 / (TAU ** 2 + S ** 2)
names = ("truth", "fitted", "shrunk", "account", "zero", "flat")
err = {k: [] for k in names}
actual_all = []
for _ in range(300):
n_true = min(0.9, max(0.2, rng.gauss(0.6, TAU)))
ts = simulate_off(MU, n_true, BETA, T, END, rng)
early = [t for t in ts if t <= T]
actual = max(len(ts) - len(early), 1)
actual_all.append(actual)
n_hat = fit_n(early, BETA, T)[0]
last = len([t for t in early if t > T - 20])
fc = (to_come(early, n_true, BETA, T), to_come(early, n_hat, BETA, T),
to_come(early, 0.6 + W * (n_hat - 0.6), BETA, T),
to_come(early, 0.6, BETA, T), 0.0, last / 20.0 * 600.0)
for k, f in zip(names, fc):
err[k].append(abs(f / actual - 1))
actual_all.sort()
print("shrink weight w = %.3f" % W)
print("comments after minute 120: median %d, p10 %d, p90 %d"
% (actual_all[150], actual_all[30], actual_all[270]))
print("forecast median abs error share within 30%")
for k in names:
e = sorted(err[k])
good = len([x for x in e if x <= 0.3]) / len(e)
print("%-8s %.3f %.3f" % (k, (e[149] + e[150]) / 2, good))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 5: Half-Life and the Stock of Aftershocks: Forecasting the Tail of a Post. 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
- Chapter 1 · Hits Are Aftershocks: the Branching Ratio and the 1/(1-n) Multiplier
- Chapter 2 · Exogenous and Endogenous: Three Decay Classes under Power-Law Memory and the Half-Life of the Exponential Kernel
- Chapter 3 · Thinning and Time Rescaling: Simulating a Comment Stream, Then Auditing It
- Chapter 4 · Log-Likelihood, Grid and Golden Section: How Precisely Two Hours Pin Down the Branching Ratio
- Chapter 6 · Paid Reach Posing as Word of Mouth: Non-Stationary Outside Rates and Apparent Criticality
- Chapter 7 · Eastern and Western Sources Examined: "Zeng Shen Has Killed a Man" and Omori's Aftershock Law
- Chapter 8 · Closing the Loop: Estimate the Branching Ratio in the First Two Hours, Then Decide Whether to Push