STEP 1376 — Welch t-test primitive + sample-pair verdict v0.1

STEP 1376 defer (c) 完了 test 65/65 PASS
2026-08-23 · rei-aios · STEP 1358 教材 v0.2 から Welch-t primitive extract、STEP 1371 pipeline 連携

1. 契機

chat-Claude 2026-08-22: 「benchtop-mcp も 同じで、 実機の 測定値には 必ず ノイズが 乗るので、 2 回の 測定が 「違う」 のか 「同じ値の ばらつき」 なのかを 言える機械が 要ります。」

藤本さん directive defer 5 項目 (c) Welch-t 統合 の 実装。 STEP 1358 (Statistics × NEITHER Education v0.2) の JavaScript 実装 (twoSampleTTest + studentTCdf + incompleteBeta + logGamma) を TypeScript primitive として src/mcp/d8-verdict-mapping.ts に extract、 MCP tool d8_verdict_from_sample_pair として wire up。

SAC-4 46 例目: 初稿 STEP 1375 → 別タブ 4 repo public publish arc 同時 claim 判明 → **STEP 1376** に renumber (同日 4 度目 collision、 code 内 4 refs 全一括処理)。

2. 実装内容

2.1 src/mcp/d8-verdict-mapping.ts 追加 export 5

2.2 決定表 (S1-S6、 first-match priority)

#ConditionVerdictReason
S1sample1.length < 2 or sample2.length < 2NEITHER Ninsufficient_sample
S2alpha null/NaN/≤0/≥1NEITHER Nalpha_not_set
S3variance both zero + means equalFALSE ⊥zero_variance_zero_diff
S4variance both zero + means differINFINITY ∞deterministic_difference
S5p < alphaTRUE ⊤significant_effect
S6p ≥ alphaFALSE ⊥no_significant_effect

v0.1 activate: 4/8 値 (TRUE / FALSE / NEITHER / INFINITY)。 BOTH / ZERO / FLOWING / SELF は 予約 (v0.2 で 「有意だが 微小」 = BOTH 活用予定、 Cohen's d threshold 統合)。

2.3 STEP 1350 / 1371 との 相補関係

STEPDomainActivate
1350単一測定 (single sensor)TRUE / NEITHER / ZERO / INFINITY / FLOWING (5/8)
1371多試行 集約 (multi-trial FDR)TRUE / NEITHER / ZERO / FALSE / BOTH (5/8)
1376 (本 STEP)sample-pair (Welch t-test)TRUE / FALSE / NEITHER / INFINITY (4/8)
合計7/8 (SELF のみ 予約)

2.4 pipeline 連携 (STEP 1371 との integration)

複数 pair measurements
    → welchTTest × N
    → {id, pValue} × N
    → mapMultiTrialToD8({trials, fdrQ, alpha})
    → 多試行 FDR 集約 verdict

test [13] で 10 pair-tests → naive=5, fdr=5, verdict=TRUE を 実測 confirm。

3. Verify 実測

3.1 test 65/65 PASS (16 part)

3.2 MCP stdio end-to-end smoke

call: d8_verdict_from_sample_pair(sample1=[1..10], sample2=[11..20], alpha=0.05)
→ verdict = TRUE, reason = significant_effect
→ t = -7.385, df = 18, pValue = 7.5e-7
→ Cohen's d = -3.30 (huge effect)
→ source = 'welch-t-sample-pair-verdict-mapping' ✓
→ honestScope embedded ✓

3.3 Regression + banner

4. Honest scope

  1. 「世界初」 主張ゼロ ([[feedback-world-uniqueness-claim-controllable]])。 Welch 1938 + Satterthwaite 1946 = 80+ 年前既知、 Numerical Recipes 参照実装、 novelty は 「D-FUMT₈ 8 値 verdict layer への mapping + STEP 1350/1371 相補構造 + Rei stack 内 primitive 統合」 のみ
  2. v0.1 = two-sample Welch のみ、 paired t / one-sample / ANOVA / permutation は 別 STEP
  3. Cohen's d 効果量は 計算 + 返却 のみ、 verdict 判定には 未使用 (v0.2 で 「有意だが |d|<0.2 微小」 = BOTH 経路 追加検討)
  4. Student t CDF は Abramowitz-Stegun 26.7.8 approximation、 教育目的で 十分精度、 極端 tail (p<1e-15) では 別 実装検討
  5. 順序原則 operational form: alpha 引数注入強制、 定数化禁止 (pre-registration STEP 1359 rei-preregister 連携候補)
  6. Rei stack MCP 8 systems 数不変 (rei-aios 内 tool 40→41)
  7. defer (c) 完了、 残 (b) discovery-worker Python adapter は STEP 1377 別 arc

5. 関連