What does Survival Analysis for Livestream Retention conclude, in numbers, about “Two Clocks: Seconds since Entry, the Programme Clock and Delayed Entry”?
Answer: Chapter 3 separates two clocks: the switch hazard ratio of settled viewers on the programme clock averages 8.52, squashed to 4.23 when newcomers are mixed in.
Scope of the numbers: Its rooms, audiences, hazard parameters, hook effects and run sheets are illustrative; all calculations are generated by its programs; the book is not individual business advice. Marked boxes separate published evidence, runnable Python calculations (18 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: 4.23, 8.52
| audience at switches | 180:256 900:346 1260:353 1980:402 2700:421 |
| switch | all: pre spike ratio | settled: pre spike ratio | |
| 180 | 0.00244 0.00820 | 3.4 | 0.00089 0.00638 7.2 |
| 900 | 0.00172 0.00778 | 4.5 | 0.00068 0.00709 10.4 |
| 1260 | 0.00223 0.00811 | 3.6 | 0.00108 0.00635 5.9 |
| 1980 | 0.00178 0.00844 | 4.7 | 0.00079 0.00725 9.2 |
| 2700 | 0.00163 0.00795 | 4.9 | 0.00072 0.00717 10.0 |
| mean ratio: all viewers 4.23 settled viewers 8.52 | |
| settled hazard 2000-2600 s | 0.00078 per s model base 0.00167 |
Show the full program
# Chapter 3. p31: the programme clock with delayed entry.
# Same illustrative room R. A viewer who enters at second e and stays d
# seconds is at risk at programme seconds e to e + d - 1 and, if the
# exit is observed, leaves in second e + d - 1. The risk set at second t
# is everyone present then (late entrants join it when they arrive).
# For each run-sheet switch s the hazard in [s, s + 30) is compared with
# the two minutes before it, for all viewers and for settled viewers
# (at least 60 s since their own entry).
import math
import random
T_END = 3600
SWITCH = [180, 900, 1260, 1980, 2700] # 环节切换秒数(示意)
SPIKE_LEN, B_SW = 30, 0.012
LAM0 = 1.0 / 600.0
A_OPEN, TAU = 0.12, 6.0
SHAPE = 2.0
SETTLE = 60
def prog_hazard(horizon):
h = [LAM0] * horizon
for s in SWITCH:
for t in range(s, s + SPIKE_LEN):
h[t] = LAM0 + B_SW
return h
def open_int(u):
return A_OPEN * TAU * (math.exp(-u / TAU) - math.exp(-(u + 1) / TAU))
def simulate(seed, horizon=T_END):
rng = random.Random()
rng.seed(seed)
ent = [rng.randrange(0, 60) for _ in range(400)]
ent += [rng.randrange(0, 3300) for _ in range(2600)]
ent.sort()
ph = prog_hazard(horizon)
rows = []
for e in ent:
z = rng.gammavariate(SHAPE, 1.0 / SHAPE)
need = rng.expovariate(1.0)
cum, t = 0.0, e
while t < horizon:
cum += z * (ph[t] + open_int(t - e)) # step
t += 1
if cum >= need:
break
if cum >= need:
rows.append((e, t - e, 1))
else:
rows.append((e, horizon - e, 0))
return rows
def clock_tables(rows, settle):
# 每秒在场人数与退出数(差分数组,整数)
pres = [0] * (T_END + 1)
exits = [0] * T_END
for e, d, ev in rows:
start = e + settle
if start >= e + d:
continue
pres[start] += 1
pres[e + d] -= 1
if ev:
exits[e + d - 1] += 1
run, at = 0, []
for t in range(T_END):
run += pres[t] # step
at.append(run)
return at, exits
def rate(at, exits, lo, hi):
return math.fsum(exits[lo:hi]) / math.fsum(at[lo:hi])
rows = simulate(20261113)
all_at, all_ex = clock_tables(rows, 0)
st_at, st_ex = clock_tables(rows, SETTLE)
print("audience at switches: " + " ".join(
"%d:%d" % (s, all_at[s]) for s in SWITCH))
print("switch | all: pre spike ratio | settled: pre spike ratio")
ratios = []
for s in SWITCH:
a0, a1 = rate(all_at, all_ex, s - 120, s), rate(all_at, all_ex, s,
s + SPIKE_LEN)
b0, b1 = rate(st_at, st_ex, s - 120, s), rate(st_at, st_ex, s,
s + SPIKE_LEN)
ratios.append((a1 / a0, b1 / b0))
print("%6d | %.5f %.5f %5.1f | %.5f %.5f %5.1f"
% (s, a0, a1, a1 / a0, b0, b1, b1 / b0))
print("mean ratio: all viewers %.2f settled viewers %.2f"
% (math.fsum(r[0] for r in ratios) / 5.0,
math.fsum(r[1] for r in ratios) / 5.0))
quiet = rate(st_at, st_ex, 2000, 2600)
print("settled hazard 2000-2600 s: %.5f per s model base %.5f"
% (quiet, LAM0))Single source and citation
Fan, Y. (2026). Kaplan-Meier Retention Curves for Livestream Rooms: Locating Swipe-Away Hazard Spikes and Timing the Insertion of Hooks (Version 1.0.0), Chapter 3: Two Clocks: Seconds since Entry, the Programme Clock and Delayed Entry. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-277 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026277,
author = {Fan, Yafu},
title = {Kaplan-Meier Retention Curves for Livestream Rooms: Locating Swipe-Away Hazard Spikes and Timing the Insertion of Hooks},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Blind Spot of Average Viewing Time: Censoring and the Product Limit
- Chapter 2 · From Retention to Hazard: the Nelson-Aalen Estimator and the Entry Spike
- Chapter 4 · Piecewise-Constant Hazards: Maximum Likelihood, Likelihood Ratios and Finding the Switches
- Chapter 5 · A Model of What a Hook Does: the Window, the Aftermath and Who Stays
- Chapter 6 · Dynamic Programming for Hook Insertion: the Best Seconds for K Hooks
- Chapter 7 · Classical Sources East and West: Sunzi on Spirit and Graunt's Table of Mortality
- Chapter 8 · Closing the Loop: a Hazard Review after Every Show and a Plan to Falsify