关于「四步核查与一项预注册试验」,《睡眠的算术》给出的定量结论是什么?

结论:第八章给出四步核查与一项预注册交叉试验(分数可见与隐藏,需 75 名完成者)。书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的假说;除注明的文献外,书中数据都是合成的。

数据口径:本书不是医疗建议,不给任何剂量,不推荐任何产品;持续失眠的一线治疗是失眠的认知行为疗法。 书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的假说;除注明的文献外,书中数据都是合成的。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 75

Completers needed (normal approximation)75
Recruit, allowing 20 % dropout94
Simulated power with 75 completers and a true effect of 1.50.900
查看完整验算程序
# Chapter 8. Sample size for the pre-registered crossover: each participant
# spends three weeks with the nightly sleep score VISIBLE and three weeks with
# it HIDDEN (the device still records), in random order, one week apart.
# Primary outcome: Insomnia Severity Index (ISI, 0-28) at the end of each
# period. Primary estimate: mean of (visible - hidden); POSITIVE means worse
# with the score visible. Smallest effect of interest 1.5 ISI points; assumed
# sd of the within-person difference 4.0; two-sided alpha 0.05, power 0.90; 20
# % dropout. The formula is checked by simulating the trial.
import math
import random

def z(p):
    lo, hi = -10.0, 10.0
    for _ in range(100):
        mid = 0.5 * (lo + hi)
        if 0.5 * (1 + math.erf(mid / math.sqrt(2))) < p:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)

def t_crit(df):
    # two-sided 0.05 critical value of Student's t by numerical integration of
    # the density
    def dens(x):
        return (
            math.exp(math.lgamma((df + 1) / 2) - math.lgamma(df / 2))
            / math.sqrt(df * math.pi)
            * (1 + x * x / df) ** (-(df + 1) / 2)
        )
    lo, hi = 0.0, 10.0
    for _ in range(60):
        mid = 0.5 * (lo + hi)
        n, h = 2000, mid / 2000
        area = sum(dens((i + 0.5) * h) for i in range(n)) * h
        if 0.5 + area < 0.975:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)

if __name__ == "__main__":
    sesoi, sd = 1.5, 4.0
    n = math.ceil((z(0.975) + z(0.90)) ** 2 * sd ** 2 / sesoi ** 2)
    print("Completers needed (normal approximation): {}".format(n))
    print("Recruit, allowing 20 % dropout: {}".format(math.ceil(n / 0.8)))
    rng = random.Random(57015)
    tc = t_crit(n - 1)
    hits = 0
    for _ in range(4000):
        d = [rng.gauss(sesoi, sd) for _ in range(n)]
        m = sum(d) / n
        s = math.sqrt(sum((x - m) ** 2 for x in d) / (n - 1))
        hits += abs(m / (s / math.sqrt(n))) > tc
    print(
        "Simulated power with {} completers and a true effect of 1.5: {:.3f}"
        .format(n, hits / 4000)
    )

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《双过程睡眠架构、慢波胶质淋巴清除与体温节律相位控制》第 8 章「四步核查与一项预注册试验」(版本 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}
}

本书其他章节结论