# 皮尔逊相关检验

皮尔逊相关检验是一种统计检验，用于判断两个连续变量之间的总体相关系数 ρ 是否异于零。相关系数本身为 \( r = \sum (x - m_{x}) \cdot (y - m_{y}) / \sqrt{\sum (x - m_{x})^{2} \, \sum (y - m_{y})^{2}} \)，其中 \( m_{x} \) 和 \( m_{y} \) 为样本均值。<sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup> 零假设为 H₀: ρ = 0（无线性关联），备择假设为 Hₐ: ρ ≠ 0。<sup>[2](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_2e_%28OpenStax%29/13%3A_Linear_Regression_and_Correlation/13.03%3A_Testing_the_Significance_of_the_Correlation_Coefficient)</sup> 一个关键的解释局限是：零相关只有在 (x, y) 服从联合正态分布时才意味着独立；否则两个变量可以既不相关又相互依赖。<sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup>

| 关键事实 | 值 |
|---|---|
| 假设 | H₀: ρ = 0 对 Hₐ: ρ ≠ 0（也使用单侧版本）<sup>[2](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_2e_%28OpenStax%29/13%3A_Linear_Regression_and_Correlation/13.03%3A_Testing_the_Significance_of_the_Correlation_Coefficient)</sup> |
| 检验统计量 | \( t = r\sqrt{(n-2)/(1-r^{2})} \)，在 \( H_{0} \) 下服从自由度为 \( n-2 \) 的 t 分布<sup>[3](https://online.stat.psu.edu/stat415/book/export/html/830)</sup> |
| r 的精确零分布 | (−1, 1) 上的 Beta 分布，形状参数 \( a = b = n/2 - 1 \)，在二元正态零假设下对 \( n > 2 \) 精确成立<sup>[4](https://docs.scipy.org/doc/scipy-1.17.0/tutorial/stats/hypothesis_pearsonr.html)</sup> |
| 费希尔 z 方差 | \( \mathrm{Var}(z) \approx 1/(n-3) \)，几乎与 \( \rho \) 无关<sup>[3](https://online.stat.psu.edu/stat415/book/export/html/830)</sup> |
| 样本量示例 | \( n = 112 \) 时，检测 \( \rho = 0.3 \) 的功效为 90%（双侧，\( \alpha = 0.05 \)）<sup>[5](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/PASS/Pearsons_Correlation_Tests.pdf)</sup> |
| 软件 | R 的 `cor.test()` 和 `scipy.stats.pearsonr` 均实现了该检验；SciPy 的 `pearsonr` 提供精确、置换和费希尔 z 选项<sup>[6](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html)</sup><sup> • </sup><sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup> |
| 与回归的关系 | 该检验等同于检验线性回归斜率是否异于零的 t 检验<sup>[7](http://psychclassics.yorku.ca/Fisher/Methods/chap6.htm)</sup> |

## 工作原理

在二元正态性下，检验 \( H_{0} \colon \rho = 0 \) 等价于检验 X 与 Y 的独立性。检验统计量为

\[ t = \frac{r\sqrt{n-2}}{\sqrt{1-r^2}} \]

当 \( \rho = 0 \) 时，它服从自由度为 \( n - 2 \) 的 t 分布。<sup>[3](https://online.stat.psu.edu/stat415/book/export/html/830)</sup> 等价地，r 本身具有精确的零分布：(−1, 1) 上的 Beta 分布，形状参数 \( a = b = n/2 - 1 \)，在独立观测的二元正态零假设下对 \( n > 2 \) 精确成立；当 \( n = 2 \) 时分布退化，双侧 p 值为 1。<sup>[4](https://docs.scipy.org/doc/scipy-1.17.0/tutorial/stats/hypothesis_pearsonr.html)</sup><sup> • </sup><sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup> 在密度形式下，若 \( \rho = 0 \)，则

\[ g(r) = \frac{\Gamma[(n-1)/2]}{\Gamma(1/2)\,\Gamma[(n-2)/2]}\,(1-r^2)^{(n-4)/2}, \quad -1 < r < 1. \]

<sup>[3](https://online.stat.psu.edu/stat415/book/export/html/830)</sup>

对于 ρ 非零的情形，r 的分布是偏斜的，因此使用费希尔 z 变换，z = ½{logₑ(1+r) − logₑ(1−r)}；其标准误约为 1/√(n−3)，且实际上与总体相关无关。<sup>[7](http://psychclassics.yorku.ca/Fisher/Methods/chap6.htm)</sup><sup> • </sup><sup>[8](http://www2.psych.purdue.edu/~gfrancis/Classes/PSY201/Lecture24.pdf)</sup> 对于 \( \rho = 0 \) 的特定检验，使用 t 统计量而不做变换。<sup>[8](http://www2.psych.purdue.edu/~gfrancis/Classes/PSY201/Lecture24.pdf)</sup> 在置信区间、检验 \( \rho = \rho_{0} \)、以及比较或合并相关系数时，z 尺度更受青睐。<sup>[9](https://online.stat.psu.edu/stat509/lesson/18/18.1)</sup> 费希尔指出，\( \rho = 0 \) 的检验与线性回归系数是否异于零的检验完全相同。<sup>[7](http://psychclassics.yorku.ca/Fisher/Methods/chap6.htm)</sup>

## 操作步骤

实践者首先检查假设条件：两个变量均在等距或等比尺度上测量、关系近似线性、观测相互独立，且对小样本而言需要近似二元正态性。作为描述性度量，r 仅要求线性；检验本身则要求正态性。<sup>[10](https://tuos-bio-data-skills.github.io/intro-stats-book/correlation-tests.html)</sup><sup> • </sup><sup>[11](https://quarto.wessa.net/testcorr.html)</sup>

随后检验按以下步骤进行：计算 r，构造自由度为 \( n - 2 \) 的 \( t \) 统计量，并读取 p 值；临界值表提供捷径，使用 \( r = \sqrt{t^{2}/(t^{2} + \mathrm{df})} \)。<sup>[12](https://www.medcalc.org/en/manual/correlation-table.php)</sup> 精确 p 值来自 Beta 零分布，等价地来自二元正态性下自由度为 \( n - 2 \) 的 t 统计量；费希尔 z 推断是一种近似，在小样本中可能与精确结果不同。<sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup><sup> • </sup><sup>[4](https://docs.scipy.org/doc/scipy-1.17.0/tutorial/stats/hypothesis_pearsonr.html)</sup> 在 R 中，`cor.test(x, y)` 报告 t、df、p 值，以及当至少有 4 个完整数据对时基于费希尔 Z 变换的 95% 置信区间；`alternative` 参数接受 "two.sided"、"greater" 或 "less"。<sup>[6](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html)</sup> 在 SciPy 中，`pearsonr` 通过其 `method` 参数提供置换或蒙特卡洛 p 值，并在 \( n = 2 \) 时返回双侧 p 值为 1。<sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup>

## 起源

该系数的代数源于积矩法：标准计算即被称为“积矩”方法的那种。<sup>[13](https://gwern.net/doc/psychology/1904-spearman.pdf)</sup>

抽样理论出现较晚。R. A. 费希尔（R. A. Fisher）在其 1915 年发表于《生物统计》（Biometrika）的论文中，使用 2n 维空间中的几何论证，推导了从正态总体抽样时相关系数的精确频率分布；费希尔指出，该问题是由 H. E. 索珀（H. E. Soper）1913 年的文章引起他注意的。<sup>[14](https://doi.org/10.1093/biomet/10.4.507)</sup> z 变换出现在《研究工作者的统计方法》（Statistical Methods for Research Workers）中，尽管一些资料将其归功于 1915 年的论文。<sup>[7](http://psychclassics.yorku.ca/Fisher/Methods/chap6.htm)</sup><sup> • </sup><sup>[11](https://quarto.wessa.net/testcorr.html)</sup> 相关系数的显著性检验被埃贡·S. 皮尔逊（Egon S. Pearson）在 1931 年《美国统计协会杂志》（Journal of the American Statistical Association）的论文中作为一个独立问题处理。<sup>[15](https://doi.org/10.1080/01621459.1931.10503208)</sup> 围绕第一类和第二类错误的框架由内曼（Neyman）和 E. S. 皮尔逊在他们 1928 年的《生物统计》论文中引入。<sup>[16](https://doi.org/10.1093/biomet/20a.3-4.263)</sup>

## 变体

单侧备择是软件中的标准选项。<sup>[6](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html)</sup> 重抽样变体存在，但带有一个在实践中常被忽视的警告：置换检验仅当使用度量 ρ 检验 \( H_{0} \colon F_{XY} = F_{X} \cdot F_{Y} \)（独立性）时才对第一类错误精确，且仅在二元正态性或某些椭圆族下对检验 \( H_{0} \colon \rho = 0 \) 精确；这种不具有分布无关性的性质由安德鲁·F. 海斯（Andrew F. Hayes）在 1996 年《心理学方法》（Psychological Methods）论文中确立。<sup>[17](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0216287)</sup><sup> • </sup><sup>[18](https://doi.org/10.1037/1082-989x.1.2.184)</sup> 学生化置换检验在这些零假设重合时精确，否则渐近有效。<sup>[17](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0216287)</sup> 替代自举检验处理一般的零假设 \( \rho = \rho_{0} \)，通常 \( B = 500 \) 或 1000 次重复即足够。<sup>[17](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0216287)</sup>

在非正态性下，比沙拉（Bishara）和希特纳（Hittner）的模拟工作发现，重尾分布会将皮尔逊估计膨胀最多 +0.14；当 \( n \geq 20 \) 时，在计算皮尔逊之前转换为秩正态分数可最小化两类错误；而当 \( n \leq 10 \) 且极度非正态时，置换检验往往表现最佳。<sup>[19](https://pmc.ncbi.nlm.nih.gov/articles/PMC5965513/)</sup><sup> • </sup><sup>[20](https://bpb-us-w2.wpmucdn.com/blogs.cofc.edu/dist/7/881/files/2021/06/Bishara-Hittner-2012.pdf)</sup> 针对斯皮尔曼 \( \rho = 0 \) 的基于 t 和费希尔 z 的检验已被证明在理论上不正确，因为秩不可能服从二元正态分布；在 R 中，`cor.test` 对符合条件的无并列秩样本计算精确 p 值，否则使用近似，而 R 包 `perk` 中的学生化置换检验即使在 \( n = 10 \) 时也能控制第一类错误。<sup>[21](https://pmc.ncbi.nlm.nih.gov/articles/PMC11029148/)</sup> 肯德尔 τ 由 M. G. 肯德尔（M. G. Kendall）在 1938 年《生物统计》论文中作为新的秩相关度量引入，是另一种基于秩的替代方案。<sup>[22](https://doi.org/10.1093/biomet/30.1-2.81)</sup> 与常见看法相反，皮尔逊 r 并非不能用于非线性单调关联；在模拟中，肯德尔 τ 和斯皮尔曼 ρ 在低相关时功效优于 r，而 r 在其他情形下更有效。<sup>[23](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)</sup> 现代非参数独立性检验更进一步：朱利安·D. 卡尔什（Julian D. Karch）及其同事在 2024 年《多元行为研究》（Multivariate Behavioral Research）的模拟研究中发现，对于许多非线性关系，距离相关和 HHG-皮尔逊检验的功效显著高于皮尔逊、斯皮尔曼和肯德尔检验。<sup>[24](https://doi.org/10.1080/00273171.2024.2347960)</sup> 对于时间序列，普通检验在序列依赖下校准失当，M. S. 巴特利特（M. S. Bartlett）1935 年的论文处理了有效样本量调整问题，而截断时间平移检验在其中一个序列平稳时可证明地控制假阳性。<sup>[25](https://doi.org/10.2307/2342284)</sup><sup> • </sup><sup>[26](https://journals.plos.org/plosbiology/article?id=10.1371%2Fjournal.pbio.3002758)</sup>

## 应用

检验的功效可以从非零 ρ 下 r 的累积分布精确计算，使用威廉·C. 冈瑟（William C. Guenther）1977 年《美国统计学家》（American Statistician）论文中关于这些概率手工计算的算法。<sup>[27](https://doi.org/10.1080/00031305.1977.10479195)</sup><sup> • </sup><sup>[5](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/PASS/Pearsons_Correlation_Tests.pdf)</sup> 对小效应而言这些数字令人清醒：对于 \( \alpha = 0.05 \) 的双侧检验，\( \rho_{0} = 0 \)，备择 \( \rho_{1} = 0.3 \)，在 \( n = 100 \) 时功效为 0.86524，而达到 90% 功效所需的样本量为 112。<sup>[5](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/PASS/Pearsons_Correlation_Tests.pdf)</sup> 若干作者认为检验 \( \rho = 0 \) 往往是错误的问题，另一种选择是为期望的区间宽度选择 n；例如，\( n = 300 \) 时，对于规划值为 0.4 的斯皮尔曼系数，95% 置信区间宽度为 0.20。<sup>[28](https://ww2.amstat.org/meetings/proceedings/2016/data/assets/pdf/389762.pdf)</sup> 在软件中，R 的 `cor.test()` 和 SciPy 的 `pearsonr` 均实现了该检验，后者提供精确、置换和费希尔 z 选项。<sup>[6](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html)</sup><sup> • </sup><sup>[1](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)</sup>

## 局限与替代方案

\( t(n-2) \) 零分布在 \( H_{0} \colon \rho = 0 \) 下对独立的二元正态数据对精确；没有正态性的独立性不给出精确的 t 分布，而在依赖数据或非高斯数据的一般情境中，经典皮尔逊检验校准不佳，模拟显示假阳性率远高于名义 5% 水平。在一个实例中，通常的皮尔逊检验给出 \( p = 9.25\% \)，而 `robusTest` 包中的校正检验在同一数据上给出 \( p = 1.74\% \)。<sup>[29](https://export.arxiv.org/pdf/2211.08784v1.pdf)</sup> 早期关于 r 的零分布在二元正态曲面严重扭曲下仍然成立的说法已被推翻。<sup>[17](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0216287)</sup> 离群值是另一个弱点：皮尔逊仅在二元正态性下才是 ρ 的最大似然估计量，且对离群值和非线性关系敏感。<sup>[30](https://cran.r-project.org/web/packages/smartcor/vignettes/theory.html)</sup> 将连续变量二分化会严重削弱系数：当真实相关系数为 \( \rho = 0.7 \) 的连续变量被二分化时，φ 系数降至约 0.45–0.50，而多分格相关——其最大似然估计在乌尔夫·奥尔松（Ulf Olsson）1979 年《心理测量学》（Psychometrika）论文中得到处理——可恢复 0.70。<sup>[30](https://cran.r-project.org/web/packages/smartcor/vignettes/theory.html)</sup><sup> • </sup><sup>[31](https://doi.org/10.1007/bf02296207)</sup>

解释是另一种失效模式。宾夕法尼亚州立大学 STAT 509 教材在谈及 SAS PROC CORR 对 \( \rho = 0 \) 的检验时指出，它“通常不太有用”，建议改用置信区间。<sup>[9](https://online.stat.psu.edu/stat509/lesson/18/18.1)</sup> 仅依赖 p 值进行解释可能导致错误结论；系数 r 本身即作为效应量。<sup>[32](https://www.ncbi.nlm.nih.gov/sites/books/NBK606101/)</sup> 当同时检验许多相关时，朴素地使用样本相关或费希尔 z 统计量会产生大量假阳性；一种“三明治估计量”对样本去相关，结合本杰明-霍赫贝格（Benjamini-Hochberg）程序，可渐近控制错误发现率。<sup>[33](https://arxiv.org/pdf/1703.08843)</sup> 作为更简单的防护，HHG-皮尔逊检验通过 \( p = 2 \cdot \min(p_{\mathrm{HHG}}, p_{\mathrm{Pearson}}) \) 将皮尔逊 p 值与 HHG 检验的 p 值结合，这是一种具有族系错误控制的邦费罗尼式组合。<sup>[24](https://doi.org/10.1080/00273171.2024.2347960)</sup>

## References

1. [scipy.stats.pearsonr, SciPy documentation](https://scipy.github.io/devdocs/reference/generated/scipy.stats.pearsonr.html)
2. [13.03: Testing the Significance of the Correlation Coefficient (stats.libretexts.org)](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_2e_%28OpenStax%29/13%3A_Linear_Regression_and_Correlation/13.03%3A_Testing_the_Significance_of_the_Correlation_Coefficient)
3. [Lesson 15: Tests Concerning Regression and Correlation (Penn State STAT 415)](https://online.stat.psu.edu/stat415/book/export/html/830)
4. [Pearson's Correlation, SciPy hypothesis testing tutorial](https://docs.scipy.org/doc/scipy-1.17.0/tutorial/stats/hypothesis_pearsonr.html)
5. [Pearson's Correlation Tests (PASS power/sample-size procedure)](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/PASS/Pearsons_Correlation_Tests.pdf)
6. [R: Test for Association/Correlation Between Paired Samples (cor.test)](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.test.html)
7. [Statistical Methods for Research Workers, Chapter 6 (R. A. Fisher, 1925), 'The Correlation Coefficient'](http://psychclassics.yorku.ca/Fisher/Methods/chap6.htm)
8. [PSY 201 Lecture 24: Hypothesis testing for correlations (Purdue, G. Francis)](http://www2.psych.purdue.edu/~gfrancis/Classes/PSY201/Lecture24.pdf)
9. [18.1 - Pearson Correlation Coefficient | STAT 509 (Penn State)](https://online.stat.psu.edu/stat509/lesson/18/18.1)
10. [Chapter 11 Correlation tests, Introductory Biostatistics with R](https://tuos-bio-data-skills.github.io/intro-stats-book/correlation-tests.html)
11. [131 Testing Correlations – Statistical Analysis for Small and Big Data](https://quarto.wessa.net/testcorr.html)
12. [Critical Values of the Pearson Correlation Coefficient (r) | MedCalc](https://www.medcalc.org/en/manual/correlation-table.php)
13. [The Proof and Measurement of Association between Two Things (C. Spearman, 1904, American Journal of Psychology)](https://gwern.net/doc/psychology/1904-spearman.pdf)
14. [R. A. FISHER (1915). FREQUENCY DISTRIBUTION OF THE VALUES OF THE CORRELATION COEFFIENTS IN SAMPLES FROM AN INDEFINITELY LARGE POPU;ATION. Biometrika.](https://doi.org/10.1093/biomet/10.4.507)
15. [Egon S. Pearson (1931). The Test of Significance for the Correlation Coefficient. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1931.10503208)
16. [J. NEYMAN, E. S. PEARSON (1928). ON THE USE AND INTERPRETATION OF CERTAIN TEST CRITERIA FOR PURPOSES OF STATISTICAL INFERENCE. Biometrika.](https://doi.org/10.1093/biomet/20a.3-4.263)
17. [A robust Pearson correlation test for a general point null using a surrogate bootstrap distribution (PLOS One)](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0216287)
18. [Andrew F. Hayes (1996). Permutation test is not distribution-free: Testing H₀: ρ = 0.. Psychological Methods.](https://doi.org/10.1037/1082-989x.1.2.184)
19. [Reducing Bias and Error in the Correlation Coefficient Due to Nonnormality (Bishara & Hittner)](https://pmc.ncbi.nlm.nih.gov/articles/PMC5965513/)
20. [Testing the significance of a correlation with nonnormal data: Comparison of Pearson, Spearman, transformation, and resampling approaches (Bishara & Hittner, 2012, Psychological Methods)](https://bpb-us-w2.wpmucdn.com/blogs.cofc.edu/dist/7/881/files/2021/06/Bishara-Hittner-2012.pdf)
21. [A robust Spearman correlation coefficient permutation test](https://pmc.ncbi.nlm.nih.gov/articles/PMC11029148/)
22. [M. G. KENDALL (1938). A NEW MEASURE OF RANK CORRELATION. Biometrika.](https://doi.org/10.1093/biomet/30.1-2.81)
23. [Myths About Linear and Monotonic Associations: Pearson's r, Spearman's ρ, and Kendall's τ (van den Heuvel, The American Statistician)](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)
24. [Julian D. Karch, Andres F. Perez-Alonso, Wicher P. Bergsma (2024). Beyond Pearson’s Correlation: Modern Nonparametric Independence Tests for Psychological Research. Multivariate Behavioral Research.](https://doi.org/10.1080/00273171.2024.2347960)
25. [M. S. Bartlett (1935). Some Aspects of the Time-Correlation Problem in Regard to Tests of Significance. Journal Of The Royal Statistical Society.](https://doi.org/10.2307/2342284)
26. [A rigorous and versatile statistical test for correlations between stationary time series (PLOS Biology)](https://journals.plos.org/plosbiology/article?id=10.1371%2Fjournal.pbio.3002758)
27. [William C. Guenther (1977). Desk Calculation of Probabilities for the Distribution of the Sample Correlation Coefficient. The American Statistician.](https://doi.org/10.1080/00031305.1977.10479195)
28. [Simplified Tools for Sample Size Determination for Correlation Coefficient Inference (May, Ketchum, Looney, JSM 2016)](https://ww2.amstat.org/meetings/proceedings/2016/data/assets/pdf/389762.pdf)
29. [robusTest: corrected (robust) versions of Pearson, Kendall, Spearman correlation tests (arXiv preprint)](https://export.arxiv.org/pdf/2211.08784v1.pdf)
30. [Choosing the Right Correlation Method: Theory and Rationale (smartcor vignette, CRAN)](https://cran.r-project.org/web/packages/smartcor/vignettes/theory.html)
31. [Ulf Olsson (1979). Maximum Likelihood Estimation of the Polychoric Correlation Coefficient. Psychometrika.](https://doi.org/10.1007/bf02296207)
32. [Correlation (Coefficient, Partial, and Spearman Rank) and Regression Analysis (StatPearls, NCBI Bookshelf)](https://www.ncbi.nlm.nih.gov/sites/books/NBK606101/)
33. [Testing independence with high-dimensional covariates (max-type test, sandwich estimator, multiple testing of Pearson correlations)](https://arxiv.org/pdf/1703.08843)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Multivariate association and dimension reduction › Titles Mo to W

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/pearson-correlation-test

English original: https://www.edgepedia.org/pearson-correlation-test
