5D Library › 计算美学、视觉显著性图谱与人机界面认知工程 · English
第八章 实践与预注册检验
注
本章的核查表与试验方案用于研究与自我检查,不是设计规范、商业或合规建议。 核查表不能告诉你某个页面会带来多少转化,只能帮助你在改动之前把假设写清楚。书中的页面、品牌与数据都是虚构或模拟的。
第一部分 四步核查表
第一至六章可以浓缩为一份四步核查表,用于审视一个界面在改动前后的状况。表中的界限(例如「目标应在模型的前三次注意转移之内」「决策加指向的预算 1,500 毫秒」)是使用者应当事先书面写定的规则的例子,不是推荐的数值。
- 显著性。 用一个显著性模型(第三章)计算页面,任务目标是否出现在前几次注意转移中?同时记住模型不知道任务、不读文字、没有中央偏差(第四章),这一步只能发现明显的问题,例如目标在颜色、强度与方向上都与周围没有差别。
- 可读性。 每一组文字与背景是否达到 WCAG 2.x 的对比度要求(正文 4.5:1、大号文字 3:1)?小字的 x 高在预期的观看距离上是否低于约 0.2 度(第五章)?
- 选择与指向。 按历史或预期的点击分布计算决策的不确定性(海曼熵,第二章),加上到目标的香农式菲茨难度,总时间是否在事先写定的预算之内?对新手,选项数的代价近似线性,不是对数。
- 证据。 任何「改了之后转化提高」的说法,是否来自事先登记、只有一项主要结局、校正了多重比较的检验(第一章)?如果没有,就当作未经检验。
下面的程序把核查表用于一个虚构的着陆页(第三章的版式 B,灰色行动号召按钮,卡片标签为浅灰色)与它的修订版(版式 A,红色按钮,卡片标签加深)。
推导
# The four-step checklist of Chapter 8 applied to the fictional landing page of p06
# (layout B, grey CTA) and a revised version (layout A, red CTA). Limits are examples
# of rules written down BEFORE looking, not recommendations.
# 1 salience: is the task target among the first 3 attended locations of the model?
# 2 legibility: does every text/background pair reach WCAG AA (4.5:1; 3:1 if large)?
# 3 choice and pointing: expert decision (Hick-Hyman over the click distribution) +
# Shannon-Fitts time to the CTA (300 px away, 60 px wide), budget 1,500 ms
# 4 evidence: is a claimed improvement backed by a pre-registered test?
import math, importlib.util, io, contextlib, pathlib, sys
sys.dont_write_bytecode = True
def load(name):
spec = importlib.util.spec_from_file_location(name, pathlib.Path(__file__).with_name(
name + ".py"))
m = importlib.util.module_from_spec(spec)
with contextlib.redirect_stdout(io.StringIO()):
spec.loader.exec_module(m)
return m
p06, p10 = load("p06_itti_koch"), load("p10_wcag_contrast")
to8 = lambda c: tuple(round(255 * v) for v in c)
TEXT = {"headline on page": ((.1, .1, .1), (.97, .97, .97), True),
"body text on page": ((.35, .35, .35), (.97, .97, .97), False),
"nav links on nav bar": ((.55, .55, .58), (.15, .15, .17), False)}
P_CLICK = [0.55, 0.20, 0.10, 0.06, 0.05, 0.04] # CTA, 2nd button, 4 cards
def audit(name, cta, label_on_cta, card_label, claim_preregistered):
print(f"{name}")
S, _ = p06.saliency(p06.page(cta))
first = [p06.label(x, y) for x, y, _ in p06.scanpath(S, k=3)]
ok1 = "CTA button" in first
print(f" 1 salience first 3 model shifts: {', '.join(first)}"
f" -> {'pass' if ok1 else 'FLAG'}")
pairs = dict(TEXT, **{"CTA label on CTA": (label_on_cta, cta, False),
"card labels on cards": (card_label, (.93, .93, .93), False)})
bad = []
for k, (fg, bg, large) in pairs.items():
r = p10.ratio(to8(fg), to8(bg))
if r < (3.0 if large else 4.5):
bad.append(f"{k} {r:.2f}:1")
print(f" 2 legibility {len(pairs) - len(bad)}/{len(pairs)} pairs pass"
+ (f"; FLAG: {'; '.join(bad)}" if bad else " -> pass"))
H = -sum(p * math.log2(p) for p in P_CLICK)
t = 200 + 150 * H + 100 + 150 * math.log2(300 / 60 + 1)
print(f" 3 choice H = {H:.2f} bits; decide + point to CTA {t:.0f} ms"
f" -> {'pass' if t <= 1500 else 'FLAG'}")
print(f" 4 evidence claimed lift pre-registered: "
f"{'yes -> pass' if claim_preregistered else 'no -> FLAG (treat as untested)'}")
if __name__ == "__main__":
audit("fictional page, layout B (grey CTA, light-grey card labels)", (.35, .35, .35),
(.97, .97, .97), (.6, .6, .6), False)
audit("revised page, layout A (red CTA, darker card labels)", (.85, .1, .1),
(1.0, 1.0, 1.0), (.4, .4, .4), False)
print("note: step 1 is a model prediction, not an eye-tracking result; step 4 stays")
print(" flagged until the Chapter 8 trial (or an equivalent test) has been run")
# fictional page, layout B (grey CTA, light-grey card labels)
# 1 salience first 3 model shifts: logo, hero photo, hero photo -> FLAG
# 2 legibility 4/5 pairs pass; FLAG: card labels on cards 2.43:1
# 3 choice H = 1.92 bits; decide + point to CTA 975 ms -> pass
# 4 evidence claimed lift pre-registered: no -> FLAG (treat as untested)
# revised page, layout A (red CTA, darker card labels)
# 1 salience first 3 model shifts: CTA button, logo, CTA button -> pass
# 2 legibility 5/5 pairs pass -> pass
# 3 choice H = 1.92 bits; decide + point to CTA 975 ms -> pass
# 4 evidence claimed lift pre-registered: no -> FLAG (treat as untested)
# note: step 1 is a model prediction, not an eye-tracking result; step 4 stays
# flagged until the Chapter 8 trial (or an equivalent test) has been run原页面在第一步被标记:模型的前三次注意转移是标志、主图、主图,行动号召按钮不在其中。第二步也被标记:五组文字中卡片标签与卡片背景的对比度只有 2.43:1,低于 4.5:1。第三步通过:按设定的点击分布,决策的不确定性为 1.92 比特,决策加指向按钮约 975 毫秒,在 1,500 毫秒的预算之内。第四步被标记:没有任何预注册的检验。修订版在第一、二步通过(按钮成为第一次注意转移,五组文字都达到 4.5:1),第三步不变;第四步仍被标记——核查表通过不等于改动有效。修订是否真的让用户更快完成任务,只能由下面的试验回答。
第二部分 预注册的在线随机对照试验
问题与设计选择
在一组虚构品牌的电商页面上,按本书核查表修订的布局(提高目标的显著性与文字对比度、缩短到目标的菲茨距离)与原布局相比,能否使「找到并正确点击指定目标」的时间缩短,且缩短的幅度至少达到最小关注效应?
作者的框架提出比较「按显著性、对比度与菲茨距离优化的布局」与「对照布局」。本书照写比较组,并作四点设计选择。第一,组间平行设计:每位参与者只看一种版本的页面,因为同一个人看过一种布局后,第二次在另一布局上找同一个目标会受到记忆的影响。第二,只设一项主要结局:选「正确点击的对数完成时间」,而不是「首次点击正确率」。理由是:完成时间是连续变量,在同样的样本量下把握度更高;它直接对应第二至四章模型所预测的量(搜索、决策与指向时间之和);对数变换使右偏的反应时近似正态,组间差可以解释为几何平均时间的比例变化。首次点击正确率作为次要结局,并作为预先规定的限定语:如果优化布局更快但正确率明显更低,结论必须同时写明。第三,协变量调整:每位参与者在看到实验布局之前先做两项中性的练习任务,其对数时间作为协方差分析的协变量,用来吸收个体速度的差异 (Borm et al. 2007)。第四,由独立研究人员实施:页面制作、随机化、数据收集与分析都由与作者企业无关的研究人员完成,作者只提供本书中公开的核查表与修订规则。
方案
| 要素 | 规定 |
|---|---|
| 实施者与招募 | 由独立于作者企业的大学研究团队或研究机构实施;通过与作者无关的在线被试库招募成年人;不从作者的社群、学员、客户或其关联公司的用户中招募,报名时以问卷排除 |
| 材料 | 12 个虚构品牌的电商页面(不使用任何真实品牌、商标或作者企业的页面);每页一个指定目标(如「把这件商品加入购物车」「打开退货政策」);两种版本:X = 按第一部分核查表修订(显著性、对比度、菲茨距离),Y = 原布局;两种版本的文字内容与目标标签完全相同;全部页面、任务与修订规则在登记时公开 |
| 设备 | 只限桌面浏览器(窗口宽度至少 1,280 像素);移动设备的结论需要另一项试验 |
| 随机化与分层 | 由被试平台按 1:1 随机分配到 X 或 Y,按年龄段(40 岁以下 / 40 岁及以上)分层,区组大小随机(4 或 6);分配序列由与分析无关的人员生成并封存 |
| 设盲 | 参与者被告知这是一项「网站可用性研究」,不知道有两种版本,也不知道研究假设;分析人员在结果锁定前只看到编码为「甲 / 乙」的组别 |
| 主要结局 | 每位参与者在 12 项任务上 (从页面出现到正确点击目标的秒数)的均值;60 秒内未完成的任务记为 60 秒;用协方差分析比较 X − Y,以两项练习任务的对数时间均值为协变量,报告差值及其 95% 置信区间 |
| 最小关注效应 | 几何平均完成时间缩短 10%,即 |
| 预先规定的限定语 | X 组的首次点击正确率是否比 Y 组低 3 个百分点以上;若是,结论后附写明 |
| 次要结局 | 首次点击正确率;60 秒内完成率;误点次数;系统可用性量表(SUS)得分 (Brooke 1996);均为描述性或探索性分析,不改变主要结论 |
防止数据窥探
只有一项主要结局与一个预先固定的分析模型;页面、修订规则、随机化方案、排除标准与分析代码在招募之前公开登记,代码的哈希值随方案一起登记 (Nosek et al. 2018);不做中期分析,不根据数据调整排除标准;次要与探索性结果明确标注,不能用来替代主要结论。第 33 本讨论过这些做法的统计原理。
样本量
样本量需要对效应与方差作出假设。这里没有可以直接借用的先行研究,所以下列数值都是规划假设,在编辑说明中请作者确认:对数完成时间的个体间标准差 0.30,个体内(任务间)标准差 0.50,控制组每项任务的几何平均时间 8 秒,练习任务与主要结局的相关系数取 0.5。由此,12 项任务均值的标准差为 。正态近似下,每组所需的可分析人数为
其中 是协方差分析相对于简单 检验的方差缩减 (Borm et al. 2007)。
推导
# Sample size for the Chapter 8 pre-registered online trial. Two parallel arms, 1:1:
# X = layouts revised by the checklist (salience, contrast, Fitts distance), Y = control
# layouts; 12 find-and-click tasks on fictional shop pages. Single primary outcome: each
# participant's mean of ln(time to the correct click, s), a task not completed within
# 60 s counted as 60 s; analysed by ANCOVA on the mean ln time of 2 neutral practice
# tasks done before the layouts differ. SESOI: 10 % shorter geometric-mean time,
# delta = ln 0.90. PLANNING ASSUMPTIONS (not estimates from data): between-person sd of
# ln time 0.30, within-person task sd 0.50, practice-outcome correlation 0.5.
import math, random, statistics
Z = statistics.NormalDist().inv_cdf
DELTA, SB, SW, RHO, K = math.log(0.90), 0.30, 0.50, 0.5, 12
MU = math.log(8.0) # control geometric mean 8 s per task
def n_arm(delta, sd, rho, power=0.90, alpha=0.05):
return math.ceil(2 * (Z(1 - alpha / 2) + Z(power)) ** 2 * sd ** 2 * (1 - rho ** 2)
/ delta ** 2)
def participant(rng, arm):
b = rng.gauss(0, SB) # person effect
pr = statistics.fmean(MU + b + rng.gauss(0, SW) for _ in range(2))
shift = DELTA if arm else 0.0
y = statistics.fmean(min(MU + b + shift + rng.gauss(0, SW), math.log(60.0))
for _ in range(K))
return pr, y
def ancova_t(rows):
x = [r[1] for r in rows]; g = [r[0] for r in rows]; y = [r[2] for r in rows]
n = len(y); mx, mg, my = statistics.fmean(x), statistics.fmean(g), statistics.fmean(y)
sxx = sum((a - mx) ** 2 for a in x); sgg = sum((a - mg) ** 2 for a in g)
sxg = sum((a - mx) * (b - mg) for a, b in zip(x, g))
sxy = sum((a - mx) * (c - my) for a, c in zip(x, y))
sgy = sum((b - mg) * (c - my) for b, c in zip(g, y))
det = sxx * sgg - sxg ** 2
bx = (sgg * sxy - sxg * sgy) / det; bg = (sxx * sgy - sxg * sxy) / det
res = [c - my - bx * (a - mx) - bg * (b - mg) for a, b, c in zip(x, g, y)]
s2 = sum(r * r for r in res) / (n - 3)
return bg, math.sqrt(s2 * sxx / det)
if __name__ == "__main__":
sd = math.sqrt(SB ** 2 + SW ** 2 / K)
r_pr = SB ** 2 / math.sqrt((SB ** 2 + SW ** 2 / 2) * (SB ** 2 + SW ** 2 / K))
print(f"assumed sd of the outcome {sd:.3f}; implied practice correlation {r_pr:.2f}"
f" (planning value {RHO})")
n0 = n_arm(DELTA, sd, 0.0); n1 = n_arm(DELTA, sd, RHO)
print(f"normal approximation, 90 % power, two-sided alpha 0.05, delta = ln 0.90"
f" = {DELTA:.4f}:\n t-test {n0} per arm; ANCOVA (rho {RHO}) {n1} per arm")
rng = random.Random(46); hits = 0; sims = 300; est = []
for _ in range(sims):
rows = [(arm,) + participant(rng, arm) for arm in (0, 1) for _ in range(n1)]
b, se = ancova_t(rows); est.append(b)
hits += b + 1.96 * se < 0 # CI excludes 0 on the faster side
print(f"simulation check ({sims} trials of {n1} per arm, lognormal tasks, 60 s cap):"
f"\n power {hits / sims:.3f}; mean estimate {statistics.fmean(est):+.4f}")
rec = math.ceil(n1 / 0.85 / 10) * 10
print(f"allowing 15 % exclusion/attrition: recruit {rec} per arm, {2 * rec} in total")
print("sensitivity (per arm, ANCOVA): SESOI 5 % 10 % 15 %")
for lab, s_, r_ in (("planning values", sd, RHO), ("sd 30 % higher", 1.3 * sd, RHO),
("no usable covariate", sd, 0.0)):
row = [n_arm(math.log(1 - e), s_, r_) for e in (0.05, 0.10, 0.15)]
print(f" {lab:32s}" + "".join(f"{v:8,d}" for v in row))
# assumed sd of the outcome 0.333; implied practice correlation 0.58 (planning value 0.5)
# normal approximation, 90 % power, two-sided alpha 0.05, delta = ln 0.90 = -0.1054:
# t-test 210 per arm; ANCOVA (rho 0.5) 158 per arm
# simulation check (300 trials of 158 per arm, lognormal tasks, 60 s cap):
# power 0.930; mean estimate -0.1055
# allowing 15 % exclusion/attrition: recruit 190 per arm, 380 in total
# sensitivity (per arm, ANCOVA): SESOI 5 % 10 % 15 %
# planning values 664 158 67
# sd 30 % higher 1,123 266 112
# no usable covariate 886 210 89不用协变量的 检验需要每组 210 人;用相关系数 0.5 的协变量,每组 158 人。在上述方差结构下,练习任务与主要结局的相关实际为 0.58,高于规划值 0.5,所以按 0.5 计算是保守的;模拟(300 次试验、每组 158 人、对数正态任务时间、60 秒封顶)得到的把握度为 0.930,效应估计的均值为 −0.1055,与真值 −0.1054 一致。考虑 15% 的排除与脱落,每组招募 190 人,共 380 人。敏感性表显示:若最小关注效应取 5%,每组需要 664 人;若标准差比假设高 30%,需要 266 人;若练习任务完全没有预测作用,需要 210 人。图 5 画出了把握度随每组人数的变化。
按第 33 本的结果,「90% 把握度」指的是在真实效应恰好等于最小关注效应时,得出「X 更快」(置信区间上限小于 0)这类结论的概率约为 90%;在这种情况下,最强的结论「至少快出最小关注效应」(上限不高于 )只有约 2.5% 的机会出现。
判定规则
推导
# Decision rule, fixed before unblinding. Primary outcome: ANCOVA difference X - Y in
# mean ln(time to correct click), adjusted for practice-task ln time; 95 % CI.
# SESOI = ln 0.90 = -0.105 (10 % shorter geometric-mean time). Negative = X faster.
# "No difference worth acting on": CI inside +-0.105 on the log scale, i.e. a time
# ratio between 0.90 and 1/0.90 = 1.111 (-10 % to +11.1 %).
# Gates, checked first: analysable participants below 300 of the 316 planned; arm
# attrition differing by more than 5 points; any page served from the wrong arm on more
# than 1 % of sessions; the analysis code differing from the registered hash
# -> NOT INTERPRETABLE. Pre-specified qualifier (secondary): first-click accuracy lower
# in X by more than 3 percentage points.
import math
SESOI = math.log(0.90)
def verdict(d, lo, hi, n=316, attr_gap=0.01, wrong=0.0, code_ok=True, acc_gap=0.0):
for bad, why in ((n < 300, f"only {n} analysable (minimum 300)"),
(attr_gap > 0.05,
f"attrition differs by {100 * attr_gap:.0f} points"),
(wrong > 0.01, f"{wrong:.1%} of sessions served the wrong arm"),
(not code_ok, "analysis code differs from the registered hash")):
if bad:
return f"d = {d:+.3f}: NOT INTERPRETABLE - {why}"
if hi <= SESOI: v = "X faster by at least the SESOI (10 %)"
elif hi < 0: v = "X faster; not shown to reach the SESOI"
elif lo > 0: v = "X slower than control"
elif lo >= SESOI and hi <= -SESOI: v = "no difference worth acting on (-10 %/+11 %)"
else: v = "unclear: the interval is too wide to decide"
if acc_gap > 0.03:
v += f"\n qualifier: 1st-click accuracy {100 * acc_gap:.0f} points lower in X"
return f"d = {d:+.3f} ({lo:+.3f} to {hi:+.3f}), time {math.exp(d) - 1:+.0%}: {v}"
for case in ((-0.180, -0.250, -0.110, 316), (-0.090, -0.160, -0.020, 316),
(-0.010, -0.080, 0.060, 316), (0.080, 0.010, 0.150, 316),
(-0.060, -0.200, 0.080, 316),
(-0.200, -0.270, -0.130, 316, .01, 0, True, .05),
(-0.200, -0.270, -0.130, 281), (-0.200, -0.270, -0.130, 316, 0.08)):
print(verdict(*case))
print("secondary outcomes (first-click accuracy, completion within 60 s, misclicks,")
print(" SUS score) are reported with intervals; they never decide the verdict")
# d = -0.180 (-0.250 to -0.110), time -16%: X faster by at least the SESOI (10 %)
# d = -0.090 (-0.160 to -0.020), time -9%: X faster; not shown to reach the SESOI
# d = -0.010 (-0.080 to +0.060), time -1%: no difference worth acting on (-10 %/+11 %)
# d = +0.080 (+0.010 to +0.150), time +8%: X slower than control
# d = -0.060 (-0.200 to +0.080), time -6%: unclear: the interval is too wide to decide
# d = -0.200 (-0.270 to -0.130), time -18%: X faster by at least the SESOI (10 %)
# qualifier: 1st-click accuracy 5 points lower in X
# d = -0.200: NOT INTERPRETABLE - only 281 analysable (minimum 300)
# d = -0.200: NOT INTERPRETABLE - attrition differs by 8 points
# secondary outcomes (first-click accuracy, completion within 60 s, misclicks,
# SUS score) are reported with intervals; they never decide the verdict示例结果是编造的。前置条件中任何一项不满足(可分析人数少于 300、两组脱落率相差超过 5 个百分点、超过 1% 的会话加载了错误组别的页面、分析代码与登记的哈希值不一致),无论主要结局如何,报告都写「不可解释」。置信区间上限不高于 时写「X 至少快出最小关注效应」;上限低于 0 但高于 时写「X 更快,但幅度未确定」;下限高于 0 时写「X 比对照慢」;区间落在 之内(换成时间比为 0.90 到 1.111,即 −10% 到 +11.1%)时写「没有值得据此改变做法的差别」;其余情形写「无法判断」。限定语不改变结论的类别,只是附在后面:例如第六个示例中,X 的完成时间短 18%,但首次点击正确率低 5 个百分点,报告必须同时写明这一点。
这项试验不能说明什么
第一,它比较的是一组修订(显著性、对比度与菲茨距离同时改变),不能把效应分配给其中任何一项;要分开,需要析因设计。第二,主要结局是找到并点击目标的时间,不是购买、注册或任何商业结局;更快地找到按钮不等于更多人愿意购买。第三,任务是指定的,参与者知道要找什么;自由浏览时的注意分布可能不同(第四章)。第四,结论只适用于桌面浏览器、这 12 个虚构页面与在线被试库的人群,不能直接推及移动设备、真实品牌或特定市场。第五,它不检验伊蒂—科赫模型的预测是否与注视一致(那需要眼动记录),也不检验黄金比、三次点击或任何美学度量。第六,规划假设(标准差、相关系数)来自作者的估计,不是先行数据;若真实方差更大,把握度会低于 90%,这正是敏感性表的用途。第七,如果试验得到「没有值得据此改变做法的差别」,那就是这项试验的结论,本书的核查表应据此修订。
伦理与利益冲突
这项试验涉及人类参与者,须由实施机构的伦理委员会审批。风险极低:参与者只在虚构页面上完成找按钮的任务,约 15 分钟;报酬按被试库的标准支付;只收集年龄段、设备类型与任务数据,不收集姓名、联系方式或任何可识别个人身份的信息;参与者可随时退出而不受任何影响。方案、页面、代码与去标识的数据都将公开;无论结果是正是负,都将发表。为限制利益的影响:作者不参与招募、数据收集与分析,不接触分配序列,试验不使用作者企业或其客户的任何页面或数据。
利益披露
作者以 5D Library 的著作(包括本书)作为其社群课程、升维牌卡(5D Ascension Cards,Dimensional Shift Card Decks)与 Yafu AI 知识库的方法论基础,因此与本书主题有商业利益关系。本书不推销任何课程、牌卡或服务;第八章的试验设计为由独立于作者企业的研究人员实施和分析,不从作者的社群、学员或客户中招募;书中所有代码与研究方案均公开,供任何人检验。作者创办并经营 Asia Influencer X 与 Yafu Global,从事网红营销、直播电商、数字营销与网站设计建设,工作中涉及本书讨论的界面设计与转化问题,因此与本书主题有直接商业利益;本书不使用这两家公司或其客户的数据作为证据,也不推销其服务。
本章小结
四步核查表从显著性、可读性、选择与指向、证据四个方面审视一个界面;示例显示,修订可以让前三步都通过,但第四步在检验之前始终被标记。预注册的在线随机对照试验由独立研究人员实施,在 12 个虚构品牌的页面上比较按核查表修订的布局与原布局,唯一主要结局为正确点击的对数完成时间(协方差分析),最小关注效应为几何平均时间缩短 10%,90% 把握度下每组 158 名可分析、招募 190 名,判定规则写成代码,并预先规定了「正确率较低」的限定语;无论结果如何都发表。它只检验一组修订在一种任务与设备上的效果,不能证明本书的其他模型,也不能直接推及转化或销售。
参考文献
Fan, Y. (2026). Computational Aesthetics, Visual Saliency Maps and Cognitive Ergonomics in User Interface Design: From the Hick–Hyman Law and Spatial Frequency Channels to Saccadic Trajectory Modelling, Read Beside the Kaogongji and Classical Treatise on Architectural Methods [计算美学、视觉显著性图谱与人机界面认知工程] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23836258 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).