5D Library › Two-Process Sleep Architecture, Slow-Wave Glymphatic Clearance and Thermoregulatory Phase Control · 中文

Chapter 8. A Four-Step Check and a Pre-Registered Trial

Four questions before changing anything

This chapter turns the book into four questions. They are not a treatment. Persistent insomnia — difficulty sleeping on at least three nights a week for three months or more — is a medical condition, and cognitive behavioural therapy for insomnia (CBT-I) is the recommended first-line treatment in European and American guidelines (Riemann et al. 2017; Qaseem et al. 2016). Loud snoring, pauses in breathing, choking at night, or sleepiness that interferes with driving or work need a doctor, not a tracker.

1. Is this a measurement problem or a sleep problem? Before acting on a tracker’s numbers, compare them with how the day actually feels and functions, averaged over a week. Chapter 6 showed that a validation study cannot show a device to be better than its human scorers, and that a night-to-night change in a score is noisier than the score itself.

2. What does a single night tell me? Almost nothing, about deep sleep or REM. Chapter 3 (p06) showed that a sleeper whose physiology never changes produces deep sleep ranging from 24.0 to 131.0 minutes across the middle 90 % of nights, and that detecting a real 10-minute change needs months. Read weekly averages; ignore single nights.

3. Is caffeine still masking pressure at bedtime? Chapter 1 showed that caffeine changes how much sleep pressure is felt, not how much there is, and that what remains at lights-out depends on the half-life as much as on the time of the last cup. Half-life differs several-fold between people and is lengthened by pregnancy and some medicines (Nehlig 2018). This book gives no doses; anyone pregnant, with a heart condition or taking medicines that interact with caffeine should ask a doctor or pharmacist.

4. Is the thermal valve open? Chapter 5 showed that the core cools at night mainly through warm hands and feet, and that warming before bed can steepen the evening decline only if it ends well before lights-out. The question is about timing, not about any product.

A pre-registered trial: does seeing the score make sleep worse?

Chapter 6 ended with a hypothesis that can be tested cheaply: that for people who check a nightly sleep score, hiding it improves insomnia symptoms. The trial below is written before any data exist.

Hypothesis · not established

The study. Adults who wear a consumer sleep tracker every night and report checking its sleep score; excluded: diagnosed sleep disorders, shift work, pregnancy, current treatment for insomnia. Each participant spends three weeks with the score visible and three weeks with it hidden (the device still records; the app is set to hide the score), in random order, separated by a one-week washout. Primary outcome: Insomnia Severity Index (ISI, 0-28) at the end of each period (Bastien et al. 2001). Primary estimate: mean within-person difference, visible minus hidden; positive means worse with the score visible. Smallest effect of interest: 1.5 ISI points. Secondary outcomes (reported, never changing the verdict): device-recorded total sleep time and sleep-onset latency, daytime sleepiness. Safety: anyone whose ISI reaches the clinical range is advised to see a doctor and is offered referral for CBT-I, whatever their period. Run and analysed by researchers independent of the author’s business; no product is involved or endorsed.

Calculation

# 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)
    )
# Completers needed (normal approximation): 75
# Recruit, allowing 20 % dropout: 94
# Simulated power with 75 completers and a true effect of 1.5: 0.900

With an assumed standard deviation of 4.0 for the within-person difference, the trial needs 75 completers for 90 % power at the smallest effect of interest, and the simulation of the trial confirms the formula (power 0.900). Allowing 20 % dropout, it recruits 94.

Calculation

# Chapter 8. Decision rule for the score-visible vs score-hidden crossover,
# fixed before the data are examined. D = mean ISI difference (visible -
# hidden) with its 95 % confidence interval; POSITIVE D means the visible
# score made insomnia symptoms worse. SESOI 1.5 ISI points. Gates, checked
# first: fewer than 90 % of the 75 planned completers; adherence (fewer than
# 80 % of nights with the score truly hidden in the hidden period, from the
# app log); a period-by-treatment interaction (carry-over) with p < 0.10, in
# which case only the first period is analysed and the verdict says so.
SESOI = 1.5

def verdict(d, lo, hi, n=75, n_planned=75, adherence=0.95, carryover_p=0.5):
    if n < 0.9 * n_planned:
        return (
            "D = {:+.2f}: NOT INTERPRETABLE - only {} of {} planned"
            " completers".format(d, n, n_planned)
        )
    if adherence < 0.80:
        return (
            "D = {:+.2f}: NOT INTERPRETABLE - the score was really hidden"
            "\n    on only {:.0%} of hidden-period nights".format(
                d, adherence
            )
        )
    if lo >= SESOI:
        v = "seeing the score worsens symptoms\n    by at least the SESOI"
    elif lo > 0:
        v = (
            "seeing the score worsens symptoms,\n    not shown to reach the"
            " SESOI"
        )
    elif hi < 0:
        v = "seeing the score IMPROVES symptoms"
    elif lo >= -SESOI and hi <= SESOI:
        v = "no difference worth acting on"
    else:
        v = "unclear: the interval is too wide to decide"
    out = "D = {:+.2f} ({:+.2f} to {:+.2f}): {}".format(d, lo, hi, v)
    if carryover_p < 0.10:
        out += (
            "\n    qualifier: carry-over detected; first-period comparison"
            " only,\n      lower power"
        )
    return out

if __name__ == "__main__":
    for c in (
        (2.4, 1.6, 3.2),
        (1.1, 0.2, 2.0),
        (0.2, -0.7, 1.1),
        (-1.3, -2.2, -0.4),
        (0.6, -1.8, 3.0),
        (2.4, 1.6, 3.2, 75, 75, 0.95, 0.04),
        (2.4, 1.6, 3.2, 60),
        (2.4, 1.6, 3.2, 75, 75, 0.71),
    ):
        print(verdict(*c))
    print(
        "\nSecondary outcomes (device total sleep time, sleep-onset latency,"
        " daytime"
    )
    print(
        "sleepiness) are reported with intervals and never change the"
        " verdict."
    )
    print(
        "The example numbers above are invented, to show what each branch"
        " prints."
    )
# D = +2.40 (+1.60 to +3.20): seeing the score worsens symptoms
#     by at least the SESOI
# D = +1.10 (+0.20 to +2.00): seeing the score worsens symptoms,
#     not shown to reach the SESOI
# D = +0.20 (-0.70 to +1.10): no difference worth acting on
# D = -1.30 (-2.20 to -0.40): seeing the score IMPROVES symptoms
# D = +0.60 (-1.80 to +3.00): unclear: the interval is too wide to decide
# D = +2.40 (+1.60 to +3.20): seeing the score worsens symptoms
#     by at least the SESOI
#     qualifier: carry-over detected; first-period comparison only,
#       lower power
# D = +2.40: NOT INTERPRETABLE - only 60 of 75 planned completers
# D = +2.40: NOT INTERPRETABLE - the score was really hidden
#     on only 71% of hidden-period nights
#
# Secondary outcomes (device total sleep time, sleep-onset latency, daytime
# sleepiness) are reported with intervals and never change the verdict.
# The example numbers above are invented, to show what each branch prints.

The decision rule prints one line per branch. Two gates make the result uninterpretable rather than negative: too few completers, and a “hidden” period in which the score was not really hidden on at least 80 % of nights, read from the app log rather than from self-report. A carry-over between periods restricts the analysis to the first period and says so. A result in the opposite direction — the visible score improving symptoms — is a possible and informative outcome, and the rule names it.

Note

What a positive result would and would not mean. It would mean that, for people who already check their score, hiding it reduced insomnia symptoms over three weeks. It would not mean that trackers are harmful in general, that the score is inaccurate, or that people who do not check a score would benefit from anything. A null result would not show that trackers are harmless; it would show that this particular effect, at this size, was not found.

Summary

Four questions summarise the book: whether the problem is in the measurement or in the sleep, what a single night can show, whether caffeine is still masking pressure at bedtime, and whether the thermal valve is open in time. Persistent insomnia and possible sleep apnoea need a doctor, and CBT-I is the recommended first-line treatment for insomnia. One hypothesis from the book can be tested cheaply and prospectively: a randomised crossover of score-visible against score-hidden, which needs 75 completers and has a decision rule written in advance.

References

Bastien, Célyne H., Annie Vallières, and Charles M. Morin. 2001. “Validation of the Insomnia Severity Index as an Outcome Measure for Insomnia Research.” Sleep Medicine 2 (4): 297–307.
Nehlig, Astrid. 2018. “Interindividual Differences in Caffeine Metabolism and Factors Driving Caffeine Consumption.” Pharmacological Reviews 70 (2): 384–411.
Qaseem, Amir, Devan Kansagara, et al. 2016. “Management of Chronic Insomnia Disorder in Adults: A Clinical Practice Guideline from the American College of Physicians.” Annals of Internal Medicine 165 (2): 125–33.
Riemann, Dieter, Chiara Baglioni, et al. 2017. “European Guideline for the Diagnosis and Treatment of Insomnia.” Journal of Sleep Research 26 (6): 675–700.

Fan, Y. (2026). Two-Process Sleep Architecture, Slow-Wave Glymphatic Clearance and Thermoregulatory Phase Control: Adenosine Homeostasis, Flip-Flop Switch Bistability, Core-Distal Heat Flux and Sleep-Stage Markov Chains [双过程睡眠架构、慢波胶质淋巴清除与体温节律相位控制] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090162 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).