# 随机化检验

随机化检验是一种统计显著性检验，它通过反复随机地重新分配处理标签或分组标签、并对每一次重新分配计算检验统计量，来评价所观测到的处理效应。它给出的p值，就是所产生的统计量与观测值一样极端或更为极端的重新分配所占的比例。<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)</sup> 由于这一零分布是由实际执行的随机化产生的，因此在指定的随机化机制与一个恰当的零假设（通常是费希尔严格零假设）之下，该检验无需分布假设，即具有有限样本下有效的第一类错误控制；其拒绝概率至多为名义水平，而在每个名义水平上都取等号，一般需要以随机方式处理并列值。<sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> 从概念上说，打乱标签所模拟的是一个假随机实验：其中每个单元无论接受何种处理，都会给出相同的响应。<sup>[3](https://openintrostat.github.io/ims/foundations-randomization)</sup>

| 关键事实 | 细节 |
|---|---|
| 输出 | 一个p值：在随机重新分配的标签下，观测统计量的尾部概率；最小可达值为 \( 1/N_{\mathrm{randomizations}} \) <sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)</sup> |
| 精确性 | 无需分布假设的精确有限样本第一类错误控制 <sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> |
| 起源 | 由R. A. 费希尔在《实验设计》（1935）第2章中提出 <sup>[4](https://doi.org/10.2307/2277749)</sup> |
| 典型例子 | 费希尔的品茶女士实验：8杯茶共有70种可能的分法，零假设下成功概率为1/70 <sup>[5](https://www.jhanley.biostat.mcgill.ca/c607/ch06/lady_tasting_tea.pdf)</sup> |
| 蒙特卡洛规则 | 为保证精确性，p值按 \( (B + 1)/(w + 1) \) 计算，而非 \( B/w \) <sup>[6](https://link.springer.com/content/pdf/10.1007/s11749-017-0571-1.pdf)</sup> |
| 精度 | 在多数情况下，一百万次重抽样可使p值精确到小数点后三位 <sup>[7](https://journals.sagepub.com/doi/10.2466/pms.105.3.915-920)</sup> |
| 区别 | 随机化检验立足于随机化的物理行为；置换检验与自助检验则立足于随机抽样模型 <sup>[8](https://www.niss.org/sites/default/files/randomization_tests_olkin_seminar_wr.pdf)</sup> |

## 运作原理

该检验建立在费希尔严格零假设之上，这一假设断言每个单元的结果在每一种处理分配下都相同，形式上即对所有单元 <i>i</i> 都有 \( Y_i(0) = Y_i(1) \)。<sup>[9](https://www.statslab.cam.ac.uk/~qz280/teaching/siscer-2025/L1.pdf)</sup> 在这一零假设下，每一个潜在结果都可以由观测结果填补出来，因此任何其他分配本会产生的结果的完整表格都是已知的。于是p值就是：在反复抽取分配的情况下，统计量至少与观测值一样极端的概率：\( P = \Pr(T(A^{*}, Y(A^{*})) \geq T(A, Y(A)) \mid Z, Y(\cdot)) \)，其中 \( A^{*} \) 是分配的一个独立副本；在存在并列值的情况下，只计入严格更大的值是不成立的。<sup>[9](https://www.statslab.cam.ac.uk/~qz280/teaching/siscer-2025/L1.pdf)</sup>

更一般地，只要随机化假设得到满足，精确性就成立：数据的分布在某个有限变换群下不变。<sup>[10](https://arxiv.org/abs/2406.09521)</sup> 霍夫丁（Hoeffding，1952）的一个定理指出，若该假设成立，则水平为 \( \alpha \) 的检验对零假设类中的一切分布都满足 \( E_P[\varphi(X)] = \alpha \)，从而给出精确的有限样本第一类错误控制。<sup>[10](https://arxiv.org/abs/2406.09521)</sup> 费希尔本人的论证是：随机化这一简单的预防措施，保证了显著性检验的有效性，而不论存在何种干扰因素。<sup>[5](https://www.jhanley.biostat.mcgill.ca/c607/ch06/lady_tasting_tea.pdf)</sup>

## 操作步骤

实践者的步骤是：（1）选定一个检验统计量，例如均值差、t统计量或秩统计量；（2）构造参照分布，即对每一种可能的重新分配（或其中一个大的随机样本）计算该统计量；（3）计算尾部概率，即参照值中至少与观测值一样极端的比例。<sup>[11](https://www.uvm.edu/~statdhtx/StatPages/R/RandomizationTestsWithR/Anderson%202001%20Permutation%20tests%20for%20univariate%20or%20multivariate%20analysis%20of%20variance%20and%20r_files/10535432.pdf)</sup> 对于有 \( k \) 个带标签的组、每组 \( n \) 次重复的单因素设计，不同重新分配的数目为 \( (kn)!/(n!)^{k} \)，这一数目增长极快，因此通常改用重新分配的一个大的随机子集。<sup>[11](https://www.uvm.edu/~statdhtx/StatPages/R/RandomizationTestsWithR/Anderson%202001%20Permutation%20tests%20for%20univariate%20or%20multivariate%20analysis%20of%20variance%20and%20r_files/10535432.pdf)</sup>

在抽样重新分配时，观测到的分配必须包含在参照集之中；不把它包含在内而估计p值，就不再是完全有效的检验。<sup>[12](https://lirias.kuleuven.be/retrieve/478463)</sup> 把它包含在内时，p值按 \( (B+1)/(w+1) \) 计算，其中 \( B \) 计的是统计量至少同样极端的抽样重新分配的个数，\( w \) 是抽样的总数；朴素估计 \( B/w \) 可能为零，且偏于反保守，若再作邦费罗尼校正，就可能得出完全错误的推断。<sup>[6](https://link.springer.com/content/pdf/10.1007/s11749-017-0571-1.pdf)</sup> 重新分配次数很少时，例如25到100次，会造成明显的反保守性。<sup>[6](https://link.springer.com/content/pdf/10.1007/s11749-017-0571-1.pdf)</sup>

## 起源

随机化检验由R. A. 费希尔在其《实验设计》（1935）一书中提出；所引的《美国统计协会杂志》条目是哈罗德·霍特林（Harold Hotelling）对该书的书评 <sup>[4](https://doi.org/10.2307/2277749)</sup>。费希尔通过品茶女士实验引入这一检验，提议在正态性不成立时用它替代斯图登t检验。<sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> E. J. G. 皮特曼（E. J. G. Pitman）于1937年把显著性检验推广到来自任意总体的样本 <sup>[13](https://doi.org/10.2307/2984124)</sup>；B. L. 韦尔奇（B. L. Welch）1937年关于随机区组与拉丁方中z检验的论文，用潜在结果阐明：该检验适用于费希尔的严格零假设，而非奈曼关于平均处理效应的零假设。<sup>[14](https://doi.org/10.1093/biomet/29.1-2.21)</sup><sup> • </sup><sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> 更为数学化的处理由瓦西里·霍夫丁（Wassily Hoeffding）确立，他1952年发表于《数理统计年刊》的论文分析了基于置换的检验的大样本功效。<sup>[10](https://arxiv.org/abs/2406.09521)</sup><sup> • </sup><sup>[15](https://doi.org/10.1214/aoms/1177729436)</sup> 迈耶·德瓦斯（Meyer Dwass）于1957年提出抽样随机置换以代替穷举。<sup>[16](https://doi.org/10.1214/aoms/1177707045)</sup>

## 变体

**统计量的选择。** 任何统计量都能给出有效且精确的p值，但功效不同；回归模型或机器学习算法也可以充当统计量。<sup>[17](https://imai.fas.harvard.edu/teaching/files/permutation_test.pdf)</sup> 当方差不同时，样本均值的原始差即使在渐近意义下也可能无法控制第一类错误；一个在零假设下渐近枢轴的统计量，例如学生化统计量，可以在弱零假设下恢复渐近有效性，而在严格零假设与指定的分配机制下，有限样本精确性仍然成立。<sup>[10](https://arxiv.org/abs/2406.09521)</sup> 阿诺德·扬森（Arnold Janssen）为非独立同分布情形与广义贝伦斯-费希尔问题发展了学生化置换检验。<sup>[18](https://doi.org/10.1016/s0167-7152%2897%2900043-6)</sup> 基于秩的选择包括威尔科克森（曼-惠特尼）统计量；基于两样本柯尔莫哥洛夫-斯米尔诺夫统计量的全能检验是精确的，且对任何分布差异都相合。<sup>[10](https://arxiv.org/abs/2406.09521)</sup>

**与置换检验、自助检验的关系。** 随机化检验立足于实验随机化，而置换检验立足于随机抽样与可交换性；随机化检验的有效性并不依赖可交换性假设。<sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> 置换检验从根本上要求一个代数群结构，这正是品茶女士实验属于随机化检验而非置换检验的原因。<sup>[19](https://ideas.repec.org/a/bla/istatr/v89y2021i2p367-381.html)</sup> 在简单两组的实验中，于严格零假设之下，两种步骤在数值上一致。<sup>[20](https://ar5iv.labs.arxiv.org/html/1809.07419)</sup> 用随机化检验，第一类错误率完全受控；而自助检验只在某些设计的某些统计量下、且样本较大时才控制得住。<sup>[12](https://lirias.kuleuven.be/retrieve/478463)</sup> 张与赵（Zhang and Zhao）为基于理论模型而非随机化的物理行为的显著性检验，引入了“准随机化检验”这一术语。<sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup>

**扩展。** 条件随机化检验通过以精心构造的分配事件为条件，把该方法推广到部分严格零假设，例如单元之间的干扰 <sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup>；近来的应用遍及基因组学、条件独立性检验、共形推断以及带干扰的因果推断。<sup>[2](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)</sup> 拜恩德与鲁宾（Bind and Rubin）建议尽可能报告费希尔精确P值，并展示其背后的零假设下的随机化分布。<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)</sup>

## 应用

在随机试验中，指导原则是“怎么随机化就怎么分析”：分析必须与随机化方案相匹配；在整群随机试验中，必须以整群为分析单元，以避免第一类错误严重膨胀。<sup>[21](https://onlinelibrary.wiley.com/doi/10.1002/9781118596333.ch31)</sup> 托马斯·M·布劳恩（Thomas M. Braun）与冯子丁（Ziding Feng）为群随机试验发展了最优置换检验。<sup>[22](https://doi.org/10.1198/016214501753382336)</sup> 对于二分类响应的2 × 2表，置换检验就是费希尔精确检验，可在SAS PROC FREQ等标准软件中获得。<sup>[21](https://onlinelibrary.wiley.com/doi/10.1002/9781118596333.ch31)</sup>

在多因素方差分析中，对任一项的精确检验，是通过置换由F比的分母均方所识别出的可交换单元来实现的，置换被限制在阶数更小或相等的各项的水平之内 <sup>[23](https://www.uvm.edu/%7Estatdhtx/StatPages/R/RandomizationTestsWithR/andersonTerBrack.pdf)</sup>；对于复杂设计，近似做法是置换简化模型下的残差、全模型下的残差，或原始数据。<sup>[23](https://www.uvm.edu/%7Estatdhtx/StatPages/R/RandomizationTestsWithR/andersonTerBrack.pdf)</sup> 通过模型残差进行协变量调整，其有效性并不取决于回归模型是否正确，这一做法最早由盖尔、谭与皮安塔多西（Gail, Tan, and Piantadosi）描述。<sup>[8](https://www.niss.org/sites/default/files/randomization_tests_olkin_seminar_wr.pdf)</sup><sup> • </sup><sup>[24](https://doi.org/10.1093/biomet/75.1.57)</sup> 单变量与多变量方差分析及回归的置换策略由马蒂·J·安德森（Marti J. Anderson）加以形式化。<sup>[11](https://www.uvm.edu/~statdhtx/StatPages/R/RandomizationTestsWithR/Anderson%202001%20Permutation%20tests%20for%20univariate%20or%20multivariate%20analysis%20of%20variance%20and%20r_files/10535432.pdf)</sup> 在非随机化研究中，可以通过重建一个看似合理的假想随机化机制（例如借助倾向得分模型）并配合敏感性分析，来计算费希尔精确P值。<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)</sup>

## 局限与替代方法

该检验只在能够确定所有缺失潜在结果的严格零假设下才是有限样本精确的；检验弱零假设，例如平均处理效应为零，则需要填补与合适的统计量。<sup>[20](https://ar5iv.labs.arxiv.org/html/1809.07419)</sup> 奈曼-费希尔之争所关切的，是该检验在随机区组与拉丁方设计中对弱零假设的失效，盖尔等（1996）与林等（2017）提供了模拟证据。<sup>[20](https://ar5iv.labs.arxiv.org/html/1809.07419)</sup> 随机化假设本身只覆盖有限的一类问题 <sup>[10](https://arxiv.org/abs/2406.09521)</sup>，而基于t统计量的检验对误差方差的差异很敏感。<sup>[11](https://www.uvm.edu/~statdhtx/StatPages/R/RandomizationTestsWithR/Anderson%202001%20Permutation%20tests%20for%20univariate%20or%20multivariate%20analysis%20of%20variance%20and%20r_files/10535432.pdf)</sup> 在观测数据中，有效性依赖于可交换性假设——这一假设本是由物理随机化提供的——因此混杂是主要的威胁。<sup>[9](https://www.statslab.cam.ac.uk/~qz280/teaching/siscer-2025/L1.pdf)</sup><sup> • </sup><sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)</sup> 对于每组30至40名受试者的连续响应，正态理论检验作为近似已相当够用 <sup>[21](https://onlinelibrary.wiley.com/doi/10.1002/9781118596333.ch31)</sup>；当可加处理模型成立且响应不太偏离正态时，t分布能很好地近似t统计量的随机化分布。<sup>[25](http://stat511.cwick.co.nz/lectures/10-randomization-test.pdf)</sup>

## References

1. [When possible, report a Fisher-exact P value and display its underlying null randomization distribution (Bind et al., PNAS 2020)](https://pmc.ncbi.nlm.nih.gov/articles/PMC7431075/)
2. [Zhang & Zhao, 'What is a Randomization Test?', Journal of the American Statistical Association (2023), publisher/DOI version (merges arXiv 2203.10980v2 copy)](https://www.tandfonline.com/doi/pdf/10.1080/01621459.2023.2199814)
3. [Hypothesis testing with randomization, Introduction to Modern Statistics (2e)](https://openintrostat.github.io/ims/foundations-randomization)
4. [Harold Hotelling, R. A. Fisher (1935). The Design of Experiments.. Journal of the American Statistical Association.](https://doi.org/10.2307/2277749)
5. [R. A. Fisher, The Design of Experiments (Chapter 2, 'The Lady Tasting Tea' excerpt)](https://www.jhanley.biostat.mcgill.ca/c607/ch06/lady_tasting_tea.pdf)
6. [Hemerik & Goeman, 'Exact testing with random permutations' (Test, 2018; merges PMC6405018 copy)](https://link.springer.com/content/pdf/10.1007/s11749-017-0571-1.pdf)
7. [Permutation Tests: Precision in Estimating Probability Values (Johnston, Berry & Mielke, 2007, Perceptual and Motor Skills)](https://journals.sagepub.com/doi/10.2466/pms.105.3.915-920)
8. [Randomization Tests: The Forgotten Component of the Randomized Clinical Trial (Rosenberger, NISS seminar)](https://www.niss.org/sites/default/files/randomization_tests_olkin_seminar_wr.pdf)
9. [SISCER Module 13 Lecture 1: Randomization inference (Zhao, Cambridge, 2025)](https://www.statslab.cam.ac.uk/~qz280/teaching/siscer-2025/L1.pdf)
10. [Ritzwoller, Romano & Shaikh, 'Randomization Inference: Theory and Applications' (2024, rev. 2025), merges author-hosted and arXiv-html copies](https://arxiv.org/abs/2406.09521)
11. [Permutation tests for univariate or multivariate analysis of variance and regression (Anderson 2001, Canadian Journal of Fisheries and Aquatic Sciences)](https://www.uvm.edu/~statdhtx/StatPages/R/RandomizationTestsWithR/Anderson%202001%20Permutation%20tests%20for%20univariate%20or%20multivariate%20analysis%20of%20variance%20and%20r_files/10535432.pdf)
12. [The Difference Between Randomization Tests and Permutation Tests (Onghena, KU Leuven repository)](https://lirias.kuleuven.be/retrieve/478463)
13. [E. J. G. Pitman (1937). Significance Tests Which May be Applied to Samples from Any Populations. Journal of the Royal Statistical Society Series B (Statistical Methodology).](https://doi.org/10.2307/2984124)
14. [B. L. WELCH (1937). ON THE z-TEST IN RANDOMIZED BLOCKS AND LATIN SQUARES. Biometrika.](https://doi.org/10.1093/biomet/29.1-2.21)
15. [Wassily Hoeffding (1952). The Large-Sample Power of Tests Based on Permutations of Observations. The Annals of Mathematical Statistics.](https://doi.org/10.1214/aoms/1177729436)
16. [Meyer Dwass (1957). Modified Randomization Tests for Nonparametric Hypotheses. The Annals of Mathematical Statistics.](https://doi.org/10.1214/aoms/1177707045)
17. [Permutation Test (Kosuke Imai, Harvard lecture notes, Spring 2021)](https://imai.fas.harvard.edu/teaching/files/permutation_test.pdf)
18. [Studentized permutation tests for non-i.i.d. hypotheses and the generalized Behrens-Fisher problem (Statistics & Probability Letters, 1997)](https://doi.org/10.1016/s0167-7152%2897%2900043-6)
19. [Hemerik & Goeman, 'Another Look at the Lady Tasting Tea and Differences Between Permutation Tests and Randomisation Tests', International Statistical Review 89(2), 2021](https://ideas.repec.org/a/bla/istatr/v89y2021i2p367-381.html)
20. [Randomization Tests for Weak Null Hypotheses in Randomized Experiments (arXiv 1809.07419; published in JASA)](https://ar5iv.labs.arxiv.org/html/1809.07419)
21. [Permutation Tests in Clinical Trials (Zucker, in Methods and Applications of Statistics in Clinical Trials, Vol. 2, Wiley 2014; merges author copy)](https://onlinelibrary.wiley.com/doi/10.1002/9781118596333.ch31)
22. [Thomas M Braun, Ziding Feng (2001). Optimal Permutation Tests for the Analysis of Group Randomized Trials. Journal of the American Statistical Association.](https://doi.org/10.1198/016214501753382336)
23. [Permutation tests for multi-factor designs (Anderson & ter Braak)](https://www.uvm.edu/%7Estatdhtx/StatPages/R/RandomizationTestsWithR/andersonTerBrack.pdf)
24. [M. H. GAIL, W. Y. TAN, S. PIANTADOSI (1988). Tests for no treatment effect in randomized clinical trials. Biometrika.](https://doi.org/10.1093/biomet/75.1.57)
25. [The Randomization Test (Stat 411/511 lecture, Charlotte Wickham, 2015)](http://stat511.cwick.co.nz/lectures/10-randomization-test.pdf)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Hypothesis testing

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/randomization-test

English original: https://www.edgepedia.org/randomization-test
