# 协方差

**协方差**（Covariance）是衡量两个随机变量联合变异程度的量度：即二者各自对其均值之偏差的乘积的期望值。对于均值为 \(\mu_X\) 和 \(\mu_Y\) 的随机变量 \( X \) 与 \( Y \)，其定义为 \(\mathrm{Cov}(X,Y) = E[(X-\mu_X)(Y-\mu_Y)]\)，它是相关系数、协方差矩阵以及多元统计分析的基本构件。<sup>[1](https://online.stat.psu.edu/stat414/Lesson18)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | \(\mathrm{Cov}(X,Y) = E[(X-\mu_X)(Y-\mu_Y)] = E(XY) - \mu_X\mu_Y\)<sup>[1](https://online.stat.psu.edu/stat414/Lesson18)</sup> |
| 与方差的关系 | \(\mathrm{Cov}(X,X) = \mathrm{Var}(X)\)，因此方差是协方差的特例<sup>[2](https://mathworld.wolfram.com/Covariance.html)</sup> |
| 相关性 | \(\rho_{XY} = \mathrm{Cov}(X,Y)/(\sigma_X\sigma_Y)\)，其值恒在 \([-1, 1]\) 之内<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> |
| 样本估计量 | \(\sum_{i=1}^n (X_i-\bar{x})(Y_i-\bar{y})/(n-1)\)，即采用贝塞尔型 \(n-1\) 分母的无偏形式<sup>[4](https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm)</sup> |
| 独立性的注意事项 | 独立变量的协方差为零，但零协方差并不蕴含独立，除非在联合多元正态分布之下<sup>[5](https://www.stat.umn.edu/geyer/5101/slides/s5.pdf)</sup> |
| 宽数据下的失效 | 当集中比 \( c = p/n \) 大于 1 时，样本协方差矩阵是奇异的，无法求逆<sup>[6](https://wires.onlinelibrary.wiley.com/doi/10.1002/wics.70068)</sup> |
| 历史起源 | 弗朗西斯·高尔顿于 1888 年末构想出相关性；卡尔·皮尔逊的公式成为至今仍在使用的标准定义<sup>[7](https://www.jstor.org/stable/2245329?item_view=read_online)</sup><sup> • </sup><sup>[8](https://www.taylorfrancis.com/chapters/oa-mono/10.1201/9781003527893-6/1889-1900-john-nicholas-zorich)</sup> |

## 定义与计算

均值为 \(\mu_X\) 和 \(\mu_Y\) 的两个随机变量 \( X \) 与 \( Y \) 的协方差，是二者中心化值之乘积的期望，即 \(\mathrm{Cov}(X,Y) = E[(X-\mu_X)(Y-\mu_Y)]\)。对于离散变量，这是对 \((x-\mu_X)(y-\mu_Y) f(x,y)\) 在 \((X,Y)\) 的联合支撑上的二重求和；对于连续变量，则是对应的二重积分。<sup>[1](https://online.stat.psu.edu/stat414/Lesson18)</sup> 一个在计算上更简便的等价形式是 \(\mathrm{Cov}(X,Y) = E(XY) - \mu_X\mu_Y\)，它可由期望的线性性推出。<sup>[1](https://online.stat.psu.edu/stat414/Lesson18)</sup>

符号本身承载着解释。当 \(\mathrm{Cov}(X,Y) > 0\) 时，\( Y \) 倾向于随 \( X \) 的增大而增大；当其为负时，\( Y \) 倾向于随 \( X \) 的增大而减小；当其为零时，称这两个变量不相关。<sup>[2](https://mathworld.wolfram.com/Covariance.html)</sup> 令 \( Y = X \) 即得到方差，\(\mathrm{Cov}(X,X) = \sigma_X^2\)，这正是协方差的记号 \(\sigma_{XY}\) 与 \(\sigma_{XX} = \sigma_X^2\) 相一致的原因。<sup>[2](https://mathworld.wolfram.com/Covariance.html)</sup>

## 性质

**对称性与双线性。** 协方差是对称的，\(\mathrm{Cov}(X,Y) = \mathrm{Cov}(Y,X)\)，且对每个自变量都是线性的：\(\mathrm{Cov}(X+Z, Y) = \mathrm{Cov}(X,Y) + \mathrm{Cov}(Z,Y)\)，对于多个变量之和也有相应的二重求和恒等式。<sup>[2](https://mathworld.wolfram.com/Covariance.html)</sup> 正是这种双线性使得协方差代数在涉及随机变量线性组合的推导中得以便利运作。<sup>[9](https://www.tandfonline.com/doi/abs/10.1080/10691898.2001.11910537)</sup>

**和的方差。** 协方差项直接出现在和的方差之中：\(\mathrm{Var}(X+Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) + 2\,\mathrm{Cov}(X,Y)\)。<sup>[2](https://mathworld.wolfram.com/Covariance.html)</sup> 这与 \((a+b)^2 = a^2 + 2ab + b^2\) 是同一模式，它解释了为何相依的分量会给总变异性增添一个交叉项。

**不相关不等于独立。** 例外情形是联合多元正态分布：若 \( Y_1 \) 与 \( Y_2 \) 服从联合多元正态分布，则 \(\mathrm{Cov}(Y_1,Y_2) = 0\) 确实蕴含它们是独立的随机向量。<sup>[5](https://www.stat.umn.edu/geyer/5101/slides/s5.pdf)</sup>

## 相关性与协方差矩阵

由于协方差依赖于变量的单位和尺度，它常被归一化。相关系数将协方差除以标准差之积，\(\rho_{XY} = \mathrm{Cov}(X,Y)/(\sigma_X\sigma_Y)\)，柯西–施瓦茨不等式保证 \(\rho_{XY} \in [-1, 1]\)。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup>

对于均值向量为 \(\mu_{\mathbf{v}}\) 的随机向量 \(\mathbf{v}\)，协方差矩阵为 \(\Sigma_{\mathbf{v}} = E[(\mathbf{v}-\mu_{\mathbf{v}})(\mathbf{v}-\mu_{\mathbf{v}})^T]\)，其第 \((i,j)\) 个元素为 \(\mathrm{Cov}(v_i, v_j)\)。<sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC4393074/)</sup> 在样本数据中，各变量的方差位于主对角线上，两两之间的协方差占据其余位置；方差–协方差矩阵、离散矩阵和协方差矩阵这几个术语可以互换使用。<sup>[4](https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm)</sup>

## 从数据中估计

分析多元数据的第一步是计算均值向量和方差–协方差矩阵。变量 \( X \) 与 \( Y \) 的样本协方差为

\[ \mathrm{COV} = \frac{\sum_{i=1}^n (X_i - \bar{x})(Y_i - \bar{y})}{n-1}, \]

无偏样本协方差矩阵为 \( S = \frac{1}{n-1}\sum_{i=1}^n (X_i - \bar{X})(X_i - \bar{X})' \)。<sup>[4](https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm)</sup> 由于它是从随机数据计算而来，样本协方差本身也是随机的。<sup>[11](https://online.stat.psu.edu/stat505/Lesson01)</sup>

**高维下的失效。** 当变量个数 \( p \) 与观测个数 \( n \) 相当或更大时——这种情形称为宽数据——常规估计便会失效。需要估计的协方差参数个数为 \( p(p-1)/2 \)，而在观测不足时，随机波动会淹没估计值。当 \( c = p/n > 1 \) 时，样本协方差矩阵是奇异的，因而矩阵求逆无定义，且有无穷多个协方差矩阵与一个观测到的样本协方差相一致；早在集中比小得多的时候，不稳定性就已经出现。<sup>[6](https://wires.onlinelibrary.wiley.com/doi/10.1002/wics.70068)</sup>

**收缩与现代估计量。** 主要的补救手段包括阈值化方法、线性与非线性收缩、基于图模型的方法，以及来自随机矩阵理论的技术。<sup>[6](https://wires.onlinelibrary.wiley.com/doi/10.1002/wics.70068)</sup> 收缩将样本协方差与一个结构化的目标相融合，以减小估计误差。<sup>[12](https://www.nature.com/nature-index/topics/l4/covariance-matrix-estimation-techniques-in-high-dimensional-data-analysis)</sup> 向单位矩阵的某个倍数作线性收缩，等价于将样本特征值线性收缩至其总均值，同时保持样本特征向量不变；奥利维耶·勒杜瓦（Olivier Ledoit）与迈克尔·沃尔夫（Michael Wolf）2012 年的非线性收缩对样本特征值施加非线性变换，可以构造得渐近等价于一个 Oracle 估计量，在模拟中相较于样本协方差矩阵和线性收缩均有可观改进。<sup>[13](https://doi.org/10.1214/12-AOS989)</sup> 勒杜瓦与沃尔夫更早的那篇投资组合论文直截了当地点出了实践要点：样本协方差矩阵所含的估计误差，恰恰是最容易扰动均值–方差优化器的那一类，而收缩能系统地减小这一误差。<sup>[14](https://www.ledoit.net/honey_abstract.htm)</sup>

## 在金融中的应用

投资组合理论是协方差估计最突出的使用者。两资产投资组合的风险取决于各资产的比例、它们的标准差以及资产收益之间的相关性（或协方差）；随着资产数量的增长，资产风险之间的相关性成为投资组合风险更为重要的决定因素；将低相关性的资产组合起来可以降低投资组合风险。<sup>[15](https://www.cfainstitute.org/insights/professional-learning/refresher-readings/2026/portfolio-risk-return-part-1)</sup> 用矩阵形式表示，投资组合方差为 \(\sigma_{PF}^2 = w' \Sigma w\)，其中 \( w \) 是投资组合权重向量，\( \Sigma \) 是资产的方差–协方差矩阵，而最小风险权重涉及协方差矩阵的逆 \(\Sigma^{-1}\)。<sup>[16](https://rpc.cfainstitute.org/sites/default/files/docs/research-reports/rf_aiinassetmanagement_02_unsupervisedlearningii_networktheory_online.pdf)</sup><sup> • </sup><sup>[17](https://rpc.cfainstitute.org/-/media/documents/article/rf-brief/investment-model-validation.pdf)</sup> 证券收益的协方差矩阵也被用来建模系统性冲击如何通过投资者网络传导。<sup>[18](https://rpc.cfainstitute.org/research/cfa-digest/2015/01/diversification-and-systemic-risk-digest-summary)</sup>

## 历史

协方差概念是通过相关性的发明而进入统计学的。弗朗西斯·高尔顿（Francis Galton，1822–1911）是查尔斯·达尔文的半血缘表亲，从未担任过学术职位，却在统计学、社会学、心理学和气象学上均有贡献；他于 1888 年末构想出相关性，当时他在自己正在研究的三个科学问题中辨认出了一条共同的线索，并且他是第一个构想出用一个“简单数字”来表达相关关系之密切程度的人。<sup>[7](https://www.jstor.org/stable/2245329?item_view=read_online)</sup><sup> • </sup><sup>[19](https://www.ucl.ac.uk/mathematical-physical-sciences/our-early-history)</sup><sup> • </sup><sup>[20](https://www.tandfonline.com/doi/full/10.1080/00401706.2026.2615597)</sup> 卡尔·皮尔逊（Karl Pearson，1857–1936）于 1911 年在伦敦大学学院创立了世界上第一个大学统计学系，将相关性的数学大大推进，他的公式被证明如此精确，以至于成为最常用的相关性定义，并延续至今。<sup>[8](https://www.taylorfrancis.com/chapters/oa-mono/10.1201/9781003527893-6/1889-1900-john-nicholas-zorich)</sup><sup> • </sup><sup>[19](https://www.ucl.ac.uk/mathematical-physical-sciences/our-early-history)</sup> 高尔顿的线性相关系数起初被科学界所忽视，直到皮尔逊的表述确立之后才被接受。<sup>[8](https://www.taylorfrancis.com/chapters/oa-mono/10.1201/9781003527893-6/1889-1900-john-nicholas-zorich)</sup>

## References

1. [Lesson 18: The Correlation Coefficient, STAT 414, Penn State Eberly College of Science](https://online.stat.psu.edu/stat414/Lesson18)
2. [Covariance, Wolfram MathWorld](https://mathworld.wolfram.com/Covariance.html)
3. [Lecture notes, Advanced Probability, University of Vienna (M. Reitzner)](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)
4. [Mean Vector and Covariance Matrix, NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm)
5. [Uncorrelated versus Independent, lecture slides, University of Minnesota (D. Geyer)](https://www.stat.umn.edu/geyer/5101/slides/s5.pdf)
6. [Raviv (2026). Covariance Estimation for Wide Data. WIREs Computational Statistics](https://wires.onlinelibrary.wiley.com/doi/10.1002/wics.70068)
7. [Stigler, S. M. (1989). Francis Galton's Account of the Invention of Correlation. Statistical Science 4(2), 73–79](https://www.jstor.org/stable/2245329?item_view=read_online)
8. [Zorich, J. N. The History of Correlation, chapter 6: 1889 to 1900, Taylor & Francis (open access)](https://www.taylorfrancis.com/chapters/oa-mono/10.1201/9781003527893-6/1889-1900-john-nicholas-zorich)
9. [Galton, Pearson, and the Peas: A Brief History of Linear Regression for Statistics Instructors, Journal of Statistics Education](https://www.tandfonline.com/doi/abs/10.1080/10691898.2001.11910537)
10. [Nonlinear Dependence in the Discovery of Differentially Expressed Genes, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC4393074/)
11. [Lesson 1: Measures of Central Tendency, Dispersion and Association, STAT 505, Penn State](https://online.stat.psu.edu/stat505/Lesson01)
12. [Covariance Matrix Estimation Techniques in High-Dimensional Data Analysis, Nature Research Intelligence](https://www.nature.com/nature-index/topics/l4/covariance-matrix-estimation-techniques-in-high-dimensional-data-analysis)
13. [Ledoit, O., Wolf, M. (2012). Nonlinear shrinkage estimation of large-dimensional covariance matrices. Annals of Statistics 40(2), 1024–1060](https://doi.org/10.1214/12-AOS989)
14. [Ledoit, O., Wolf, M. (2004). Honey, I Shrunk the Sample Covariance Matrix. Journal of Portfolio Management 30(4), 110–119](https://www.ledoit.net/honey_abstract.htm)
15. [Portfolio Risk and Return: Part I, CFA Institute 2026 Curriculum](https://www.cfainstitute.org/insights/professional-learning/refresher-readings/2026/portfolio-risk-return-part-1)
16. [Unsupervised Learning II: Network Theory, CFA Institute Research Foundation](https://rpc.cfainstitute.org/sites/default/files/docs/research-reports/rf_aiinassetmanagement_02_unsupervisedlearningii_networktheory_online.pdf)
17. [Investment Model Validation, CFA Institute Research Foundation](https://rpc.cfainstitute.org/-/media/documents/article/rf-brief/investment-model-validation.pdf)
18. [Diversification and Systemic Risk, CFA Institute Digest Summary (2015)](https://rpc.cfainstitute.org/research/cfa-digest/2015/01/diversification-and-systemic-risk-digest-summary)
19. [Our Early History, UCL Faculty of Mathematical & Physical Sciences](https://www.ucl.ac.uk/mathematical-physical-sciences/our-early-history)
20. [The History of Correlation, Taylor & Francis (book review, open access)](https://www.tandfonline.com/doi/full/10.1080/00401706.2026.2615597)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Random variables › Exchangeability, independence, and Gaussian structure › Uncorrelatedness and covariance structure

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/covariance

English original: https://www.edgepedia.org/covariance
