# 弗里德曼检验

弗里德曼检验是一种非参数统计检验，用于检测在同一区组上评估的三个或更多处理之间的差异，例如对同一受试者在重复条件下进行测量。它用区组内分配的秩代替原始测量值，检验处理秩和之间的差异是否超出随机所能产生的范围，并且不对原始数据作任何分布假设。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[2](https://sk.sagepub.com/ency/edvol/embed/researchdesign/chpt/friedman-test)</sup>

| 要点 | 说明 |
|---|---|
| 起源 | 由米尔顿·弗里德曼（Milton Friedman）在《用秩避免方差分析中隐含的正态性假设》一文中提出，*《美国统计协会杂志》* 第32卷，1937年12月，第675–701页<sup>[3](https://www.stat.uchicago.edu/~stigler/Milton_Friedman_and_Statistics.pdf)</sup><sup> • </sup><sup>[4](https://doi.org/10.1080/01621459.1937.10503522)</sup> |
| 设计 | 用于随机完全区组设计的非参数检验；要求每个区组内每个处理恰好有一个观测值<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> |
| 检验统计量 | \( T_1 = \frac{12}{bk(k+1)} \sum_{i=1}^{k}{(R_i - b(k+1)/2)^2} \)，参照自由度为 \( k-1 \) 的卡方分布<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> |
| 首选近似 | 康诺弗（Conover）的 \( T_2 = \frac{(b-1)T_1}{b(k-1) - T_1} \)，与F分布比较，其近似分布比卡方形式更精确<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> |
| 小样本表现 | 卡方近似偏保守，尤其在小样本和大量结值的情况下；此时宜采用精确临界值或模拟<sup>[5](https://journals.sagepub.com/doi/10.1177/1536867x0900900208)</sup><sup> • </sup><sup>[6](https://link.springer.com/article/10.1007/s13571-025-00362-2)</sup> |
| 效应量 | 肯德尔和谐系数，\( W = \chi^2_F / [N(k-1)] \)，范围从0（无一致性）到1（排序完全相同）<sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup> |
| 机器学习中的应用 | 由德姆沙尔（Demšar，2006）推荐为在多个数据集上比较多个分类器的标准检验<sup>[8](https://www.jmlr.org/beta/papers/v7/demsar06a.html)</sup> |

## 检验的工作原理

数据构成一个双向表，包含 \( b \) 个区组（行）和 \( k \) 个处理（列），每个单元格中有一个观测值 \( X_{ij} \)。在每个区组内，将 \( k \) 个观测值从最小的记为1到最大的记为 \( k \) 进行排序；结值取其本应占据的秩的平均值。然后将每个处理的秩在各区组间求和，得到 \( R_j = \sum_{i=1}^{b} R(X_{ij}) \)。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[2](https://sk.sagepub.com/ency/edvol/embed/researchdesign/chpt/friedman-test)</sup>

原假设认为各处理具有相同的效应；备择假设是至少一个处理与至少另一个处理不同。如果原假设为真，每个区组的秩将在各处理间随机分配，每个处理的平均秩将收敛于同一值。弗里德曼统计量衡量观测秩和偏离该期望值的程度：<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup>

\[ T_1 = \frac{12}{bk(k+1)} \sum_{i=1}^{k}{\left(R_i - \frac{b(k+1)}{2}\right)^2} \]

存在结值时，统计量需要校正，使用 \( A_1 = \sum_{i=1}^{b}\sum_{j=1}^{k} (R(X_{ij}))^2 \) 和校正因子 \( C_1 = bk(k+1)^2/4 \)。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> 由于在每个区组内排序消除了使一个区组所有值等量偏移的任何影响，该检验不受在受试者内均匀起作用的变异来源的影响。<sup>[9](https://www.graphpad.com/guides/prism/latest/statistics/how_the_friedman_test_works.htm)</sup>

## 起源

米尔顿·弗里德曼（1912–2006）后来主要以经济学家身份闻名，他在担任统计师期间开发了该检验。1933–34年在哥伦比亚大学师从哈罗德·霍特林（Harold Hotelling）学习数理经济学后，他直接受到霍特林和玛格丽特·帕布斯特（Margaret Pabst）1936年关于秩相关方法论文的启发，该论文表明用秩代替测量值可以使分析摆脱分布假设，并在前计算机时代简化计算。弗里德曼1937年的文章将秩的思想扩展到双向方差分析，即R. A. 费希尔（R. A. Fisher）十年前引入的计算密集型方法体系。<sup>[3](https://www.stat.uchicago.edu/~stigler/Milton_Friedman_and_Statistics.pdf)</sup>

该文发表于1937年12月的*《美国统计协会杂志》*，标题为《用秩避免方差分析中隐含的正态性假设》。<sup>[4](https://doi.org/10.1080/01621459.1937.10503522)</sup> 弗里德曼于1939年发表了一则更正，指出遗漏了一个平方根符号，并于1940年发表了他的检验与竞争方法的比较；除此之外，芝加哥大学统计学史学家斯蒂芬·斯蒂格勒（Stephen Stigler）指出，此后七十年间对原始处理方法的改进甚少，该检验仍然是几乎所有主要统计计算软件包的一部分。<sup>[3](https://www.stat.uchicago.edu/~stigler/Milton_Friedman_and_Statistics.pdf)</sup>

## 假设与适用情形

该检验要求区组（行）相互独立，数据可以被有意义地排序（至少是定序测量），并且每个区组内每个处理恰好有一个观测值。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> 它是单因素重复测量方差分析的标准非参数替代方法，适用于结果是定序变量、无法假设正态性、或离群值会扭曲均值但不影响秩的情况。<sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup>

两个边界情形值得注意。当恰好有两个相关条件时，弗里德曼检验等价于符号检验，此时通常选择威尔科克森符号秩检验。对于独立组而非同一受试者的重复测量，克鲁斯卡尔–沃利斯检验是合适的对应方法。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup> 相关的奎德检验是威尔科克森符号秩检验向多个相关样本的扩展，在处理数少于五个时通常更具检验力，而弗里德曼检验在五个或更多处理时往往更具检验力；奎德检验还要求等距量表数据，因为它使用区组内极差。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[10](https://www.sciencedirect.com/science/article/pii/0010482587900035)</sup>

## 近似与精确推断

在原假设下，该统计量具有自由度为 \( k-1 \) 的渐近卡方分布，但这种近似通常偏保守，其精度随处理数的增加而下降。<sup>[6](https://link.springer.com/article/10.1007/s13571-025-00362-2)</sup> 因此康诺弗推荐统计量 \( T_2 = \frac{(b-1)T_1}{b(k-1) - T_1} \)，它是在秩上计算的双向方差分析统计量，与自由度为 \( k-1 \) 和 \( (b-1)(k-1) \) 的F分布比较；1980年的伊曼–达文波特F变换即属此类，给出的近似比卡方形式更精确。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup><sup> • </sup><sup>[6](https://link.springer.com/article/10.1007/s13571-025-00362-2)</sup>

对于小表，精确方法完全避免了近似。弗里德曼本人列出了小 \( k \) 和 \( n \) 的精确分布表，并且已有算法可以计算该统计量的精确置换分布，即使行内存在随机依赖性。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC5267387/)</sup><sup> • </sup><sup>[12](https://www.sciencedirect.com/science/article/pii/S0167947397000194)</sup> 软件指南反映了同样的谨慎：SciPy指出卡方p值仅在重复样本超过10个且处理超过6个时才可靠，GraphPad Prism对小表计算精确P值，当 \( (T!)^S \) 超过 \( 10^9 \) 时切换为近似。<sup>[13](https://scipy.github.io/devdocs/reference/generated/scipy.stats.friedmanchisquare.html)</sup><sup> • </sup><sup>[9](https://www.graphpad.com/guides/prism/latest/statistics/how_the_friedman_test_works.htm)</sup>

## 事后比较

弗里德曼检验的显著结果是总体性结论：它表明各条件并非全部相等，但未指出哪些配对存在差异。仅报告该结果而不进行后续分析是不完整的，而运行未校正的两两检验会膨胀族系误差率；当 \( k = 6 \) 个条件时有15个两两比较。<sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup> 两种标准程序是内梅尼检验，它将每对平均秩之差与单一临界差值 \( q_{\alpha} \sqrt{k(k+1)/(6N)} \) 比较，以及带邦费罗尼校正的两两威尔科克森符号秩检验，当仅对预先计划的比较子集感兴趣时后者通常更具检验力。<sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup>

通常讲授的平均秩事后检验有一个有据可查的弱点。阿莱西奥·贝纳沃利（Alessio Benavoli）、乔治·科拉尼（Giorgio Corani）和弗朗切斯卡·曼吉利（Francesca Mangili），当时是瑞士IDSIA的机器学习研究人员，在2016年*《机器学习研究杂志》*的一篇短文中表明，两种算法之间平均秩比较的结果取决于原始实验中包含了哪些其他算法；A与B之间的差异在一组竞争算法下可能被判定为显著，而在另一组下则不显著。他们推荐其结果仅取决于被比较的两种算法的两两检验，如符号检验或威尔科克森符号秩检验。<sup>[14](https://www.jmlr.org/beta/papers/v17/benavoli16a.html)</sup>

## 扩展与相关检验

弗里德曼检验仅处理完整的、无重复的区组设计；软件会拒绝存在缺失单元格或每个处理与区组的组合有多个观测值的数据。<sup>[1](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)</sup> 对于缺失数据，斯基林斯–麦克统计量（Skillings and Mack, 1981）是一种通用的弗里德曼型统计量，几乎可用于任何具有任意缺失数据结构的区组设计，无论是设计缺失还是完全随机缺失；当无数据缺失时它退化为弗里德曼检验，对于平衡不完全区组则退化为杜宾（Durbin）1951年的检验。<sup>[5](https://journals.sagepub.com/doi/10.1177/1536867x0900900208)</sup>

肯德尔和谐系数作为配套效应量，由同一统计量计算为 \( W = \chi^2_F / [N(k-1)] \)；它描述受试者对条件排序的一致程度，从0（无一致性）到1（排序完全相同）。<sup>[7](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)</sup>

## 在机器学习中的应用

在多个数据集上比较多种学习算法提出了相同的区组结构：每个数据集是一个区组，每种算法是一个处理。亚内兹·德姆沙尔（Janez Demšar）2006年在*《机器学习研究杂志》*上的综述考察了可用的检验方法，推荐使用弗里德曼检验及相应的事后检验来在多个数据集上比较多个分类器，同时推荐威尔科克森符号秩检验用于两个分类器的比较，并引入了临界差异图来呈现结果。<sup>[8](https://www.jmlr.org/beta/papers/v7/demsar06a.html)</sup> 这一推荐使弗里德曼检验成为机器学习基准测试中的标准工具，后续工作改进了其事后比较的执行方式。<sup>[14](https://www.jmlr.org/beta/papers/v17/benavoli16a.html)</sup>

## References

1. [FRIEDMAN TEST, NIST/SEMATECH Dataplot reference manual](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/friedman.htm)
2. [Friedman Test, Encyclopedia of Research Design, SAGE Reference](https://sk.sagepub.com/ency/edvol/embed/researchdesign/chpt/friedman-test)
3. [Stephen M. Stigler. Milton Friedman and Statistics](https://www.stat.uchicago.edu/~stigler/Milton_Friedman_and_Statistics.pdf)
4. [Milton Friedman (1937). The Use of Ranks to Avoid the Assumption of Normality Implicit in the Analysis of Variance. Journal of the American Statistical Association 32(200): 675–701](https://doi.org/10.1080/01621459.1937.10503522)
5. [Mark Chatfield and Adrian Mander (2009). The Skillings–Mack Test (Friedman Test when There are Missing Data). The Stata Journal 9(2): 299–305](https://journals.sagepub.com/doi/10.1177/1536867x0900900208)
6. [An Improved Nonparametric Test and Sample Size Procedures for the Randomized Complete Block Designs. Sankhya B](https://link.springer.com/article/10.1007/s13571-025-00362-2)
7. [The Friedman Test and Its Post-Hoc Procedures: Nemenyi vs. Wilcoxon-Bonferroni, CASRAI guide](https://casrai.org/guides/friedman-test-and-post-hoc-procedures)
8. [Janez Demšar (2006). Statistical Comparisons of Classifiers over Multiple Data Sets. Journal of Machine Learning Research 7: 1–30](https://www.jmlr.org/beta/papers/v7/demsar06a.html)
9. [Interpreting results: Friedman test, GraphPad Prism 11 Statistics Guide](https://www.graphpad.com/guides/prism/latest/statistics/how_the_friedman_test_works.htm)
10. [Friedman and Quade tests: BASIC computer program. Computers in Biology and Medicine 17(2): 85–99 (1987)](https://www.sciencedirect.com/science/article/pii/0010482587900035)
11. [Rob Eisinga, Tom Heskes, Ben Pelzer, Manfred Te Grotenhuis (2017). Exact p-values for pairwise comparison of Friedman rank sums. BMC Bioinformatics 18:68](https://pmc.ncbi.nlm.nih.gov/articles/PMC5267387/)
12. [The permutation distribution of the Friedman test. Computational Statistics & Data Analysis 26(1): 83–99 (1997)](https://www.sciencedirect.com/science/article/pii/S0167947397000194)
13. [scipy.stats.friedmanchisquare, SciPy reference manual](https://scipy.github.io/devdocs/reference/generated/scipy.stats.friedmanchisquare.html)
14. [Alessio Benavoli, Giorgio Corani, Francesca Mangili (2016). Should We Really Use Post-Hoc Tests Based on Mean-Ranks? Journal of Machine Learning Research 17(5): 1–10](https://www.jmlr.org/beta/papers/v17/benavoli16a.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Estimation theory and estimator families › Robust statistics and resampling › Rank-based and distribution-free robust methods

Copyright 2026 Edgepedia

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

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

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