5D Library › 离散周期网络中的双尺度重整化、占位数分布熵与推力波叠加定理 · English

第八章 实践与预注册检验:四步核查表与盲法置换回测

注

本章不是投资建议,也不提供任何交易方法。 核查表的示例是一个虚构的「林先生」与他的店铺,所有人名、数字与数据都是编造的或程序合成的。第二部分的检验方案用于判断一个统计假说是否成立;无论结果如何,它都不说明任何资产可以据此买卖,也不说明任何命理推断有效。真实的市场交易可能亏损全部本金,使用杠杆或衍生品时损失可能超过本金。

第一部分 四步核查表

前七章可以整理成四个问题。当有人说「某种历法标签与某种结果有关」时,依次问:

  1. 唯一的预测与唯一的结局。 在看新数据之前,这个说法是否被写成了一个可以算出数字的预测,并且只指定了一个主要结局(第六章)?
  2. 偶然基线。 如果标签与结果毫无关系,这样的「巧合」有多常见(巴纳姆效应与随机期望,第六章)?
  3. 分叉计数。 一共可能试过多少种标签、结局与时间窗口?校正以后还剩下什么(多重检验与数据窥探,第六章)?
  4. 盲法检验。 在新的数据上,由不知道标签含义的人,按事先写定的置换检验与判定规则,结果如何(第八章第二部分)?

推导

把核查表用在虚构的林先生身上。林先生说,他的店铺过去 24 年中营业额最好的 24 个月里,有 5 个是「冲月」(月支 = 年支 + 6),所以冲月对他的生意有利。第 2 步计算:如果月份与营业额无关,24 个最好的月份中冲月的个数服从二项分布(每个月是冲月的概率为 1/12)。第 3 步估计他可能试过的分叉:12 种「月支 − 年支」的差值 × 3 种结局(最好的月份、最差的月份、平均值)× 2 种时间窗口(全部年份、最近几年)= 72 种。第 4 步:在随后 12 年的新数据(程序合成,不含任何历法效应)上做年内分层置换检验。

推导

# The four-step checklist applied to a FICTIONAL claim (all names and numbers invented).
# "Mr. Lin" says his shop's best months fall in opposition months (month branch = year
# branch + 6): of the 24 best months in the past 24 years, 5 were opposition months.
import math, random
from math import comb
rng = random.Random(37)

# Step 1: ONE prediction, written down before new data are seen: in the next 12 years,
# opposition months have higher log sales than the other 11 months of the same year;
# one-sided alpha 0.025; the shop's records are coded by someone who does not know it.
print("step 1: one outcome (within-year contrast of log sales), one-sided alpha 0.025")
# Step 2: chance baseline for the anecdote. If months were unrelated to sales, each of the
# 24 best months would be an opposition month with probability 1/12.
p_tail = sum(comb(24, k) * (1 / 12) ** k * (11 / 12) ** (24 - k) for k in range(5, 25))
print(f"step 2: expected opposition months among 24 best: {24 / 12:.0f};"
      f" P(5 or more by chance) = {p_tail:.3f}")
# Step 3: how many patterns could have produced an equally striking story? 12 offsets x 3
# outcomes (best, worst, average months) x 2 windows (all years, recent years) = 72.
forks = 72
print(f"step 3: {forks} forks -> Bonferroni-adjusted p = {min(1.0, forks * p_tail):.2f};")
print(f"   P(at least one fork this striking) = {1 - (1 - p_tail) ** forks:.2f}"
      " if the forks were independent")
# Step 4: blind test on the NEXT 12 years (synthetic sales with no calendar effect).
Y0 = 6
logs = [math.log(100) + rng.gauss(0, 0.15) for _ in range(144)]
c = [[12 / 11 * (logs[12 * j + m] - sum(logs[12 * j:12 * j + 12]) / 12)
      for m in range(12)] for j in range(12)]
sel = [next(m for m in range(12) if ((m + 2) - (j + Y0)) % 12 == 6) for j in range(12)]
d0 = sum(c[j][sel[j]] for j in range(12)) / 12
null = [sum(c[j][rng.randrange(12)] for j in range(12)) / 12 for _ in range(9999)]
p = (1 + sum(d >= d0 for d in null)) / 10000
print(f"step 4: contrast {d0:+.3f} (ratio {math.exp(d0):.2f}), one-sided permutation"
      f" p = {p:.3f} -> {'supported' if p <= 0.025 else 'not supported'}")
# step 1: one outcome (within-year contrast of log sales), one-sided alpha 0.025
# step 2: expected opposition months among 24 best: 2; P(5 or more by chance) = 0.045
# step 3: 72 forks -> Bonferroni-adjusted p = 1.00;
#    P(at least one fork this striking) = 0.96 if the forks were independent
# step 4: contrast -0.032 (ratio 0.97), one-sided permutation p = 0.764 -> not supported

第 1 步把林先生的说法改写为一个预测:随后 12 年中,冲月的对数营业额高于同一年其他月份,单侧 α=0.025\alpha = 0.025。第 2 步:随机期望是 24 个最好的月份中有 2 个冲月,出现 5 个或更多的概率为 0.045,单独看「显著」。第 3 步:若他在 72 种分叉中只报告了最引人注目的一种,邦费罗尼校正后的 pp 值为 1.00;在各分叉相互独立的近似下,72 种中至少有一种同样引人注目的概率为 0.96。第 4 步:在新数据上,冲月的年内对比为 −0.032(比值 0.97),置换检验 p=0.764p = 0.764,不支持。这个虚构的例子说明,一个「单独看显著」的故事,在计入分叉以后几乎不提供证据,而在新数据上的盲法检验才是判断它的办法。

第二部分 预注册盲法置换回测方案

作者框架第八章提出「双盲去标签的历史时间序列回测」。下面把它写成一项只有一个预测量、一个主要结局的检验方案。之所以不设计人体随机对照试验,是因为本书的模型讨论的是计数结构与分配,而作者框架中最接近可检验预测的主张,是关于历法标签与历史时间序列的;与第 33 本的方法一致,方案只设一项主要结局,并写明把握度。

问题与唯一的预测量

在美国股市整体按节气月累计的超额收益中,「冲月」(月支 = 年支 + 6)的典型变动幅度,是否大于同一年的其他节气月?

假说 · 尚未验证

为检验而操作化的作者假说(尚未确立,须作者在登记前确认)。把年支看作环上被「占据」的节点,与它对径的月份看作「耦合态」的节点;第三章中,半空对径对的通量被放大为 1+c=1.51 + c = 1.5 倍。据此,模型的唯一预测量是:冲月的典型变动幅度(以对数绝对收益衡量的几何平均)与同一年其他月份之比 RR;假说预测 R>1R > 1,并以模型给出的 R=1.5R = 1.5 作为最小关注效应。这一操作化是本书为了检验而作的选择,作者的框架本身没有规定它;任何其他操作化都必须另行登记,不能在看到结果以后替换。如果检验得出「1.5 倍或更大的效应被排除」或「冲月较小,与预测相反」,这一操作化下的假说即被推翻。

设计

要素 规定
设计 对公开历史数据的盲法置换检验,事先在公开登记平台登记方案、映射表与分析代码
数据集 肯尼斯·弗伦奇数据库中的美国股市整体日度超额收益与无风险收益(「Fama/French 3 Factors [Daily]」中的 Mkt−RF 与 RF,日度数据自 1926 年 7 月 1 日起 (French, n.d.);因子的构造见 (Fama and French 1993));以登记当日下载的版本为准,存档并公开其校验码
时间段 1930 年立春至 2026 年立春,共 96 个完整的干支年(庚午年至乙巳年)、1,152 个节气月;96 年恰为 8 个十二年周期,每个节气月(寅月至丑月)恰好有 8 次是冲月
历法映射 年界为立春的交节时刻(太阳视黄经 315°),月界为十二个「节」的交节时刻(立春、惊蛰、清明、立夏、芒种、小暑、立秋、白露、寒露、立冬、大雪、小寒,视黄经 315° 起每隔 30°),以协调世界时(UTC)记录,北京时间 = UTC + 8 小时;交易日 dd(纽约日期)的收益归入「dd 日 21:00 UTC」(固定的分日点,即北京时间次日 05:00;它不早于任何年份的纽约收盘:现行的 16:00 收盘在冬令时为 21:00 UTC、在夏令时为 20:00 UTC,早年收盘更早)所在的节气月;映射表由一位独立的历法审核人对照天文台公布的交节时刻核对,并用下文的程序独立复算
节气月收益 每个节气月的超额收益 r=∏d(1+Rm,d)−∏d(1+Rf,d)r = \prod_d (1 + R_{m,d}) – \prod_d (1 + R_{f,d}),乘积取该节气月内的全部交易日,Rm,d=(Mkt−RF)d+RFdR_{m,d} = (\text{Mkt−RF})_d + \text{RF}_d,Rf,d=RFdR_{f,d} = \text{RF}_d;|r|<0.005%|r| < 0.005\% 时按 0.005%0.005\% 计
标签 冲月:月支 ≡\equiv 年支 +6(mod⁡12)+ 6 \pmod{12},每年恰好一个,共 96 个
主要结局 对数绝对收益的年内对比:每年计算 cy=1211(log|r冲|−log⁡|r|¯y)c_y = \frac{12}{11}\left(\log|r_{\text{冲}}| – \overline{\log|r|}_y\right),取 96 年的平均 DD;R=eDR = e^{D}
主要检验 单侧分层置换检验:每一年内随机重新指定一个月为「冲月」,重复 9,999 次,p=(1+#{D*≥D})/10,000p = (1 + \#\{D^* \ge D\})/10{,}000;p≤0.025p \le 0.025 为「冲月较大」
区间 D±1.96⋅SD(cy)/96D \pm 1.96 \cdot \mathrm{SD}(c_y)/\sqrt{96},换算为 RR 的 95% 置信区间
盲法 数据管理员把 12 种「月支 − 年支」差值类别随机编码为 A 到 L,只把编码后的类别与收益交给分析者;分析者用锁定的代码对全部 12 类计算 DD、pp 与区间,结果加时间戳公开以后,才揭示哪一类是冲(差值为 6)
次要与敏感性分析 全部 12 类的结果(在无效应时,单侧 0.025 下预期约有 0.3 类假阳性);循环平移检验(全部 143 个非零平移);北京日期规则(交易日 dd 归入北京日期不晚于 dd 的最后一个「节」所开始的节气月);旧的近似映射(月度 Mkt−RF,按公历月份 15 日所在的节气月定月支);去掉 1930 年代的子样本。次要分析不改变主要判定

主要结局只设一项。次要分析帮助解释结果,但不参与主要判定;所有分析都写入登记的代码。

历法映射:精确的交节时刻

干支历的年与月以节气为界。年界是立春,即太阳视黄经达到 315° 的时刻;月界是十二个「节」,即视黄经从 315° 起每隔 30° 的时刻(立春 315°、惊蛰 345°、清明 15°……大雪 255°、小寒 285°);其间的十二个「中气」(雨水、春分等)不作月界。下面的程序用 Meeus《天文算法》第 25 章的低精度公式计算太阳的视黄经(由几何黄经加上光行差与黄经章动的近似修正,该书给出的精度约为 0.01°)(Meeus 1998),力学时与世界时之差 ΔT\Delta T 取已公布的近似值(1930 年约 24 秒,2026 年约 69 秒),用二分法求出视黄经达到 285°+30°i285° + 30° i 的时刻,以 UTC 记录。程序只用标准库,并与天文台公布的交节时刻逐一比较:香港天文台 2013、2015、2016 年的十二个「节」(香港时间,UTC + 8)(Hong Kong Observatory, n.d.),日本国立天文台 2024、2026 年的十二个「节」(日本时间,UTC + 9,比北京时间早一小时)(国立天文台 暦計算室, n.d.)。

推导

# Exact solar-term boundaries for Chapter 8. Apparent solar longitude by the low-accuracy
# method of Meeus (1998, ch. 25; stated accuracy about 0.01 degree); TT = UT + Delta T
# (rough published values); bisection for the moment the longitude reaches 285 + 30 i.
# Times are UTC; Beijing time = UTC + 8 h. Checked against published observatory times.
import math
from bisect import bisect_right
from datetime import datetime, timedelta, timezone
UTC, BJ = timezone.utc, timezone(timedelta(hours=8))
J2000 = datetime(2000, 1, 1, 12, tzinfo=UTC)
DT = [(1930, 24), (1950, 29), (1970, 40), (1990, 57), (2000, 64), (2010, 66),
      (2020, 69), (2030, 69)]                                  # Delta T in seconds

def delta_t(y):
    for (y0, d0), (y1, d1) in zip(DT, DT[1:]):
        if y < y1:
            return d0 + (d1 - d0) * (y - y0) / (y1 - y0)
    return DT[-1][1]

def longitude(t):
    """Apparent geocentric longitude of the Sun (degrees) at the UTC moment t."""
    T = ((t - J2000).total_seconds() + delta_t(t.year)) / 86400 / 36525
    L0 = 280.46646 + 36000.76983 * T + 0.0003032 * T * T
    M = math.radians(357.52911 + 35999.05029 * T - 0.0001537 * T * T)
    C = ((1.914602 - 0.004817 * T - 0.000014 * T * T) * math.sin(M)
         + (0.019993 - 0.000101 * T) * math.sin(2 * M) + 0.000289 * math.sin(3 * M))
    om = math.radians(125.04 - 1934.136 * T)
    return (L0 + C - 0.00569 - 0.00478 * math.sin(om)) % 360   # aberration + nutation

def jie(y, i):
    """UTC moment of the jie term at longitude 285 + 30 i in calendar month i + 1 of y."""
    target = (285 + 30 * i) % 360
    lo = datetime(y, i + 1, 1, tzinfo=UTC); hi = lo + timedelta(days=12)
    while hi - lo > timedelta(seconds=1):
        mid = lo + (hi - lo) / 2
        if (longitude(mid) - target + 180) % 360 < 180: lo = mid
        else: hi = mid
    return lo

# Published times (MMDDhhmm, January to December): HKO (UTC+8), NAOJ (UTC+9).
PUB = {(2013, 8): "01051234 02040013 03051815 04042302 05051618 06052023 "
                  "07070635 08071620 09071916 10081058 11071414 12070709",
       (2015, 8): "01060021 02041158 03060556 04051039 05060353 06060758 "
                  "07071812 08080401 09080700 10082243 11080159 12071853",
       (2016, 8): "01060608 02041746 03051144 04041628 05050942 06051349 "
                  "07070003 08070953 09071251 10080433 11070748 12070041",
       (2024, 9): "01060549 02041727 03051123 04041602 05050910 06051310 "
                  "07062320 08070909 09071211 10080400 11070720 12070017",
       (2026, 9): "01051723 02040502 03052259 04050340 05052049 06060048 "
                  "07071057 08072043 09072341 10081529 11071852 12071153"}

if __name__ == "__main__":
    t = jie(2026, 1).astimezone(BJ)
    print(f"start of spring 2026 (315 deg): {t:%Y-%m-%d %H:%M} Beijing time (UTC+8)")
    err = []
    for (y, tz), s in PUB.items():
        for i, tok in enumerate(s.split()):
            pub = datetime(y, int(tok[:2]), int(tok[2:4]), int(tok[4:6]), int(tok[6:]),
                           tzinfo=timezone(timedelta(hours=tz)))
            err.append((jie(y, i) - pub).total_seconds() / 60)
    print(f"vs {len(err)} published times: error {min(err):+.1f} to {max(err):+.1f} min,"
          f" mean {sum(err) / len(err):+.1f}, mean |error| "
          f"{sum(map(abs, err)) / len(err):.1f}")
    # Boundaries from the start of spring 1930 to the start of spring 2026.
    B = [jie(y, i) for y in range(1930, 2027) for i in range(12)]
    B = B[1:B.index(jie(2026, 1)) + 1]
    days = [(b - a).total_seconds() / 86400 for a, b in zip(B, B[1:])]
    print(f"{len(B)} boundaries, {len(days)} solar-term months, {len(days) // 12} years;"
          f" month length {min(days):.2f} to {max(days):.2f} days")
    bj = [b.astimezone(BJ) for b in B]
    print(f"jie fall on day {min(b.day for b in bj)} to {max(b.day for b in bj)}"
          " of the calendar month (Beijing date)")
    mins = [b.hour * 60 + b.minute + b.second / 60 for b in B]
    near = sum(abs((m - 21 * 60 + 720) % 1440 - 720) < 15 for m in mins)
    split = sum(16 * 60 <= m < 21 * 60 for m in mins)
    print(f"boundaries within 15 min of the 21:00 UTC day cut-off: {near}")
    print(f"boundaries where the Beijing-date rule assigns one day differently: {split}")
    # Old approximation: calendar month -> solar month containing its 15th day.
    same = tot = 0
    for k in range(len(days)):
        y, m = divmod(1930 * 12 + 1 + k, 12)
        d = datetime(y, m + 1, 1, 12, tzinfo=BJ)
        mid = bisect_right(B, d.replace(day=15))
        while d.month == m + 1:
            same += bisect_right(B, d) == mid; tot += 1; d += timedelta(days=1)
    print(f"15th-day rule: {same / tot:.1%} of calendar-month days lie in the same"
          " solar-term month")
# start of spring 2026 (315 deg): 2026-02-04 03:54 Beijing time (UTC+8)
# vs 60 published times: error -13.9 to +0.0 min, mean -6.1, mean |error| 6.1
# 1153 boundaries, 1152 solar-term months, 96 years; month length 29.46 to 31.43 days
# jie fall on day 3 to 9 of the calendar month (Beijing date)
# boundaries within 15 min of the 21:00 UTC day cut-off: 20
# boundaries where the Beijing-date rule assigns one day differently: 241
# 15th-day rule: 80.5% of calendar-month days lie in the same solar-term month

程序算出 2026 年立春为北京时间 2 月 4 日 03:54;日本国立天文台公布的是日本时间 05:02,即北京时间 04:02。与公布的 60 个交节时刻相比,程序的时刻几乎都偏早:误差在 −13.9 到 +0.0 分钟之间,平均偏早 6.1 分钟。太阳的视黄经每小时约移动 0.041°,0.01° 相当于约 15 分钟,所以这一误差与公式标称的精度相符,但比「数分钟」要大。因此,登记的映射表以天文台公布的交节时刻(或同等精度的历表)为准,本程序只用于独立复算与示范。

从 1930 年立春到 2026 年立春共有 1,153 个交节时刻、1,152 个节气月,节气月长 29.46 到 31.43 天,交节都落在公历月份的 3 日到 9 日(北京日期)。只有 20 个交节离 21:00 UTC 的分日点不到 15 分钟,近到程序的误差可能把一个交易日分错,审核人须对照公布的时刻逐一核对。若改用北京日期规则,有 241 个交节落在北京时间凌晨 0 点到 5 点之间,交节北京日期的前一天会改归前一个节气月;只有这一天是交易日时,归属才真正改变。这列为预先规定的敏感性分析。最后一行核对草稿中曾用的近似:按公历月份 15 日所在的节气月定月支时,公历月份中只有 80.5% 的日子真正落在该节气月里;这正是改用日度数据、按精确交节时刻汇总的原因。

把握度

数据集是固定的:96 年就是 96 年,1,152 个节气月由两万多个交易日累计而成,样本量不能增加。所以这里的问题不是「需要多少样本」,而是「这份固定的数据能检测多大的效应」。

推导

# Power of the Chapter 8 test on a FIXED 96 years of solar-term months built from DAILY
# returns. Synthetic daily GARCH(1,1) excess returns (normal or t(5) shocks, illustrative
# values), 21 trading days per solar-term month; every daily return in the opposition
# month is multiplied by R (the volatility process itself is unchanged). Month outcome
# log|month return|; D = mean yearly contrast; one-sided alpha 0.025; R = 1.5 = 1 + c.
import math, random
from statistics import NormalDist, stdev
YEARS, Y0, DAYS = 96, 6, 21
Z = NormalDist().inv_cdf

def history(rng, R=1.0, df=None, a=0.08, b=0.91):
    s2, ys, sq = 1.0, [], math.sqrt
    for T in range(12 * YEARS):
        y, m = divmod(T, 12); k = R if ((m + 2) - (y + Y0)) % 12 == 6 else 1.0
        tot = 0.0
        for _ in range(DAYS):
            z = rng.gauss(0, 1)
            if df:                                   # t(df) shock scaled to variance 1
                z /= sq(2 * rng.gammavariate(df / 2, 1) / (df - 2))
            x = sq(s2) * z; tot += k * x; s2 = (1 - a - b) + a * x * x + b * s2
        ys.append(math.log(abs(tot) + 1e-12))
    return ys

def contrasts(ys):
    c = [[12 / 11 * (ys[12 * j + m] - sum(ys[12 * j:12 * j + 12]) / 12)
          for m in range(12)] for j in range(YEARS)]
    sel = [next(m for m in range(12) if ((m + 2) - (j + Y0)) % 12 == 6)
           for j in range(YEARS)]
    return c, sel

if __name__ == "__main__":
    rng = random.Random(1930)
    for df in (None, 5):
        sds = []
        for _ in range(200):
            c, sel = contrasts(history(rng, df=df))
            sds.append(stdev([c[j][sel[j]] for j in range(YEARS)]))
        sd = sum(sds) / len(sds); se = sd / math.sqrt(YEARS)
        lab = "normal" if df is None else f"t({df})"
        pw = {r: 1 - NormalDist().cdf(Z(0.975) - math.log(r) / se)
              for r in (1.25, 1.5, 1.75)}
        mde = math.exp((Z(0.975) + Z(0.90)) * se)
        yrs = math.ceil(((Z(0.975) + Z(0.90)) * sd / math.log(1.25)) ** 2)
        print(f"{lab} daily shocks: SD of yearly contrast {sd:.2f}, SE of D {se:.3f}")
        print("   power at R = " + ", ".join(f"{r}: {p:.0%}" for r, p in pw.items()))
        print(f"   90 % power needs R >= {mde:.2f}; R = 1.25 would need {yrs} years")
    # Check by simulation with the pre-registered within-year permutation test.
    for R in (1.0, 1.5):
        rej = 0
        for _ in range(600):
            c, sel = contrasts(history(rng, R))
            d0 = sum(c[j][sel[j]] for j in range(YEARS)) / YEARS
            null = [sum(c[j][rng.randrange(12)] for j in range(YEARS)) / YEARS
                    for _ in range(199)]
            rej += (1 + sum(d >= d0 for d in null)) / 200 <= 0.025
        print(f"simulated permutation test (normal daily shocks), R = {R}:"
              f" rejects {rej / 600:.1%}")
# normal daily shocks: SD of yearly contrast 1.20, SE of D 0.122
#    power at R = 1.25: 45%, 1.5: 91%, 1.75: 100%
#    90 % power needs R >= 1.49; R = 1.25 would need 303 years
# t(5) daily shocks: SD of yearly contrast 1.21, SE of D 0.123
#    power at R = 1.25: 44%, 1.5: 91%, 1.75: 100%
#    90 % power needs R >= 1.49; R = 1.25 would need 308 years
# simulated permutation test (normal daily shocks), R = 1.0: rejects 2.3%
# simulated permutation test (normal daily shocks), R = 1.5: rejects 89.8%

程序按登记的做法生成数据:先用带波动聚集的日度 GARCH(1,1) 模型生成日超额收益(正态冲击与厚尾的 t(5)t(5) 冲击两种,参数为示意值,每个节气月 21 个交易日),再按节气月累计;效应设为把冲月里每一天的收益乘以 RR,不改变波动过程本身。年内对比的标准差约为 1.20 与 1.21,于是 DD 的标准误约为 0.122 与 0.123。在单侧 α=0.025\alpha = 0.025 下,对 R=1.5R = 1.5 的把握度两种模型都是 91%;对 R=1.25R = 1.25 只有 45% 与 44%。要达到 90% 的把握度,真实效应至少要为 R≈1.49R \approx 1.49;若要以 90% 的把握度检测 R=1.25R = 1.25,需要 303 到 308 年的数据,这在任何现存的股市中都不存在。用登记的分层置换检验直接模拟,无效应时拒绝零假设的比例为 2.3%(名义水平 2.5%),R=1.5R = 1.5 时为 89.8%;模拟中每次只做 199 次置换,略低于正式分析 9,999 次置换时的把握度,所以「约 90%」是偏保守的说法。

与本书草稿中的月度设计(按公历月份近似映射)相比,把握度略有下降:草稿的正态模型给出年内对比标准差 1.13、对 R=1.5R = 1.5 的把握度 94%,90% 把握度所需的效应为 R≈1.45R \approx 1.45 到 1.491.49;现在两种模型都是 91%,所需效应约为 R≈1.49R \approx 1.49。在这组示意参数下,日度模型的波动水平在节气月之间变化得更快(按节气月计,波动的持续性约为 0.9921≈0.810.99^{21} \approx 0.81,草稿的月度模型为 0.98),同一年内各节气月的波动水平差别更大,年内对比的标准差因而升到约 1.20;这一差别也含有蒙特卡洛误差。另一方面,草稿的把握度计算没有计入公历月份只有约八成天数落在对应节气月所造成的效应稀释;按精确交节时刻汇总以后,这种稀释不再存在。

注

「90% 把握度」的含义。 与第 33 本一致:90% 指的是在真实效应恰好等于最小关注效应(R=1.5R = 1.5)时,得出某种「冲月较大」结论的概率;在这种情况下,判定规则得出最强结论「至少 1.5 倍」的机会只有约 2.5%(下面的模拟中为 2.3%)。要以较大的把握得出最强结论,真实效应需要明显大于 1.5 倍。

判定规则

推导

# Decision rule, fixed before any data are opened. R = exp(D); p = one-sided within-year
# permutation p (9,999 draws in the real analysis); CI = D +- 1.96 SD(c) / sqrt(96).
# Gates: > 1 % of trading days missing, blind broken, or mapping audit failed
# -> NOT INTERPRETABLE. Simulations use the daily model of the power program.
import math, random
from statistics import stdev
SESOI = math.log(1.5); YEARS, Y0, DAYS = 96, 6, 21

def verdict(d, lo, hi, p, missing=0.0, blind=True, mapping=True):
    if missing > 0.01: return "NOT INTERPRETABLE: over 1 % of trading days missing"
    if not blind:      return "NOT INTERPRETABLE: the analyst saw the labels"
    if not mapping:    return "NOT INTERPRETABLE: calendar mapping failed its audit"
    if lo >= SESOI:                 v = "at least 1.5x in opposition months"
    elif p <= 0.025 and hi < SESOI: v = "larger in opposition months, but below 1.5x"
    elif p <= 0.025:                v = "larger in opposition months; 1.5x not shown"
    elif hi < 0:                    v = "SMALLER in opposition months (against)"
    elif hi < SESOI:                v = "an effect of 1.5x or more is excluded"
    else:                           v = "unclear: the interval is too wide"
    return v

def show(r, lo, hi, p, **gates):
    v = verdict(math.log(r), math.log(lo), math.log(hi), p, **gates)
    return f"R = {r:.2f} ({lo:.2f} to {hi:.2f}), p = {p:.3f}: {v}"

def simulate(rng, R, a=0.08, b=0.91):
    s2, ys = 1.0, []
    for T in range(12 * YEARS):
        y, m = divmod(T, 12); k = R if ((m + 2) - (y + Y0)) % 12 == 6 else 1.0
        tot = 0.0
        for _ in range(DAYS):
            x = math.sqrt(s2) * rng.gauss(0, 1); tot += k * x
            s2 = (1 - a - b) + a * x * x + b * s2
        ys.append(math.log(abs(tot) + 1e-12))
    c = [[12 / 11 * (ys[12 * j + m] - sum(ys[12 * j:12 * j + 12]) / 12)
          for m in range(12)] for j in range(YEARS)]
    sel = [next(m for m in range(12) if ((m + 2) - (j + Y0)) % 12 == 6)
           for j in range(YEARS)]
    obs = [c[j][sel[j]] for j in range(YEARS)]; d = sum(obs) / YEARS
    half = 1.96 * stdev(obs) / math.sqrt(YEARS)
    null = [sum(c[j][rng.randrange(12)] for j in range(YEARS)) / YEARS
            for _ in range(199)]
    p = (1 + sum(x >= d for x in null)) / 200
    return verdict(d, d - half, d + half, p)

if __name__ == "__main__":
    for case in ((1.03, 0.82, 1.29, 0.40), (1.21, 0.97, 1.51, 0.050),
                 (1.32, 1.06, 1.65, 0.008), (1.12, 1.01, 1.24, 0.020),
                 (1.80, 1.52, 2.13, 0.001), (0.74, 0.60, 0.92, 0.99)):
        print(show(*case))
    print(show(1.60, 1.30, 1.97, 0.001, blind=False))
    rng = random.Random(2025)
    for R in (1.0, 1.5):
        tally = {}
        for _ in range(600):
            v = simulate(rng, R); tally[v] = tally.get(v, 0) + 1
        print(f"true R = {R}: share of 600 simulated backtests")
        for k, n in sorted(tally.items(), key=lambda kv: -kv[1]):
            print(f"   {n / 6:5.1f} %  {k}")
# R = 1.03 (0.82 to 1.29), p = 0.400: an effect of 1.5x or more is excluded
# R = 1.21 (0.97 to 1.51), p = 0.050: unclear: the interval is too wide
# R = 1.32 (1.06 to 1.65), p = 0.008: larger in opposition months; 1.5x not shown
# R = 1.12 (1.01 to 1.24), p = 0.020: larger in opposition months, but below 1.5x
# R = 1.80 (1.52 to 2.13), p = 0.001: at least 1.5x in opposition months
# R = 0.74 (0.60 to 0.92), p = 0.990: SMALLER in opposition months (against)
# R = 1.60 (1.30 to 1.97), p = 0.001: NOT INTERPRETABLE: the analyst saw the labels
# true R = 1.0: share of 600 simulated backtests
#     92.0 %  an effect of 1.5x or more is excluded
#      3.3 %  unclear: the interval is too wide
#      3.0 %  larger in opposition months; 1.5x not shown
#      1.7 %  SMALLER in opposition months (against)
# true R = 1.5: share of 600 simulated backtests
#     85.8 %  larger in opposition months; 1.5x not shown
#      9.3 %  unclear: the interval is too wide
#      2.5 %  an effect of 1.5x or more is excluded
#      2.3 %  at least 1.5x in opposition months

前七行的示例结果是编造的,用来说明每一种判定。交易日数据缺失超过 1%、分析者在提交结果前看到了标签的含义,或历法映射未通过审核时,无论结果如何,报告都写「不可解释」。只有当 RR 的 95% 置信区间下限不低于 1.5 时,报告才写「冲月至少 1.5 倍」;p≤0.025p \le 0.025 但区间下限低于 1.5 时,写「冲月较大,但未证明达到 1.5 倍」,若区间上限也低于 1.5,则写「冲月较大,但低于 1.5 倍」;p>0.025p > 0.025 而区间上限低于 1.5 时,写「1.5 倍或更大的效应被排除」,这是一个有信息量的阴性结论,与等价检验的思路一致 (Lakens 2017);区间上限低于 1 时,写「冲月较小,与预测相反」。

模拟(使用与把握度程序相同的日度模型)显示:若真实的 R=1R = 1(没有效应),600 次模拟回测中 92.0% 得出「1.5 倍或更大的效应被排除」,错误地得出「冲月较大」类结论的为 3.0%,另有 3.3% 为「不确定」,1.7% 得出「冲月较小」;若真实的 R=1.5R = 1.5,85.8% 得出「冲月较大,但未证明达到 1.5 倍」,2.3% 得出最强结论,二者合计 88.1%,在 600 次模拟约 ±1.3 个百分点的误差与只用 199 次置换的范围内,与 90% 的设计把握度一致;另有 9.3% 为「不确定」,2.5% 错误地排除了 1.5 倍效应。

这项检验不能说明什么

第一,它只检验一个市场、一个时期、一种操作化。阴性结果不说明历法标签在任何其他情境下都没有意义,更不说明前三章的数学有错(定理不依赖于数据);它只说明,在这个操作化下,模型尺度的效应不存在。第二,阳性结果不说明模型的机制正确,更不说明任何命理推断有效:它可能来自 2.5% 的偶然、数据错误、映射错误,或某种尚未认识的季节性结构;必须在其他市场与时期上事先登记重复。第三,即使冲月的变动幅度确实更大,变动的方向也无从得知,扣除交易成本以后也未必有任何可利用之处;本方案不是交易策略。第四,交易日与交节时刻的对应依赖一条事先规定的分日规则(21:00 UTC);每个交节最多影响一个交易日的归属,其中 20 个交节离分日点不到 15 分钟,须对照公布的时刻逐一核对,改用北京日期规则的结果作为敏感性分析报告。这个分日点在冬令时恰为现行的纽约收盘时刻,在夏令时与早年则晚于收盘;交节若落在当天收盘与 21:00 UTC 之间,当天已经收盘的收益仍归入新的节气月,这是事先固定的约定,结果按此报告。草稿曾用公历月份近似节气月,只有约八成的天数重合,会削弱任何真实存在的效应;改用日度数据后不再有这个问题,但日度数据中的无风险收益与早年的交易日历(例如 1930 年代的停市)都以数据库为准。第五,小于约 1.5 倍的效应,这份数据既不能证实,也不能排除。第六,数据是公开的,分析者可能见过这条收益序列;盲法保护的是标签的含义,不是数据本身,所以方案要求在登记时就锁定映射、代码与判定规则。第七,干支年以立春的交节时刻为界,与农历以正月初一为岁首不同 (国家质量监督检验检疫总局、国家标准化管理委员会 2017);这是一个事先的选择,不能在看到结果以后更换。

伦理与利益冲突

这项检验只使用公开的历史市场数据,不涉及人体受试者,也不收集任何个人信息。方案、历法映射表与分析代码在下载数据之前登记于公开的预注册平台 (Nosek et al. 2018)。由于作者持有相关仓位(美股指数或相关衍生品的常规观察仓位)并提供相关咨询,这项检验必须由与作者无经济关系、不知道标签含义的独立分析者按预先登记的代码执行;作者不参与数据的下载、编码与分析。全部代码与结果公开,无论结果正负,都将发表。

利益披露

作者以 5D Library 的著作(包括本书)作为其社群课程、升维牌卡(5D Ascension Cards,Dimensional Shift Card Decks)与 Yafu AI 知识库的方法论基础,因此与本书主题有商业利益关系。本书不推销任何课程、牌卡或服务;第八章的检验方案设计为由独立于作者企业的研究人员实施和分析,不从作者的社群、学员或客户中招募;书中所有代码与研究方案均公开,供任何人检验。作者开发并维护基于干支历法符号系统的先验分析软件工具与量化研究脚本,并提供相关的开源研究与独立咨询服务;撰写本书期间可能持有美股指数(如 SPY)或相关衍生品的常规观察仓位。本书所有模型仅供数理与历史统计的学术探讨,不构成任何投资建议、交易信号或命理预测承诺,也不推荐任何具体交易或资产。书中的模型由作者提出;由于作者持有相关仓位并提供相关咨询,第八章的检验必须由与作者无经济关系、不知道标签含义的独立分析者按预先登记的代码执行,结果不论正负都发表。

参考文献

Fama, Eugene F., and Kenneth R. French. 1993. “Common Risk Factors in the Returns on Stocks and Bonds.” Journal of Financial Economics 33 (1): 3–56. https://doi.org/10.1016/0304-405X(93)90023-5.
French, Kenneth R. n.d. Data Library: Fama/French 3 Factors [Daily]. Tuck School of Business, Dartmouth College. https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/Data_Library/f-f_factors.html.
Hong Kong Observatory. n.d. Date and Time Information of the 24 Solar Terms in 2013, 2015 and 2016. 香港天文台. https://www.hko.gov.hk/en/gts/astron2016/Solar_Term_2016.htm.
Lakens, Daniël. 2017. “Equivalence Tests: A Practical Primer for t Tests, Correlations, and Meta-Analyses.” Social Psychological and Personality Science 8 (4): 355–62. https://doi.org/10.1177/1948550617697177.
Meeus, Jean. 1998. Astronomical Algorithms. 2nd ed. Willmann-Bell.
Nosek, Brian A., Charles R. Ebersole, Alexander C. DeHaven, and David T. Mellor. 2018. “The Preregistration Revolution.” Proceedings of the National Academy of Sciences 115 (11): 2600–2606. https://doi.org/10.1073/pnas.1708274114.
国家质量监督检验检疫总局、国家标准化管理委员会. 2017. 农历的编算和颁行(GB/T 33661—2017). 中华人民共和国国家标准.
国立天文台 暦計算室. n.d. 暦要項:二十四節気および雑節(令和6年、令和8年). 国立天文台(日本). https://eco.mtk.nao.ac.jp/koyomi/yoko/2026/rekiyou262.html.

Fan, Y. (2026). Two-Scale Renormalization, Occupancy Entropy and Thrust-Wave Superposition in Discrete Cyclical Networks: Algebraic Topology and Monte Carlo Verification on a Twelve-Node Ring Lattice [离散周期网络中的双尺度重整化、占位数分布熵与推力波叠加定理] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23796761 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).