5D Library › 双人相位耦合、双线性相容张量与时空网格博弈 · English
第四章 分离的停时与「高危窗口」
锁相会被打断
第二、三章的锁相是确定性的:一旦锁住,永远锁住。真实的节律受到无数小扰动——生病、出差、家事——相位差在锁定点附近随机抖动,偶尔被推过一道势垒,滑掉整整一圈。这一刻称为一次「相位滑移」。在类比的意义上,它对应锁定关系的一次断裂。本章问两件事:这一刻在时间上如何分布;它会不会集中在某个特定的「窗口」里。
推导
带噪声的阿德勒方程与势垒。 漂移项是倾斜周期势 的负梯度。锁定点 在势阱底部,通往下一个势阱的势垒高度为 记 。克莱默斯公式给出 时的平均等待时间 (Kramers 1940);一维扩散的平均首达时间还有一个精确的二重积分 (Hänggi et al. 1990)。
第七段程序用三种方法计算第一次滑移的平均时间:克莱默斯近似、精确积分与 300 次随机模拟。
推导
# Chapter 4. How long a locked pair stays locked when life is noisy.
# dphi = (dw - K sin phi) dt + sigma dW (K = kAB + kBA)
# The locked phase sits in a well of the tilted potential
# V(phi) = -dw phi - K cos phi,
# at phi* = asin(dw / K); the barrier towards the next well has height
# dV = 2 K cos(phi*) - dw (pi - 2 phi*).
# A "slip" is the first time phi reaches phi* + 2 pi. Three estimates of
# the mean time to the first slip, with D = sigma^2 / 2:
# Kramers 2 pi / (K cos phi*) * exp(dV / D) (valid for dV >> D)
# integral the exact mean first-passage time of 1-D diffusion,
# T = (1/D) int dy exp(V(y)/D) int_{-inf}^{y} exp(-V(z)/D) dz
# simulated Euler-Maruyama, step 0.01, 300 runs
# K = 1, dw = 0.5, in model time units.
import math
import random
K, DW = 1.0, 0.5
PHI = math.asin(DW / K)
DV = 2 * K * math.cos(PHI) - DW * (math.pi - 2 * PHI)
def V(x):
return -DW * x - K * math.cos(x)
def integral_T(d, n=1500):
# (lower limit truncated at PHI - 2*pi, where exp(-V/D) is negligible)
lo, hi = PHI - 2 * math.pi, PHI + 2 * math.pi
h = (hi - lo) / n
xs = [lo + i * h for i in range(n + 1)]
inner, acc, total = 0.0, [], 0.0
for x in xs:
inner += math.exp(-V(x) / d) * h
acc.append(inner)
for x, a in zip(xs, acc):
if x >= PHI:
total += math.exp(V(x) / d) * a * h
return total / d
def simulate(d, runs, rng, dt=0.01):
s = math.sqrt(2 * d * dt)
times = []
for _ in range(runs):
x, t = PHI, 0.0
while x < PHI + 2 * math.pi:
x += (DW - K * math.sin(x)) * dt + s * rng.gauss(0, 1)
t += dt
times.append(t)
return times
if __name__ == "__main__":
rng = random.Random(62007)
print(" barrier dV = {:.4f}".format(DV))
print(" dV/D Kramers integral simulated CV alive at mean")
for ratio in (2.0, 3.0, 4.0):
d = DV / ratio
kr = 2 * math.pi / (K * math.cos(PHI)) * math.exp(ratio)
ts = simulate(d, 300, rng)
m = sum(ts) / len(ts)
sd = (sum((t - m) ** 2 for t in ts) / (len(ts) - 1)) ** 0.5
alive = sum(t > m for t in ts) / len(ts)
print(" {:3.1f} {:7.1f} {:8.1f} {:9.1f} {:4.2f} {:5.3f}"
.format(ratio, kr, integral_T(d), m, sd / m, alive))
print("\nReading: the simulated mean agrees with the exact integral")
print("within sampling error (300 runs: about 6 %). Kramers' formula is")
print("the large-barrier limit and approaches both as dV/D grows. The")
print("waiting time is close to exponential (coefficient of variation")
print("near 1, about 1/e still locked at the mean): a constant hazard.")
print("Noise alone gives no special 'danger window'.")
# barrier dV = 0.6849
# dV/D Kramers integral simulated CV alive at mean
# 2.0 53.6 65.3 66.1 0.92 0.363
# 3.0 145.7 168.7 160.8 0.95 0.387
# 4.0 396.1 441.0 469.4 0.98 0.367
#
# Reading: the simulated mean agrees with the exact integral
# within sampling error (300 runs: about 6 %). Kramers' formula is
# the large-barrier limit and approaches both as dV/D grows. The
# waiting time is close to exponential (coefficient of variation
# near 1, about 1/e still locked at the mean): a constant hazard.
# Noise alone gives no special 'danger window'.模拟的平均值与精确积分在抽样误差之内一致;克莱默斯公式是大势垒极限, 从 2.0 增到 4.0 时,它与精确值之比从 53.6 对 65.3 逐步接近(396.1 对 441.0)。平均等待时间随 指数增长:势垒每高出一个 ,等待时间大约乘以 。
更重要的是最后两列。等待时间的变异系数接近 1(0.92 到 0.98),到平均时间时仍保持锁定的比例接近 (0.363、0.387、0.367)——这正是指数分布的特征。指数分布的风险率是常数:已经锁定了多久,对下一刻是否滑移没有影响。只有噪声时,不存在任何特别危险的时间窗口。
加上每年一次的冲击
「流年」一类的说法设想的是另一种机制:每年某个固定的时刻,有一个外来的冲击。第八段程序在同一个系统上加入这样的冲击——每年开始时把相位向势垒推 ——并记录每次滑移发生在一年中的什么时候。
推导
# Chapter 4. A yearly shock on top of the noise.
# Same locked pair as p07 (K = 1, dw = 0.5, dV/D = 3, mean first slip about
# 165 time units). Let one "year" be 20 time units. At the start of every
# year the phase receives a kick of size A towards the barrier (an outside
# event of fixed size, at a fixed date). For 400 runs each, the program
# records the date of the first slip - the last time phi crossed the top
# of the barrier, pi - phi*, before going on to phi* + 2 pi - and reports
# the mean waiting time in years, the share of slips in the first twelfth
# of a year after a kick (1/12 = 0.083 if the date did not matter), and
# the hazard in that month relative to the rest of the year.
import math
import random
K, DW = 1.0, 0.5
PHI = math.asin(DW / K)
DV = 2 * K * math.cos(PHI) - DW * (math.pi - 2 * PHI)
YEAR, DT = 20.0, 0.01
def first_slip(a, d, rng):
s = math.sqrt(2 * d * DT)
steps_per_year = int(round(YEAR / DT))
top = math.pi - PHI
x, i, crossed = PHI, 0, 0.0
while True:
if a and i % steps_per_year == 0 and i > 0:
x += a
prev = x
x += (DW - K * math.sin(x)) * DT + s * rng.gauss(0, 1)
i += 1
if prev < top <= x:
crossed = i * DT
if x >= PHI + 2 * math.pi:
return crossed
if __name__ == "__main__":
d = DV / 3.0
rng = random.Random(62008)
print(" kick A mean wait (years) share in month after kick"
" hazard ratio")
for a in (0.0, 0.5, 1.0, 1.5):
ts = [first_slip(a, d, rng) for _ in range(400)]
mean_y = sum(ts) / len(ts) / YEAR
frac = [(t / YEAR) % 1.0 for t in ts]
early = sum(f < 1 / 12 for f in frac) / len(ts)
ratio = (early / (1 / 12)) / ((1 - early) / (11 / 12))
print(" {:3.1f} {:6.2f} {:5.3f}"
" {:5.2f}".format(a, mean_y, early, ratio))
print("\nReading: without kicks the date of a slip is spread evenly over")
print("the year. A kick both shortens the wait and concentrates slips")
print("in the month that follows it. The window is a property of the")
print("assumed kick: the model puts it there, it does not discover it.")
# kick A mean wait (years) share in month after kick hazard ratio
# 0.0 7.82 0.090 1.09
# 0.5 6.32 0.177 2.37
# 1.0 4.05 0.323 5.24
# 1.5 2.35 0.505 11.22
#
# Reading: without kicks the date of a slip is spread evenly over
# the year. A kick both shortens the wait and concentrates slips
# in the month that follows it. The window is a property of the
# assumed kick: the model puts it there, it does not discover it.没有冲击时(),滑移在一年中均匀分布:落在冲击后第一个月的比例为 0.090,接近 ,风险比 1.09。冲击越强,平均等待越短(从 7.82 年缩到 2.35 年),滑移越集中在冲击后的那个月: 时该月占 0.323,风险比 5.24; 时占 0.505,风险比 11.22。
这个结果需要正确地读。窗口存在,是因为模型假设了一个在固定日期、固定大小的冲击;模型把窗口放了进去,并没有发现它。要说一个真实的「流年」窗口存在,必须先在数据里看到它。
检验一个窗口需要多少数据
第九段程序计算,在一个事先指定的月份里,要看见风险比为 的集中,需要多少次带确切日期的分离;再说明事后挑选月份会发生什么。
推导
# Chapter 4. How many break-ups it takes to see a danger window.
# Claim to test: "slips are h times as likely in a pre-named month as in
# the rest of the year". Under no effect a slip falls in the named month
# with probability 1/12; under the claim with p1 = h / (h + 11). With n
# dated events the test counts those in the window and rejects at
# one-sided alpha = 0.05 (exact binomial). The program finds the smallest
# n with 80 % power, and the number of couples to follow for five years if
# 25 % of them separate in that time. It then shows what happens when the
# window is chosen AFTER looking: with no effect at all, picking the
# busiest of 12 months and testing it at 0.05 (20,000 simulated studies).
import math
import random
def tail(n, p, k):
"""P(X >= k) for X ~ Binomial(n, p)."""
return sum(math.comb(n, j) * p ** j * (1 - p) ** (n - j)
for j in range(k, n + 1))
def crit(n, p0=1 / 12, alpha=0.05):
k = 0
while tail(n, p0, k) > alpha:
k += 1
return k
def n_needed(h, power=0.8):
p1 = h / (h + 11)
n = 10
while tail(n, p1, crit(n)) < power:
n += 1
return n
if __name__ == "__main__":
print(" hazard ratio h events needed couples followed 5 years")
for h in (1.5, 2.0, 3.0, 5.0):
n = n_needed(h)
print(" {:3.1f} {:5d} {:6,d}".format(
h, n, math.ceil(n / 0.25)))
rng = random.Random(62009)
n, hits = 120, 0
k = crit(n)
for _ in range(20000):
counts = [0] * 12
for _ in range(n):
counts[rng.randrange(12)] += 1
hits += max(counts) >= k
print("\n no effect, 120 events, busiest month tested at 0.05:")
print(" false-positive rate {:.3f}".format(hits / 20000))
print("\nReading: a hazard ratio of 2 in a named month needs about 130")
print("dated separations; a ratio of 1.5 needs over 400, from more than")
print("1,600 couples. Choosing the month after seeing the data turns a")
print("5 % test into one that 'finds' a window in over 40 % of studies.")
# hazard ratio h events needed couples followed 5 years
# 1.5 409 1,636
# 2.0 130 520
# 3.0 47 188
# 5.0 17 68
#
# no effect, 120 events, busiest month tested at 0.05:
# false-positive rate 0.432
#
# Reading: a hazard ratio of 2 in a named month needs about 130
# dated separations; a ratio of 1.5 needs over 400, from more than
# 1,600 couples. Choosing the month after seeing the data turns a
# 5 % test into one that 'finds' a window in over 40 % of studies.风险比为 5 时,17 次带日期的分离就够;风险比为 2 时需要 130 次;风险比为 1.5 时需要 409 次,如果五年内有四分之一的伴侣分开,这意味着要追踪 1,636 对伴侣。下半段是更常见的错误:在完全没有效应的数据里,看过 120 次分离的日期之后挑出最拥挤的那个月再做检验,5% 的检验在 0.432 的研究中「发现」了窗口。
注
对「感情决裂高危时间窗」功能的含义。 一个声称能预言分手月份的系统,至少需要三样东西才能被检验:事先写定的窗口规则(不能看过结果再定),每个人各自的确切分离日期,以及足够的数量——效应中等时是几百次分离。没有这三样,任何「应验」的例子都无法与第九段程序下半段的巧合区分开。
假说 · 尚未验证
作者的假说(尚未验证): 用任何一种事先公布的流年窗口规则,对带确切日期的分离数据做检验,窗口月份的风险比与 1 没有可区分的差别。什么结果会证明它错:在预先登记、由独立分析者执行的检验中,窗口月份的风险比在两个独立样本中都显著大于 1。
小结
带噪声的锁相系统中,第一次滑移的等待时间接近指数分布,风险率恒定:噪声本身不产生危险窗口。窗口只在模型假设了固定日期的外部冲击时出现,冲击越强越集中,风险比可以从 1.09 升到 11.22——但这是假设的结果,不是发现。要在真实数据中检验一个窗口,必须事先指定月份并收集大量带确切日期的分离;事后挑选月份会让 5% 的检验在 0.432 的研究中「发现」并不存在的窗口。
参考文献
Fan, Y. (2026). Dyadic Phase Coupling, Bilinear Compatibility Tensors and Spatiotemporal Grid Games: Asymmetric Kuramoto Locking, Stopping-Time Separation Hazards and Magic-Square Permutation Operators [双人相位耦合、双线性相容张量与时空网格博弈] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090172 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).