adjust-for-multiple-comparisons
Use when many metrics or slices are tested at once. Applies a multiplicity correction before calling any one of them significant.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- adjust-for-multiple-comparisons
- description
- Use when many metrics or slices are tested at once. Applies a multiplicity correction before calling any one of them significant.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md357 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Adjust for Multiple Comparisons
Test 20 metrics at alpha 0.05 and about one will look significant by chance. If you did not bound the family of tests in advance, the headline is a coin flip wearing a lab coat.
Procedure
- Count the hypotheses actually tested: primary, secondary, and every slice a human will look at.
- Pre-define the family, then apply a correction. Benjamini-Hochberg for exploration (control the false discovery rate), Bonferroni for confirmation (control the family-wise error):
from statsmodels.stats.multitest import multipletests p = [0.031, 0.008, 0.21, 0.044, 0.002, 0.12] # six metrics rej, padj, _, _ = multipletests(p, alpha=0.05, method='fdr_bh') print(list(zip(p, [round(x,4) for x in padj], rej))) - Report adjusted p-values (or q-values) in the table, and mark which passed after correction.
- Use Bonferroni when one false positive is costly and the family is small; use FDR when scanning many metrics to prioritise.
- Correlated metrics (clicks and CTR) are not independent tests; note this when interpreting a corrected result.
- Never add a slice to the confirmatory family after seeing it move; that slice belongs in exploratory.
Pitfalls
- Guardrail metrics are tests too; a set of ten guardrails needs the same correction.
- Picking the one significant segment out of twelve and reporting it as the finding is the failure this prevents.
- Bonferroni on a large scanning family is too conservative and hides real signals; match the method to the intent.
- Correcting only the printed metrics while silently checking dozens more does not fix the multiplicity.
- FDR controls the expected proportion of false discoveries, not the chance of any — say which guarantee you are giving.
- Pre-specify the correction before results are seen; choosing Bonferroni or FDR afterwards is another degree of freedom.
- Reusing one control against several arms in an A/B/n test is multiplicity too — split alpha across the comparisons.
Verification
python3 -c "from statsmodels.stats.multitest import multipletests as m; r=m([.01,.02,.03,.2,.4],method='fdr_bh'); print(r[0], r[1].round(3))"
Report: "31 metrics tested; after BH-FDR at 0.05, 2 remain significant (primary q=0.004, latency guardrail q=0.031). The other 29, including two raw p<0.05 slice wins, are exploratory."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.