关于「从留存到风险:纳尔逊-阿伦估计与入场尖峰定位」,《直播间留存的生存分析》给出的定量结论是什么?
结论:第二章用纳尔逊-阿伦估计定位入场尖峰,入场头两秒的风险是坐稳之后的 133.3 倍,并说明随手圈尖峰会大量错报。
数据口径:书中的直播间、观众数、风险参数、钩子效果与节目单均为示意;全部计算由书中程序生成;本书是非个人化经营建议,钩子只能是真实的内容或写明真实库存与真实截止时刻的福利,不用会重置的倒计时,不诱导未成年人消费,平台规则以官方公示为准。 第一章说明截尾让平均停留偏低:示意直播间里把下播当离开得 408.1 秒,只算已离开者得 278.0 秒,乘积极限估计的限定平均停留是 337.9 秒。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 133.3
| Nelson-Aalen H(t): 5s 0.386 | 10s 0.532 | 30s 0.663 | 60s 0.716 | 600s 1.350 |
| hazard after 600 s in the room: 0.00074 per s | ||||
| bin (s) | exits | viewer-s | hazard/s | ratio |
| 0-2 | 560 | 5678 | 0.09863 | 133.3 |
| 2-4 | 329 | 4700 | 0.07000 | 94.6 |
| 4-6 | 201 | 4116 | 0.04883 | 66.0 |
| 6-10 | 182 | 7322 | 0.02486 | 33.6 |
| 10-20 | 164 | 16312 | 0.01005 | 13.6 |
| 20-30 | 48 | 15363 | 0.00312 | 4.2 |
| 30-60 | 79 | 44223 | 0.00179 | 2.4 |
| 60-120 | 108 | 82912 | 0.00130 | 1.8 |
| 120-300 | 294 | 208247 | 0.00141 | 1.9 |
| 300-600 | 262 | 257110 | 0.00102 | 1.4 |
| peak bin 0-2 s is 133 times the settled hazard |
核心公式
\[\hat H(t) = \sum_{t_i \le t} \frac{d_i}{n_i}.\]
查看完整验算程序
# Chapter 2. p21: Nelson-Aalen cumulative hazard and binned swipe hazard.
# Same illustrative room R as p11 (same seed). On the viewer's own clock
# (seconds since entry) it computes the Nelson-Aalen estimate
# H(t) = sum over exit times of d/n, the hazard per bin as exits divided
# by viewer-seconds at risk, and the ratio of each bin to the hazard
# measured after the first ten minutes in the room.
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
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 nelson_aalen(rows):
# 每个退出秒数 t:H += d / n(n = 停留至少 t 秒的人数)
dur = sorted((d, ev) for _, d, ev in rows)
n, i, incs, out = len(dur), 0, [], []
while i < len(dur):
t = dur[i][0]
d = 0
j = i
while j < len(dur) and dur[j][0] == t:
d += dur[j][1] # step
j += 1
if d:
incs.append(d / n)
out.append((t, math.fsum(incs)))
n -= j - i # step
i = j
return out
def binned(rows, lo, hi):
# 区间 [lo, hi) 内:退出数 / 在场人秒
ev = len([1 for _, d, e in rows if e and lo < d <= hi])
expo = math.fsum(min(d, hi) - lo for _, d, _ in rows if d > lo)
return ev, expo, ev / expo
rows = simulate(20261113)
na = nelson_aalen(rows)
late = binned(rows, 600, 3600)[2]
def h_at(t):
v = 0.0
for tt, hh in na:
if tt > t:
break
v = hh
return v
print("Nelson-Aalen H(t): " + " ".join(
"%ds %.3f" % (t, h_at(t)) for t in (5, 10, 30, 60, 600)))
print("hazard after 600 s in the room: %.5f per s" % late)
print(" bin (s) exits viewer-s hazard/s ratio")
for lo, hi in ((0, 2), (2, 4), (4, 6), (6, 10), (10, 20), (20, 30),
(30, 60), (60, 120), (120, 300), (300, 600)):
ev, ex, h = binned(rows, lo, hi)
print("%4d-%-5d %8d %9.0f %10.5f %6.1f"
% (lo, hi, ev, ex, h, h / late))
first = binned(rows, 0, 2)[2]
print("peak bin 0-2 s is %.0f times the settled hazard" % (first / late))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《直播间留存卡普兰迈耶生存曲线、划走风险尖峰定位与福利钩子插入秒数母典》第 2 章「从留存到风险:纳尔逊-阿伦估计与入场尖峰定位」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}