# 费希尔精确检验

**费希尔精确检验**（Fisher's exact test）是一种统计显著性检验，用于判断两个分类变量之间是否存在关联，最常用于 2 × 2 列联表。在该检验中，观测表及更极端表的概率直接由超几何分布（从有限总体中不放回抽样的概率）精确计算得出，而非采用大样本近似。该检验由 R. A. 费希尔（R. A. Fisher）于 1935 年提出，并以他的名字命名。

| 关键事实 | 详情 |
|---|---|
| 目的 | 在边际合计固定的列联表中检验独立性（或两组比例相等）的零假设<sup>[1](https://www.stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html)</sup> |
| 概率模型 | 边际合计固定的表的精确概率由超几何分布给出<sup>[2](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)</sup> |
| 起源 | 费希尔，《归纳推断的逻辑》（"The Logic of Inductive Inference"，1935），《皇家统计学会杂志》，第 98 卷第 1 期<sup>[3](https://www.dcscience.net/fisher-1935.pdf)</sup> |
| 计算示例 | 朗格（Lange）的犯罪双胞胎表：在 6,653,325 种可能的表中，恰好有 3,095 种表会产生至少与观测值一样大的差异，大约每 2,150 次试验出现一次<sup>[3](https://www.dcscience.net/fisher-1935.pdf)</sup> |
| 已知缺陷 | 当边际合计并非自然固定时，检验偏保守；通常建议改用 mid-p 变体（兰卡斯特，1961）<sup>[4](https://doi.org/10.1111/2041-210X.14318)</sup> |
| 效能比较 | 在双侧小样本比较中，未校正的卡方检验效能最高，mid-p 检验居中，费希尔精确检验效能最低<sup>[5](https://pubmed.ncbi.nlm.nih.gov/8516594/)</sup> |
| 软件 | 在 R（`fisher.test`）、SciPy（`fisher_exact`）和 Dataplot 中均为标准方法，其中 Dataplot 使用 Mehta–Patel FEXACT 网络算法，支持 R × C 表<sup>[1](https://www.stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html)</sup><sup> • </sup><sup>[6](https://docs.scipy.org/doc/scipy-1.15.1/reference/generated/scipy.stats.fisher_exact.html)</sup><sup> • </sup><sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/fishexac.htm)</sup> |

## 检验原理

该检验处理的是一个 2 × 2 的计数表，例如两组各自被分类为成功或失败。当边际合计被视为固定时，观测到某一特定频数组合的精确概率由超几何分布给出：

\[ p = \frac{(A+B)!\,(C+D)!\,(A+C)!\,(B+D)!}{N!\,A!\,B!\,C!\,D!} \]

其中 A、B、C、D 为四个单元格的计数，N 为总数<sup>[2](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)</sup>。检验并不止于观测表：它还会计算在相同边际合计下更极端结果的概率，其中“更极端”是相对于比例相等的零假设来衡量的。p 值即为这些概率之和<sup>[2](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)</sup>。在 NIST 手册的示例中，观测表的概率为 0.26515，加上另外两个更极端表的概率 0.04419 和 0.00126，得到 p 值为 0.31060，在 0.05 水平下不拒绝零假设<sup>[2](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)</sup>。

以边际合计为条件是该检验的决定性步骤。费希尔认为，边际频数不提供关于表内频数比例性的任何信息，因此推断仅涉及在给定边际合计的条件下，表的不同填充方式之间的相对概率<sup>[3](https://www.dcscience.net/fisher-1935.pdf)</sup>。由于参照分布是精确计算的，该检验适用于渐近检验（如皮尔逊卡方检验）不可靠的小样本情形；比例相等的正态理论检验正是它的大样本近似<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/fishexac.htm)</sup>。

对于双侧检验，“至少同样极端”存在不止一种站得住脚的定义；SciPy 文档指出，与该检验相关的统计量选择和双侧 p 值定义有若干种可能<sup>[6](https://docs.scipy.org/doc/scipy-1.15.1/reference/generated/scipy.stats.fisher_exact.html)</sup>。

## 起源

费希尔在 1935 年的论文《归纳推断的逻辑》中提出了 2 × 2 精确检验，并于同年在一篇相关论文《统计推断中的置信论证》（"The Fiducial Argument in Statistical Inference"，《优生学年鉴》，1935 年 12 月）中使用了相关的精确推理<sup>[3](https://www.dcscience.net/fisher-1935.pdf)</sup><sup> • </sup><sup>[8](https://onlinelibrary.wiley.com/doi/10.1111/j.1469-1809.1935.tb02120.x)</sup>。1935 年论文中的计算示例是朗格关于犯罪双胞胎的研究：在 13 名已知犯罪者的同卵双胞胎中，有 10 名双胞胎兄弟也被定罪；而在 17 名异卵双胞胎中，只有 2 名被定罪。费希尔列举了与边际合计一致的 13 种可能的表，得到超几何级数 1、102、2992、……，分母为 6,653,325，并得出结论：与观测值一样大或更大的差异恰好会在 6,653,325 次试验中的 3,095 次出现，大约每 2,150 次试验出现一次。“因此，显著性检验是直接的，且对小样本是精确的，”他写道；其中不涉及任何估计过程<sup>[3](https://www.dcscience.net/fisher-1935.pdf)</sup>。

该检验诞生于争议之中。卡尔·皮尔逊（Karl Pearson）在 1935 年与费希尔在《自然》杂志上题为“统计检验”的往来辩论中，对费希尔关于假设接受与拒绝的使用和滥用提出质疑，认为只有概率为零的假设才能被确定地拒绝<sup>[9](https://www.nature.com/articles/136550a0)</sup>。该检验有时也被归功于独立发展；历史记述指出有证据表明费希尔在该检验的发展中具有优先权<sup>[10](https://www.jehps.net/Decembre2009/Hitchcock.pdf)</sup>。

## 保守性批评

对该检验的主要反对意见在于其条件化处理。列联表的两个边际合计都很少由研究设计自然固定，而对实际上是随机的边际合计进行条件化会导致不必要的保守估计，即实际拒绝率低于名义显著性水平<sup>[4](https://doi.org/10.1111/2041-210X.14318)</sup>。精确条件分布的离散性对费希尔检验这类条件检验的影响远大于对非条件检验的影响<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC4388855/)</sup>。

存在若干补救方法。**mid-p** 变体由兰卡斯特于 1961 年提出，从尾部概率和中减去观测表概率的一半，通常被推荐用于更好地反映反对零假设的证据<sup>[4](https://doi.org/10.1111/2041-210X.14318)</sup>。厄普顿（Upton）于 1992 年在《皇家统计学会杂志 A 辑》上撰文，推翻了自己早先的立场，为费希尔精确检验辩护，指出 2 × 2 表的所有检验统计量都具有离散分布，规定一个无法达到的固定显著性水平是不合理的；他建议，如果需要可变尾部概率的公式，可使用 mid-p<sup>[12](https://academic.oup.com/jrsssa/article/155/3/395/7106631)</sup>。另一种选择是，吕德森（Lydersen）及其同事（2009）推荐将巴纳德（Barnard，1945）或博斯卢（Boschloo，1970）的精确非条件检验配合贝格尔与博斯（Berger and Boos）校正，作为 2 × 2 表关联检验的“金标准”<sup>[4](https://doi.org/10.1111/2041-210X.14318)</sup>。

效能损失是可测量的。在针对两个样本量相等的小样本组的双侧检验比较中，未校正的卡方检验效能最高，mid-p 检验效能居中，费希尔精确检验效能最低；卡方检验和 mid-p 检验偶尔会超过名义 α 水平<sup>[5](https://pubmed.ncbi.nlm.nih.gov/8516594/)</sup>。巴纳德检验对 2 × 2 表的效能高于费希尔检验，正如巴纳德在其 1945 年论文中所指出的，这令费希尔大为不快<sup>[13](https://www.nbi.dk/~petersen/Teaching/Stat2009/Barnard_ExactTest_TwoBinomials.pdf)</sup>。然而，随后一项比较渐近效能的研究得出结论：对于有 0 个或 1 个固定边际合计的表，只要分别满足样本量达到 100 或较小样本量达到 80 的条件，费希尔精确检验就近似于巴纳德精确检验<sup>[14](https://www.sciencedirect.com/science/article/pii/S016794730300286X)</sup>。另一项关于费希尔检验最优版本（按平均效能选取）的研究发现，在大多数情形下，相对于常见非条件检验的效能损失非常轻微，这是为更简便的计算和跨样本类型的通用有效性所付出的可接受代价<sup>[15](https://www.sciencedirect.com/science/article/pii/0167947394000139)</sup>。

## 实践应用

该检验是小离散数据集的标准非参数技术，适用于两个独立样本的结果落入两个互斥类别的情形<sup>[2](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)</sup>。它在临床试验中常用于比较两种治疗的成功比例，在流行病学中用于分析风险因素对疾病的影响<sup>[14](https://www.sciencedirect.com/science/article/pii/S016794730300286X)</sup>。针对低事件率比较试验的样本量表 已基于该检验的精确效能计算构建，涵盖单侧和双侧备择假设<sup>[16](https://www.sciencedirect.com/science/article/pii/019724569290019V)</sup>。

**软件实现**在细节上有所不同。R 的 `fisher.test` 对边际合计固定的列联表执行独立性零假设检验，报告优势比的条件最大似然估计而非样本优势比，并为大于 2 × 2 的表提供 p 值的蒙特卡洛模拟——对于这类表，网络算法可能需要大量工作空间，有时需要数小时的计算<sup>[1](https://www.stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html)</sup>。SciPy 的 `fisher_exact` 返回优势比的非条件最大似然估计，这与 R 的条件估计是不同的量<sup>[6](https://docs.scipy.org/doc/scipy-1.15.1/reference/generated/scipy.stats.fisher_exact.html)</sup>。Dataplot 通过 ACM 算法 643——Mehta 和 Patel 的 FEXACT 例程——实现该检验，该例程通过网络算法处理无序 R × C 表<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/fishexac.htm)</sup>。扩展方法包括针对分层 2 × 2 表的分层费希尔精确检验，它在单表情形下退化为标准检验，且由于精确检验的离散性，其本身也是保守的<sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC3884832/)</sup>。

## References

1. [fisher.test {stats}, R Documentation](https://www.stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html)
2. [7.3.3. How can we determine whether two processes produce the same proportion of defectives?, NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm)
3. [Fisher, R. A. (1935). The Logic of Inductive Inference. Journal of the Royal Statistical Society, Vol. 98, No. 1](https://www.dcscience.net/fisher-1935.pdf)
4. [Nagel et al. (2024). Classical tests, linear models and their extensions for the analysis of 2 × 2 contingency tables. Methods in Ecology and Evolution](https://doi.org/10.1111/2041-210X.14318)
5. [Davis, A. B. (1993). Power of testing proportions in small two-sample studies when sample sizes are equal. Statistics in Medicine](https://pubmed.ncbi.nlm.nih.gov/8516594/)
6. [fisher_exact, SciPy v1.15.1 Manual](https://docs.scipy.org/doc/scipy-1.15.1/reference/generated/scipy.stats.fisher_exact.html)
7. [Fisher Exact Test, NIST Dataplot Reference Manual](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/fishexac.htm)
8. [Fisher, R. A. (1935). The Fiducial Argument in Statistical Inference. Annals of Eugenics 6: 391–398](https://onlinelibrary.wiley.com/doi/10.1111/j.1469-1809.1935.tb02120.x)
9. [Pearson, K. (1935). Statistical Tests. Nature 136: 550](https://www.nature.com/articles/136550a0)
10. [Hitchcock (2009). Journal Electronique d'Histoire des Probabilités et de la Statistique](https://www.jehps.net/Decembre2009/Hitchcock.pdf)
11. [Elucidating the Foundations of Statistical Inference with 2 × 2 Tables, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC4388855/)
12. [Upton, G. J. G. (1992). Fisher's Exact Test. Journal of the Royal Statistical Society Series A 155(3): 395–402](https://academic.oup.com/jrsssa/article/155/3/395/7106631)
13. [Barnard's Exact Test for Two Binomials, Niels Bohr Institute course notes](https://www.nbi.dk/~petersen/Teaching/Stat2009/Barnard_ExactTest_TwoBinomials.pdf)
14. [Martín Andrés & Silva (2006). Comparing the asymptotic power of exact tests in 2×2 tables. Computational Statistics & Data Analysis](https://www.sciencedirect.com/science/article/pii/S016794730300286X)
15. [Is Fisher's exact test very conservative? Computational Statistics & Data Analysis](https://www.sciencedirect.com/science/article/pii/0167947394000139)
16. [Sample size determination based on Fisher's exact test for use in 2 × 2 comparative trials with low event rates. Controlled Clinical Trials 13(2): 134–147](https://www.sciencedirect.com/science/article/pii/019724569290019V)
17. [Stratified Fisher's Exact Test and its Sample Size Calculation, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC3884832/)

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

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/fishers-exact-test

English original: https://www.edgepedia.org/fishers-exact-test
