What does Survival Analysis for Livestream Retention conclude, in numbers, about “Closing the Loop: a Hazard Review after Every Show and a Plan to Falsify”?
Answer: Chapter 8 gives the post-show review, the Swipe-Spike Hook Scheduler and a pre-registered test plan with an expected hazard ratio of 0.718. Marked boxes separate published evidence, runnable Python calculations (18 programs), classical sources and the author's hypotheses.
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: 0.718
| room R (p41): switch windows 311 exits / 45089 viewer-s, rest 781 / 1081624 | |||||
| mean window multiplier: arm S 0.700 | arm U 0.975 | HR 0.718 | |||
| HR | power | events | streams, both arms: ICC 0 | 0.005 | 0.02 | |
| 0.90 | 0.8 | 2829 | | 10 | 24 | 66 |
| 0.90 | 0.9 | 3787 | | 13 | 32 | 88 |
| 0.80 | 0.8 | 631 | | 3 | 6 | 15 |
| 0.80 | 0.9 | 845 | | 3 | 7 | 20 |
| 0.72 | 0.8 | 291 | | 1 | 3 | 7 |
| 0.72 | 0.9 | 390 | | 2 | 4 | 10 |
| 0.60 | 0.8 | 121 | | 1 | 1 | 3 |
| 0.60 | 0.9 | 162 | | 1 | 2 | 4 |
Show the full program
# Chapter 8. p82: how many streams does the pre-registered test need?
# Contrast: settled-viewer exits inside the five switch windows, under
# the scheduled hooks (arm S) versus hooks every 20 minutes at a random
# phase (arm U). Expected hazard ratio from the hook model: arm S covers
# 3 of 5 windows at rho = 0.5; arm U covers a window only when a hook
# happens to run through it. Events needed (Schoenfeld 1983, equal
# arms): d = 4 (z_a + z_b)^2 / (ln HR)^2. Streams, not viewers, are
# randomised, so d is inflated by the design effect 1 + (m - 1) ICC,
# m = switch-window exits per stream (311 in room R, from p41).
import math
import statistics
SWITCH = [180, 900, 1260, 1980, 2700] # 环节切换秒数(示意)
SPIKE_LEN, W, RHO = 30, 60, 0.5
M = 311 # 每场切换窗口退出数(p41)
COUNTS = (311, 45089, 781, 1081624) # p41 两档的离开数与人秒
nd = statistics.NormalDist()
def covered(starts, s):
# 钩子窗口与切换窗口重叠的秒数占比
sec = [t for t in range(s, s + SPIKE_LEN)
if any(a <= t < a + W for a in starts)]
return len(sec) / SPIKE_LEN
def mult(starts):
return math.fsum(1.0 - RHO * covered(starts, s)
for s in SWITCH) / len(SWITCH)
arm_s = mult([870, 1230, 1950])
arm_u = math.fsum(mult([ph, ph + 1200, ph + 2400])
for ph in range(0, 1200)) / 1200.0
hr = arm_s / arm_u
print("room R (p41): switch windows %d exits / %d viewer-s, rest %d / %d"
% COUNTS)
print("mean window multiplier: arm S %.3f arm U %.3f HR %.3f"
% (arm_s, arm_u, hr))
def events(h, power, alpha=0.05):
za = nd.inv_cdf(1 - alpha / 2)
zb = nd.inv_cdf(power)
return 4.0 * (za + zb) ** 2 / math.log(h) ** 2
print(" HR power events | streams, both arms: ICC 0 0.005 0.02")
for h in (0.9, 0.8, round(hr, 2), 0.6):
for pw in (0.8, 0.9):
d = events(h, pw)
row = [math.ceil(d * (1 + (M - 1) * icc) / M)
for icc in (0.0, 0.005, 0.02)]
print("%5.2f %5.1f %6d | %24d %5d %4d"
% (h, pw, math.ceil(d), row[0], row[1], row[2]))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 8: Closing the Loop: a Hazard Review after Every Show and a Plan to Falsify. 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 3 · Two Clocks: Seconds since Entry, the Programme Clock and Delayed Entry
- 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