5D Library › 六维超立方体游走、卦变马尔可夫链与模运算星宫晶格 · English
第八章 四步核查与一项预注册的配对检验
相信一个起卦或排盘软件之前的四个问题
本章把全书变成四个问题,可以向任何六爻或紫微斗数软件——包括作者自己的——提出。它们不是决策建议。
一、它模拟的是哪一种起卦法? 蓍草法与铜钱法动爻的数目相同,但动的是哪一种爻不同,读到哪段文字的分布相差约五分之一(第二、四章)。软件应当说明它用的是哪一种,并能用起卦记录验证。
二、规则是哪一个版本? 互卦、变占、安星与起流月的规则都有不同的版本(第一、四、五、六章)。软件应当写明所用的规则,并能用已知的排盘表核对。
三、分数取决于哪些约定? 吉凶判别与按事项评分的结构是精确的,结果取决于赋值与权重(第四、六章)。软件应当公开约定,并报告换一套合理约定后结果的变化。
四、它说中的是谁? 第 63 本说明,被认为准确不等于区分了人。要用盲法的配对检验衡量一份解读是否属于它的主人。
检验一个起卦软件
第一个问题可以直接检验。下面的程序设想一个声称使用铜钱法、实际却按蓍草法概率起卦的软件,问需要多少条起卦记录才能发现。
推导
# Chapter 8. Checking a casting device: is it really coins, or yarrow?
# A reading app may claim to reproduce the coin method or the yarrow
# method. Its log of line values (6, 7, 8, 9) can be tested against the
# claimed distribution with a chi-square goodness-of-fit test (3 degrees
# of freedom, critical value 7.815 at alpha = 0.05). Here the app is
# claimed to use coins but actually follows the yarrow odds; for several
# numbers of six-line casts, 4,000 simulated logs give the power of the
# test. (A test of whether the 64 cast hexagrams come up equally often
# cannot separate the methods: under both, each line is yang with
# probability 1/2, as p03 showed.)
import random
COINS = {6: 1 / 8, 7: 3 / 8, 8: 3 / 8, 9: 1 / 8}
YARROW = {6: 1 / 16, 7: 5 / 16, 8: 7 / 16, 9: 3 / 16}
CRIT = 7.815
def draw(dist, rng):
u, acc = rng.random(), 0.0
for v, p in dist.items():
acc += p
if u <= acc:
return v
return 9
def chi2(counts, dist, n):
return sum((counts[v] - n * p) ** 2 / (n * p) for v, p in dist.items())
if __name__ == "__main__":
rng = random.Random(64015)
print(" six-line casts lines power to reject 'coins'")
for casts in (5, 10, 20, 40, 80):
n = 6 * casts
hits = 0
for _ in range(4000):
c = {6: 0, 7: 0, 8: 0, 9: 0}
for _ in range(n):
c[draw(YARROW, rng)] += 1
hits += chi2(c, COINS, n) > CRIT
print(" {:3d} {:4d} {:.3f}".format(
casts, n, hits / 4000))
print("\nReading: a log of some 20 to 40 casts is enough to tell yarrow")
print("odds from coin odds with good power - consistent with the")
print("divergence of Chapter 2. Counting the 64 cast hexagrams alone")
print("could never tell them apart: both methods are fair on the cast")
print("hexagram and differ only in the moving lines.")
# six-line casts lines power to reject 'coins'
# 5 30 0.210
# 10 60 0.434
# 20 120 0.773
# 40 240 0.982
# 80 480 1.000
#
# Reading: a log of some 20 to 40 casts is enough to tell yarrow
# odds from coin odds with good power - consistent with the
# divergence of Chapter 2. Counting the 64 cast hexagrams alone
# could never tell them apart: both methods are fair on the cast
# hexagram and differ only in the moving lines.5 次六爻起卦(30 爻)时,卡方检验发现问题的把握度只有 0.210;20 次时为 0.773;40 次时为 0.982。只统计本卦出现的频率永远发现不了差别,因为两种方法下本卦都阴阳各半;差别只在动爻的阴阳。
一项预注册的配对检验
假说 · 尚未验证
研究方案(仿照卡尔森的双盲占星检验 (Carlson 1985))。 一种解读规则(起卦或排盘方法、文字选取规则、全部赋值与权重、生成代码)在招募前公开登记,此后不再改动。每位参与者提供出生资料(紫微)或现场起卦(六爻);软件为每人生成一份解读;参与者看到自己的解读与另外两位参与者的解读,顺序随机、不具姓名,挑出最符合自己的一份。主要结局:挑中自己解读的比例;没有任何信息时为 1/3。检验:单侧精确二项检验,。判定:达到临界命中数,才算支持「解读含有关于其主人的信息」。由与作者无经济关系、不知道解读来源的独立分析者执行,结果不论正负都发表。
推导
# Chapter 8. A pre-registered matching test of a chart reading.
# Design (after Carlson's double-blind test of astrology): each
# participant gives birth data; the software, using ONE scoring convention
# fixed and published in advance, writes a reading; the participant sees
# their own reading and two readings written for other participants, in
# random order and without names, and picks the one that fits best. With
# no information in the readings the hit rate is 1/3. The claim tested is
# a hit rate of at least 0.40. One-sided exact binomial test, alpha 0.05,
# power 80 %. The program finds the sample size, checks it by
# simulation, and prints the decision rule.
import math
import random
def tail(n, p, k):
return sum(math.comb(n, j) * p ** j * (1 - p) ** (n - j)
for j in range(k, n + 1))
def critical(n, p0=1 / 3, alpha=0.05):
lo, hi = 0, n + 1
while lo < hi:
mid = (lo + hi) // 2
if tail(n, p0, mid) <= alpha:
hi = mid
else:
lo = mid + 1
return lo
def needed(p1=0.40, power=0.8):
n = 50
while tail(n, p1, critical(n)) < power:
n += 10
while n > 1 and tail(n - 1, p1, critical(n - 1)) >= power:
n -= 1
return n
def decide(hits, n):
k = critical(n)
if hits >= k:
return "readings carry information about their owners"
if hits <= n / 3:
return "no sign of information: at or below chance"
return "above chance but not significant: no claim"
if __name__ == "__main__":
n = needed()
k = critical(n)
print(" participants needed: {:,}; reject 'chance' at {} hits or more"
.format(n, k))
rng = random.Random(64016)
sims = [sum(rng.random() < 0.40 for _ in range(n)) for _ in range(4000)]
print(" simulated power at a true hit rate of 0.40: {:.3f}".format(
sum(s >= k for s in sims) / 4000))
sims0 = [sum(rng.random() < 1 / 3 for _ in range(n)) for _ in range(4000)]
print(" simulated false-positive rate at chance: {:.3f}".format(
sum(s >= k for s in sims0) / 4000))
print("\n decision rule, one line per branch:")
for hits in (k, k - 1, n // 3):
print(" {} hits of {:,}: {}".format(hits, n, decide(hits, n)))
# participants needed: 349; reject 'chance' at 132 hits or more
# simulated power at a true hit rate of 0.40: 0.820
# simulated false-positive rate at chance: 0.043
#
# decision rule, one line per branch:
# 132 hits of 349: readings carry information about their owners
# 131 hits of 349: above chance but not significant: no claim
# 116 hits of 349: no sign of information: at or below chance要以 80% 的把握看见 0.40 的命中率(对比随机的三分之一),需要 349 名参与者,命中 132 人以上才拒绝「随机」。模拟给出 0.820 的把握度与 0.043 的假阳性率。判定规则对每个分支打印一行。卡尔森在 1985 年的检验中,占星师的命中率与随机水平没有差别 (Carlson 1985);第 37 本讨论过这一结果。
注
结果意味着什么、不意味着什么。 阴性结果说明的是这一种登记的规则在这一人群中没有可检测的区分力,不说明其他规则;阳性结果说明解读含有关于主人的信息,不说明这些信息来自命盘而不是来自其他线索——因此出生资料以外的信息必须在设计中排除。无论哪种结果,事后改换规则重新分析都不能称为本检验的结果。
小结
四个问题概括了全书:软件模拟的是哪种起卦法,规则是哪个版本,分数取决于哪些约定,解读是否真的区分了人。一个声称用铜钱法、实际按蓍草法起卦的软件,约 40 次起卦就能以 0.982 的把握被发现。一项预注册的盲法配对检验,在 349 名参与者中检验命中率是否超过随机的三分之一,结果不论正负都发表。
参考文献
Fan, Y. (2026). Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices: Boolean Cube Spectral Gaps, Yarrow-versus-Coin Probability Biases and Twelve-Palace Dihedral Projections [六维超立方体游走、卦变马尔可夫链与模运算星宫晶格] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090176 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).