# 条件方差

**条件方差**是在条件分布下计算的一个随机变量的方差，也就是说，在另一个随机变量（或更一般地，某些信息）的值已知之后，一个随机变量围绕其条件均值的离散程度。对于平方可积随机变量 \( X \) 和条件变量 \( Y \)，它写作 \( \mathrm{Var}(X \mid Y) \)，本身也是一个随机变量：每当 \( Y=y \) 时，它取值 \( \mathrm{Var}(X \mid Y=y) \)。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | \( \mathrm{Var}(X \mid Y) = \mathrm{E}[(X - \mathrm{E}[X \mid Y])^2 \mid Y] = \mathrm{E}[X^2 \mid Y] - (\mathrm{E}[X \mid Y])^2 \)<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup> |
| 离散情形 | \( \sigma^2_{Y\mid x} = \sum_y [y - \mu_{Y\mid x}]^2\, h(y\mid x) \)，即用条件概率质量函数替代边缘概率质量函数的普通方差公式<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup> |
| 全方差定律 | \( \mathrm{Var}(X) = \mathrm{E}[\mathrm{Var}(X \mid Y)] + \mathrm{Var}(\mathrm{E}[X \mid Y]) \)，也称为条件方差公式<sup>[4](https://statproofbook.github.io/P/var-tot.html)</sup> |
| 方差缩减 | 分解中的各项均非负，因此 \( \mathrm{Var}(X) \ge \mathrm{E}[\mathrm{Var}(X \mid Y)] \)：平均而言，条件化会降低方差<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> |
| 可加性 | 若 \( X \) 和 \( Z \) 是 \( L^2 \) 中的独立随机变量，则 \( \mathrm{Var}[X+Z \mid Y] = \mathrm{Var}[X \mid Y] + \mathrm{Var}[Z \mid Y] \) 未必成立；一般而言，\( \mathrm{Var}(X+Z \mid Y) = \mathrm{Var}(X \mid Y) + \mathrm{Var}(Z \mid Y) + 2\mathrm{Cov}(X, Z \mid Y) \)，所以仅凭 \( X \) 与 \( Z \) 独立并不能确保条件协方差为零<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup><sup> • </sup><sup>[13](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)</sup> |
| 几何意义 | 对于 \( X \in L^2 \)，\( \mathrm{E}[X \mid \mathcal{G}] \) 是 \( X \) 到 \( \mathcal{G} \)-可测随机变量子空间上的正交投影，而条件方差是 \( X \) 到该投影的平方距离<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup> |

## 定义

对于离散随机变量 \( X \) 和 \( Y \)，给定 \( X=x \) 时 \( Y \) 的条件方差用条件概率质量函数 \( h(y\mid x) \) 代替边缘概率质量函数来定义：<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup>

\[ \sigma^2_{Y\mid x} = \mathrm{E}\{[Y - \mu_{Y\mid x}]^2 \mid x\} = \sum_y [y - \mu_{Y\mid x}]^2\, h(y\mid x), \]

其中 \( \mu_{Y\mid x} = \mathrm{E}[Y \mid x] \)。通常的简捷公式原样沿用：

\[ \sigma^2_{Y\mid x} = \mathrm{E}[Y^2 \mid x] - \mu_{Y\mid x}^2. \]<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup>

在一般测度论框架中，对于 \( X \in L^2 \) 和任意随机变量 \( Y \)，条件方差通过条件期望来定义：<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup>

\[ \mathrm{Var}[X \mid Y] = \mathrm{E}\big[(X - \mathrm{E}[X \mid Y])^2 \,\big|\, Y\big]. \]

由于 \( \mathrm{E}[X \mid Y] \) 是随机变量（\( Y \) 的函数），条件方差也是随机变量。若 \( Y \) 取值 \( y_1, y_2, \ldots \)，则 \( \mathrm{Var}(X \mid Y) \) 以概率 \( P(Y=y_j) \) 等于 \( \mathrm{Var}(X \mid Y=y_j) \)，并且它自身也有分布、均值和方差。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> 条件期望本身是相对于 σ-代数 \( \mathcal{G} \) 定义的，\( \mathcal{G} \) 是其发生与否已由可得信息确定的事件族；对随机变量 \( Y \) 取条件，意味着对它生成的 σ-代数取条件。<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup>

## 全方差定律

联系条件方差与无条件方差的核心结果，是全方差定律，也称为条件方差公式。对于同一概率空间上的随机变量 \( X \) 和 \( Y \)，其中 \( X \) 的方差有限，<sup>[4](https://statproofbook.github.io/P/var-tot.html)</sup>

\[ \mathrm{Var}(X) = \mathrm{E}\big[\mathrm{Var}(X \mid Y)\big] + \mathrm{Var}\big(\mathrm{E}[X \mid Y]\big). \]

证明只用到方差的定义和全期望定律（塔性质 \( \mathrm{E}[X] = \mathrm{E}[\mathrm{E}[X \mid Y]] \)）。令 \( Z = \mathrm{E}[X \mid Y] \)，则有 \( \mathrm{E}[\mathrm{Var}(X \mid Y)] = \mathrm{E}[X^2] - \mathrm{E}[Z^2] \) 以及 \( \mathrm{Var}(Z) = \mathrm{E}[Z^2] - (\mathrm{E}[X])^2 \)；将两个恒等式相加即得结果。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup><sup> • </sup><sup>[6](https://faculty.washington.edu/yenchic/20A_stat512/Lec4_conditional.html)</sup>

当总体被划分为若干组时，这两项有直接的解释。假设 \( X \) 是随机选取一个人的身高，而 \( Y \) 标记此人所属国家。那么 \( \mathrm{E}[\mathrm{Var}(X \mid Y)] \) 是各国身高方差的平均值，而 \( \mathrm{Var}(\mathrm{E}[X \mid Y]) \) 是各国平均身高之间的方差。总变异性分解为组内和组间两部分。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> 在计量经济学中，同一分解被描述为组内方差和组间方差；若 \( X \) 是教育水平，第一项是教育水平内条件方差的期望，第二项是教育水平均值的方差。<sup>[7](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)</sup>

由于方差非负，该定律蕴含 \( \mathrm{Var}(X) \ge \mathrm{E}[\mathrm{Var}(X \mid Y)] \)：平均而言，知道 \( Y \) 会减少关于 \( X \) 的不确定性。两端之差 \( \mathrm{Var}(\mathrm{E}[X \mid Y]) \) 衡量条件变量通过条件均值的移动解释了多少变异性。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

## 性质

由于条件期望是一个投影，条件方差继承普通方差的性质。对于 \( L^2 \) 中的独立随机变量 \( X \) 和 \( Z \)，恒等式 \( \mathrm{Var}[X+Z \mid Y] = \mathrm{Var}[X \mid Y] + \mathrm{Var}[Z \mid Y] \) 成立当且仅当条件协方差 \( \mathrm{Cov}[X,Z \mid Y] \) 为零，因为一般而言差值等于该协方差的两倍；仅凭 \( X \) 与 \( Z \) 独立并不能保证这一点。<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup><sup> • </sup><sup>[13](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)</sup> 若 \( X \) 与 \( Y \) 独立，则给定 \( Y \) 时 \( X \) 的条件分布等于边缘分布，因此 \( \mathrm{E}[X \mid Y] = \mathrm{E}[X] \) 且 \( \mathrm{Var}(X \mid Y) = \mathrm{Var}(X) \)；对独立变量取条件不会消除任何东西。<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

投影视角使几何意义变得明确。对于 \( X \in L^2 \)，\( \mathrm{E}[X \mid \mathcal{G}] \) 是 \( X \) 到 \( \mathcal{G} \)-可测随机变量闭子空间上的正交投影，并且是在此类 \( Z \) 上 \( \mathrm{E}[(X - Z)^2] \) 的唯一极小值点。<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup> 条件方差 \( \mathrm{E}[\mathrm{Var}(X \mid \mathcal{G})] \) 则是这种最佳近似后剩余的均方距离，这就是为什么 \( \mathrm{E}[X \mid Y] \) 被称为以 \( Y \) 的函数形式给出的对 \( X \) 的最佳预测器。<sup>[8](https://arxiv.org/abs/2210.02859)</sup>

## 在统计学和计量经济学中的应用

**回归。** 在条件均值函数为 \( m(X) \)、误差 \( e \) 满足 \( \mathrm{E}[e \mid X] = 0 \) 的回归中，无条件误差方差等于平均条件方差，\( \sigma^2 = \mathrm{E}[\sigma^2(X)] \)。用 \( \sigma(X) \) 表示条件标准差，得到均值-方差表示 \( Y = m(X) + \sigma(X)u \)，其中重新缩放后的误差 \( u = e/\sigma(X) \) 的条件均值为零、条件方差为一。<sup>[7](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)</sup>

**树与方差分析。** 回归树在叶节点处的预测是条件期望 \( \mathrm{E}[Y \mid X \in \text{区域}] \)，用于选择分裂的方差缩减应用全方差定律，将总方差分解为叶内和叶间两部分。<sup>[9](https://mindspaneducation.com/learn/probability-and-statistics/conditional-expectation/)</sup> 方差分析以样本形式使用同一分解：总平方和恰好分解为组内平方和与组间平方和，因为每组的组内偏差之和为零，所以交叉项抵消。<sup>[10](https://courses.washington.edu/psy524a/_book/anova-part-2-partitioning-sums-of-squares.html)</sup>

**波动率建模。** 在金融时间序列中，ARCH 和 GARCH 模型为每一期指定显式的条件方差方程，因此方差本身作为过去信息的函数随时间演化。来自 GARCH 模型的风险价值预测结合条件均值、条件波动率和标准化残差的分位数。<sup>[11](https://arch.readthedocs.io/en/stable/univariate/univariate_volatility_forecasting.html)</sup>

**检验近似推断。** 全方差定律也用作诊断工具：它精确联系先验与后验的均值和协方差，因此可以通过检查所需关系是否成立来评估和调整近似推断算法。<sup>[12](https://arxiv.org/abs/1911.08725)</sup>

## References

1. [Conditional Expectation (Revisited) and Conditional Variance, ProbabilityCourse.com](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)
2. [O. Knill, Probability Theory and Stochastic Processes, Chapter 3.1: Conditional Expectation](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)
3. [STAT 414, Lesson 19: Conditional Distributions, Penn State Eberly College of Science](https://online.stat.psu.edu/stat414/Lesson19)
4. [Law of Total Variance, The Book of Statistical Proofs](https://statproofbook.github.io/P/var-tot.html)
5. [J. A. Tropp, Probability Theory & Stochastic Processes, Caltech CMS 117 Lecture Notes, Lecture 19](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)
6. [STAT 512 Lecture 4: Conditional expectation and conditional distribution, University of Washington](https://faculty.washington.edu/yenchic/20A_stat512/Lec4_conditional.html)
7. [B. Hansen, Econometrics, Chapter 2: Conditional Expectation and Projection](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)
8. [On the new properties of conditional expectations with applications in finance, arXiv:2210.02859](https://arxiv.org/abs/2210.02859)
9. [Conditional Expectation & Variance, MindSpan Education GATE notes](https://mindspaneducation.com/learn/probability-and-statistics/conditional-expectation/)
10. [Chapter 17: ANOVA Part 2, Partitioning Sums of Squares, University of Washington](https://courses.washington.edu/psy524a/_book/anova-part-2-partitioning-sums-of-squares.html)
11. [Volatility Forecasting, arch 7.2.0 documentation](https://arch.readthedocs.io/en/stable/univariate/univariate_volatility_forecasting.html)
12. [Assessment and adjustment of approximate inference algorithms using the law of total variance, arXiv:1911.08725](https://arxiv.org/abs/1911.08725)
13. [4.7: Conditional Expected Value](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Random variables › Algebra and transformations of random variables › Conditional expectation and conditional random variables

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/conditional-variance

English original: https://www.edgepedia.org/conditional-variance
