5D Library › Four-Pillar Calendrical Computation and Formal Rule Engines · 中文
Chapter 8. A Four-Step Check, an Agreement Study and a Pre-Registered Matching Test
Four questions before trusting a chart program
This chapter turns the book into four questions that can be put to any four-pillar chart program, the author’s own included. They are not advice on any decision.
1. Which calendar conventions does it use? Clock time or true solar time, how the zi hour changes the day, where the solar-term times come from (Chapters 2 and 3). A program should state them and publish test vectors and a fingerprint like those of Chapter 6.
2. How does it handle uncertainty in the birth time? A quarter of an hour of error already gives about one person in ten a wrong hour pillar (Chapter 3). A program should ask how reliable the birth time is and, when the reported time falls in the flagged zone near an edge, show the chart of the neighbouring double-hour as well.
3. Which parameters does its judgement use? How hidden stems are weighted, what the threshold is, how “follow” is decided (Chapters 4 and 5). A program should publish its parameters and report how its verdicts change under another defensible set.
4. Whom does it describe? Volumes 63 and 65 discussed this: being judged accurate is not the same as telling people apart. Whether a reading belongs to its owner must be measured by a blind matching test (Carlson 1985).
An agreement study: measure the engines first
Before asking whether “strong people are such and such”, one should ask a more basic and cheaper question: how far do different engines, or different practitioners, agree on the strength of the same chart? This is a test of reproducibility, not of validity.
Calculation
# Chapter 8. How many charts a concordance study needs.
# A concordance study gives the same charts, blind, to several engines
# or practitioners and measures agreement with Cohen's kappa. It tests
# reproducibility, not validity. With observed agreement p_o and chance
# agreement p_e, the large-sample standard error of kappa is about
# se = sqrt(p_o (1 - p_o) / n) / (1 - p_e),
# so the n needed for a 95 % interval of half-width h follows. The
# planning values come from conventions A and B of p10.
import math
PO, KAPPA = 0.768, 0.553 # A vs B in p10
PE = (PO - KAPPA) / (1 - KAPPA)
def n_for(h, po=PO, pe=PE, z=1.959964):
return math.ceil(z * z * po * (1 - po) / ((1 - pe) ** 2 * h * h))
if __name__ == "__main__":
print(" planning values: p_o {:.3f}, kappa {:.3f}, p_e {:.3f}".format(
PO, KAPPA, PE))
for h in (0.10, 0.05, 0.025):
print(" half-width {:.3f}: {:,d} charts".format(h, n_for(h)))
print("\nReading: a few hundred charts pin kappa down to within 0.1,")
print("about a thousand to within 0.05. Agreement between engines can")
print("be measured cheaply and should be published before any claim")
print("about what a strong or weak chart means.")
# planning values: p_o 0.768, kappa 0.553, p_e 0.481
# half-width 0.100: 255 charts
# half-width 0.050: 1,017 charts
# half-width 0.025: 4,066 charts
#
# Reading: a few hundred charts pin kappa down to within 0.1,
# about a thousand to within 0.05. Agreement between engines can
# be measured cheaply and should be published before any claim
# about what a strong or weak chart means.Taking the results of parameter sets A and B of Chapter 5 as planning values (observed agreement 0.768, κ 0.553, chance agreement 0.481), the large-sample standard error of κ (Fleiss et al. 1969) gives 255 charts for a 95 per cent confidence interval of half-width 0.100, 1,017 charts for half-width 0.050, and 4,066 for 0.025. A few hundred charts suffice to learn whether engines broadly agree. Such a study should be completed and published before any claim about what “strong” or “weak” means.
A pre-registered matching test
Hypothesis · not established
Study protocol. A complete set of chart and reading rules (calendar conventions, conversion to true solar time, hidden-stem weights, strength parameters, the code that writes the readings) is registered publicly before recruitment and not changed afterwards. Following the boundary check of Chapter 3, participants whose reported birth time falls in the flagged zone (error standard deviation 15 minutes, chance of a wrong pillar at least 0.05) are excluded in advance. Each participant sees four readings, unnamed and in random order, one generated from their own chart and three from other participants’ charts, and picks the one that fits best. Primary outcome: the share who pick their own reading; 0.25 if the readings carry no information. Test: one-sided exact binomial test, . The test is carried out by an independent analyst who has no financial relationship with the author and does not know where the readings came from, and the results are published whether positive or negative.
Calculation
# Chapter 8. A pre-registered matching test for four-pillar readings.
# Each participant sees four unlabelled readings, one generated from
# their own chart and three from other participants' charts, and picks
# the one that fits best. Chance hit rate 1/4. Births whose reported
# time lies within the boundary zone of p06 (s.d. 15 minutes, P >= 0.05)
# are excluded in advance, since their hour pillar is uncertain; that
# zone is 0.412 of each double-hour, so recruitment must be larger.
from math import comb
def tail(n, k, p):
return sum(comb(n, i) * p ** i * (1 - p) ** (n - i)
for i in range(k, n + 1))
def plan(p0, p1, alpha=0.05, power=0.90):
for n in range(20, 5000):
k = next(k for k in range(n + 1) if tail(n, k, p0) <= alpha)
if tail(n, k, p1) >= power:
return n, k, tail(n, k, p0)
if __name__ == "__main__":
for p1 in (0.32, 0.35):
n, k, a = plan(0.25, p1)
print(" hit rate {:.2f} against 0.25, one-sided 0.05, power 0.90:"
.format(p1))
print(" {} analysed participants, at least {} hits (exact size"
" {:.4f})".format(n, k, a))
print(" to recruit, allowing for the excluded zone: {}".format(
round(n / (1 - 0.412) + 0.5)))
print("\nReading: a modest effect needs a few hundred analysed")
print("participants; excluding uncertain birth times, as the protocol")
print("must, raises the number to recruit by about seven tenths.")
# hit rate 0.32 against 0.25, one-sided 0.05, power 0.90:
# 359 analysed participants, at least 104 hits (exact size 0.0485)
# to recruit, allowing for the excluded zone: 611
# hit rate 0.35 against 0.25, one-sided 0.05, power 0.90:
# 179 analysed participants, at least 55 hits (exact size 0.0485)
# to recruit, allowing for the excluded zone: 305
#
# Reading: a modest effect needs a few hundred analysed
# participants; excluding uncertain birth times, as the protocol
# must, raises the number to recruit by about seven tenths.Detecting a hit rate of 0.32 against 0.25 with power 0.90 takes 359 analysed participants and at least 104 hits (actual size 0.0485); if the true hit rate were 0.35, 179 would do. Because the flagged zone covers 0.412 of each double-hour, the numbers to recruit after excluding those birth times are about 611 and 305.
Note
What the test tests, and what it does not. It tests whether a reading generated from a person’s chart is more like that person than readings generated from other people’s charts. It does not test the prediction of any event. A negative result would not show that what users feel when reading is unreal; it would show only that the feeling does not depend on whether the reading came from their own chart.
Summary
Before trusting a chart program, ask which calendar conventions it uses, how it handles uncertainty in the birth time, which parameters its judgement uses, and whom it describes. An agreement study measures the disagreement between engines cheaply: 255 charts fix κ to within ±0.100. A pre-registered matching test that excludes birth times near the edges needs 359 analysed participants, about 611 recruited, to detect a hit rate of 0.32 against 0.25.
References
Fan, Y. (2026). Four-Pillar Calendrical Computation and Formal Rule Engines: Julian-Day Sexagenary Cycles, Midnight-Boundary Disagreements, Birth-Time Sensitivity Bounds and Weighted-Graph Strength Scoring [四柱排盘的历法计算与规则引擎] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090180 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).