What does Branching Ratios of Comment Cascades conclude, in numbers, about “Log-Likelihood, Grid and Golden Section: How Precisely Two Hours Pin Down the Branching Ratio”?

Answer: Chapter 4 finds maximum likelihood estimates with Ozaki's recursion, the compensator identity and golden-section search; the illustrative post's 95 % interval for the branching ratio runs from 0.42 to 0.92, and two-hour estimates have a standard deviation of about 0.186.

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.42, 0.92, 95

free beta : mu 0.745n 0.682beta 0.178loglik -46.268
beta=0.1: mu 0.808n 0.675loglik -47.032
95% profile interval for n (beta fixed): 0.42 to 0.92
truth: mu 1.0n 0.6beta 0.1; multiplier 1/(1-n) 3.07 (CI 1.72 to 12.50)
Show the full program
# Chapter 4. p42: Golden-section maximum likelihood and a profile interval.
# Same post and log-likelihood as p41. Trick: for fixed beta, scaling mu
# and n together shows that at the optimum the compensator equals the
# count, mu T + n S = N; so mu = (N - n S) / T and only n is searched.
# Outer golden-section search over log beta (Kiefer 1953), inner over n.
# Profile interval for n at fixed beta: all n whose best log-likelihood
# (mu re-optimised) lies within 1.92 of the maximum (chi-square 1 df).
import math
import random

MU, N, BETA, T = 1.0, 0.6, 0.1, 120.0
G = (math.sqrt(5) - 1) / 2


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 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 fit_all(times, horizon):
    lb, _ = golden_max(lambda x: fit_n(times, math.exp(x), horizon)[2],
                       math.log(0.01), math.log(2.0), 30)
    b = math.exp(lb)
    n, mu, ll = fit_n(times, b, horizon)
    return mu, n, b, ll


def profile_n(times, n, beta, horizon):
    a_list, s = stats(times, beta, horizon)
    return golden_max(lambda m: loglik(m, n, beta, a_list, s, horizon),
                      1e-4, 5.0)[1]


times = simulate(MU, N, BETA, T, random.Random(20261121))
mu, n, b, ll = fit_all(times, T)
print("free beta : mu %.3f  n %.3f  beta %.3f  loglik %.3f"
      % (mu, n, b, ll))
n1, mu1, ll1 = fit_n(times, BETA, T)
print("beta=0.1  : mu %.3f  n %.3f  loglik %.3f" % (mu1, n1, ll1))
inside = [k / 100 for k in range(0, 100)
          if ll1 - profile_n(times, k / 100, BETA, T) <= 1.92]
print("95%% profile interval for n (beta fixed): %.2f to %.2f"
      % (inside[0], inside[-1]))
print("truth: mu %.1f  n %.1f  beta %.1f; multiplier 1/(1-n) %.2f"
      " (CI %.2f to %.2f)" % (MU, N, BETA, 1 / (1 - n1),
                              1 / (1 - inside[0]), 1 / (1 - inside[-1])))

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 4: Log-Likelihood, Grid and Golden Section: How Precisely Two Hours Pin Down the Branching Ratio. 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