关于「作为马尔可夫链的睡眠架构,以及一晚能告诉你什么」,《睡眠的算术》给出的定量结论是什么?
结论:第三章的非齐次马尔可夫链只用一个衰减压力与一个超日计时器,就重现了 0.69 的深睡眠落在前三分之一夜、约 92 分钟的周期;对一个生理从不改变的睡眠者,中间 90% 的夜晚深睡眠从 24.0 到 131.0 分钟不等,检测 10 分钟的真实变化每段需要 165 晚。
数据口径:本书不是医疗建议,不给任何剂量,不推荐任何产品;持续失眠的一线治疗是失眠的认知行为疗法。 书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的假说;除注明的文献外,书中数据都是合成的。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 10, 131.0, 165, 24.0, 90
| N3 (deep) mean | 75.5 min sd 32.4 min middle 90 % 24.0 to 131.0 min |
| REM mean 100.3 min sd 38.7 min middle 90 % | 44.5 to 169.5 min |
| Nights per block needed to detect a true 10-minute change in N3 | 165 |
| Share of single nights whose N3 is 10 or more minutes below this | |
| sleeper's own mean | 0.404 |
| Reading: with nothing at all changed, a sizeable share of nights look 'worse | |
| by ten minutes of deep sleep'. One night's number is mostly the dice. |
查看完整验算程序
# Chapter 3. How much does one night tell you? The same sleeper, with exactly
# the same physiology every night (the p05 chain, unchanged), still produces
# different nights, because stage sequences are random. We count minutes of N3
# ("deep sleep") and of REM per night over 2,000 nights, then ask how many
# nights of averaging are needed to detect a real change of 10 minutes of N3
# (two-sided alpha 0.05, power 0.80, comparing a block of nights before with a
# block after).
import math
import random
W, N1, N2, N3, R = range(5)
def step(st, t, since_rem, rng):
s = math.exp(-t / 2.5)
u = rng.random()
if st == W:
return N1 if u < 0.045 else W
if st == N1:
if u < 0.10:
return N2
return W if u < 0.12 else N1
if st == N2:
p_n3 = 0.05 * s
p_r = 0.0 if since_rem < 100 else 0.03 * (0.5 + t / 8)
if u < p_n3:
return N3
if u < p_n3 + p_r:
return R
if u < p_n3 + p_r + 0.006:
return N1
if u < p_n3 + p_r + 0.009:
return W
return N2
if st == N3:
p_out = 0.012 + 0.05 * (1 - s)
if u < p_out:
return N2
return W if u < p_out + 0.001 else N3
p_end = 1.0 / (20 + 50 * t / 8)
if u < p_end * 0.8:
return N2
if u < p_end:
return W
return R
def night(rng):
st, since, n3, rem = W, 0, 0, 0
for e in range(960):
st = step(st, e / 120.0, since, rng)
since = 0 if st == R else since + 1
n3 += st == N3
rem += st == R
return n3 / 2, rem / 2
if __name__ == "__main__":
rng = random.Random(57006)
data = [night(rng) for _ in range(2000)]
for k, name in ((0, "N3 (deep)"), (1, "REM")):
v = sorted(d[k] for d in data)
m = sum(v) / len(v)
sd = math.sqrt(sum((x - m) ** 2 for x in v) / (len(v) - 1))
print(
"{:<10} mean {:5.1f} min sd {:4.1f} min middle 90 % {:5.1f} to"
" {:5.1f} min".format(name, m, sd, v[100], v[1899])
)
sd = math.sqrt(
sum((d[0] - sum(x[0] for x in data) / 2000) ** 2 for d in data) / 1999
)
n = math.ceil(2 * (1.959964 + 0.841621) ** 2 * sd ** 2 / 10.0 ** 2)
print(
"\nNights per block needed to detect a true 10-minute change in"
" N3: {}".format(n)
)
print(
"Share of single nights whose N3 is 10 or more minutes below this"
"\nsleeper's own mean: {:.3f}".format(
sum(d[0] <= sum(x[0] for x in data) / 2000 - 10 for d in data)
/ 2000
)
)
print(
"\nReading: with nothing at all changed, a sizeable share of nights"
" look 'worse"
)
print(
"by ten minutes of deep sleep'. One night's number is mostly the"
" dice."
)唯一数据源与引用
范雅福(Fan, Y.). (2026). 《双过程睡眠架构、慢波胶质淋巴清除与体温节律相位控制》第 3 章「作为马尔可夫链的睡眠架构,以及一晚能告诉你什么」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090162
DOI: 10.5281/zenodo.24090162 · 阅读本章所在专著 · 5DL-B-057 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026057,
author = {Fan, Yafu},
title = {Two-Process Sleep Architecture, Slow-Wave Glymphatic Clearance and Thermoregulatory Phase Control},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090162},
url = {https://doi.org/10.5281/zenodo.24090162}
}