# 全期望公式

全期望公式是概率论的一个定理，它表明随机变量的期望值等于在样本空间的任意划分的事件条件下，其条件期望值的概率加权平均。其紧凑形式为 \( \mathbf{E}[X] = \mathbf{E}[\mathbf{E}[X \mid Y]] \)，也被称为迭代期望公式、塔性质，或非正式地称为亚当公式。<sup>[1](https://statproofbook.github.io/P/mean-tot.html)</sup><sup> • </sup><sup>[2](https://www.stat.berkeley.edu/~aditya/resources/AllLectures2018Fall201A.pdf)</sup>

| 关键事实 | 细节 |
|---|---|
| 事件形式 | 对于构成划分且 \( \mathbf{P}(A_i) > 0 \) 的互斥事件 \( A_1, \ldots, A_n \)：\( \mathbf{E}[X] = \sum_{i=1}^{n} \mathbf{P}(A_i)\,\mathbf{E}[X \mid A_i] \)<sup>[3](https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/d973b10c2587781f86ca4f2aff49098f_MITRES_6_012S18_Textbook.pdf)</sup> |
| 随机变量形式（离散） | \( \mathbf{E}[X] = \sum_{y} \mathbf{E}[X \mid Y=y]\, p_Y(y) \)<sup>[4](https://probability4datascience.com/eBook/ch05-4.html)</sup> |
| 随机变量形式（连续） | \( \mathbf{E}[X] = \int_{-\infty}^{\infty} \mathbf{E}[X \mid Y=y]\, f_Y(y)\, dy \)<sup>[3](https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/d973b10c2587781f86ca4f2aff49098f_MITRES_6_012S18_Textbook.pdf)</sup> |
| 紧凑形式 | \( \mathbf{E}[X] = \mathbf{E}[\mathbf{E}[X \mid Y]] \)，即迭代期望公式<sup>[1](https://statproofbook.github.io/P/mean-tot.html)</sup> |
| 测度论形式 | 对于可积的 \( Y \) 和任意子 \( \sigma \)-代数 \( \mathcal{G} \)：\( \mathbf{E}[\mathbf{E}[Y \mid \mathcal{G}]] = \mathbf{E}[Y] \)<sup>[5](https://choxos.github.io/Mathematics-of-ITC/chapters/part1/04-probability.html)</sup> |
| 塔性质 | 对于 \( \mathcal{H} \subseteq \mathcal{G} \)：\( \mathbf{E}[\mathbf{E}[X \mid \mathcal{G}] \mid \mathcal{H}] = \mathbf{E}[X \mid \mathcal{H}] \) 几乎必然成立<sup>[6](https://math.berkeley.edu/~ltomczak/notes/Mich2022/AdvProb_Notes.pdf)</sup> |
| 伴随结果 | 全方差公式 \( \mathrm{Var}(X) = \mathbf{E}[\mathrm{Var}(X \mid Y)] + \mathrm{Var}(\mathbf{E}[X \mid Y]) \) 可利用全期望公式证明<sup>[7](https://agdenadel.github.io/Law-of-Total-Variance/)</sup> |

## 陈述与形式

该定理有三种等价形式。事件形式适用于 \( A_1, A_2, \ldots, A_n \) 是构成样本空间划分且每个事件概率为正的互斥事件的情形；此时总期望是各条件期望之和，每一项以其条件事件的概率加权。<sup>[3](https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/d973b10c2587781f86ca4f2aff49098f_MITRES_6_012S18_Textbook.pdf)</sup> 随机变量形式用随机变量 \( Y \) 的取值替代划分：对于离散的 \( Y \)，\( \mathbf{E}[X] = \sum_{y} \mathbf{E}[X \mid Y=y]\, p_Y(y) \)；对于联合连续的 \( X \) 和 \( Y \)，求和变为以密度 \( f_Y(y) \) 加权的积分。<sup>[4](https://probability4datascience.com/eBook/ch05-4.html)</sup><sup> • </sup><sup>[3](https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/d973b10c2587781f86ca4f2aff49098f_MITRES_6_012S18_Textbook.pdf)</sup>

紧凑形式将 \( \mathbf{E}[X \mid Y=y] \) 视为函数 \( h(y) \) 并作用于随机变量 \( Y \)，产生新的随机变量 \( \mathbf{E}[X \mid Y] = h(Y) \)。对其关于 \( Y \) 取期望即恢复 \( \mathbf{E}[X] \)，因此该公式写作 \( \mathbf{E}[X] = \mathbf{E}[\mathbf{E}[X \mid Y]] \)。<sup>[2](https://www.stat.berkeley.edu/~aditya/resources/AllLectures2018Fall201A.pdf)</sup><sup> • </sup><sup>[8](https://courses.cs.washington.edu/courses/cse312/26sp/files/sections/section9/section9.html)</sup> 由于右侧出现两层嵌套的期望，该结果也被称为迭代期望公式。<sup>[2](https://www.stat.berkeley.edu/~aditya/resources/AllLectures2018Fall201A.pdf)</sup>

在测度论概率中，给定子 \( \sigma \)-代数 \( \mathcal{G} \) 的条件期望是基本对象，该公式表述为：对任意可积的 \( Y \)，有 \( \mathbf{E}[\mathbf{E}[Y \mid \mathcal{G}]] = \mathbf{E}[Y] \)。<sup>[5](https://choxos.github.io/Mathematics-of-ITC/chapters/part1/04-probability.html)</sup>

## 证明思路

离散情形的证明是全概率公式的直接应用。将边缘概率写成联合概率之和，\( p_X(x) = \sum_y p_{X \mid Y}(x \mid y)\, p_Y(y) \)，代入 \( \mathbf{E}[X] \) 的定义得

\[ \mathbf{E}[X] = \sum_x x \sum_y p_{X \mid Y}(x \mid y)\, p_Y(y) = \sum_y \left( \sum_x x\, p_{X \mid Y}(x \mid y) \right) p_Y(y) = \sum_y \mathbf{E}[X \mid Y=y]\, p_Y(y). \]

连续情形只需将求和换为积分。<sup>[4](https://probability4datascience.com/eBook/ch05-4.html)</sup> 等价地，该公式可作为全概率公式应用于密度的推论来证明：\( f_Y(y) = \int f_{Y \mid X=x}(y) f_X(x)\, dx \)，交换积分次序即得 \( \mathbf{E}[Y] = \int \mathbf{E}[Y \mid X=x]\, f_X(x)\, dx \)。<sup>[2](https://www.stat.berkeley.edu/~aditya/resources/AllLectures2018Fall201A.pdf)</sup>

## 塔性质

该公式可推广到对两层信息进行嵌套条件化的情形。若 \( \mathcal{H} \subseteq \mathcal{G} \subseteq \mathcal{F} \) 为子 \( \sigma \)-代数，则

\[ \mathbf{E}[\mathbf{E}[X \mid \mathcal{G}] \mid \mathcal{H}] = \mathbf{E}[X \mid \mathcal{H}] \quad \text{a.s.} \]

且以另一顺序条件化得到相同值。只有最小的 \( \sigma \)-代数起作用：一旦随机性在较粗的信息集上被平均掉，更细的条件化无法将其恢复。<sup>[6](https://math.berkeley.edu/~ltomczak/notes/Mich2022/AdvProb_Notes.pdf)</sup><sup> • </sup><sup>[9](https://keesvs.net/UoM/teaching/martingales/notes/Chapter4.html)</sup> 取 \( \mathcal{H} \) 为平凡 \( \sigma \)-代数 \( \{\emptyset, \Omega\} \) 即得到全期望公式作为特例。<sup>[9](https://keesvs.net/UoM/teaching/martingales/notes/Chapter4.html)</sup>

两个平凡情形为直觉提供锚点：若 \( X \) 与 \( \mathcal{G} \) 独立，则 \( \mathbf{E}[X \mid \mathcal{G}] = \mathbf{E}[X] \)；若 \( X \) 是 \( \mathcal{G} \)-可测的，则 \( \mathbf{E}[X \mid \mathcal{G}] = X \)。<sup>[9](https://keesvs.net/UoM/teaching/martingales/notes/Chapter4.html)</sup>

## 为何有用

该公式是一条分解规则：它将困难的期望拆分为更小、更易处理的条件期望，并以条件化情形的概率对其加权平均。<sup>[4](https://probability4datascience.com/eBook/ch05-4.html)</sup> 教科书将其作为将复杂计算分解为简单情形的标准方法，即计算每种情形下的条件期望并按情形概率加权。<sup>[10](https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/93cad640cf3ed0b23ef70688f452d4d5_MIT6_042JF10_notes.pdf)</sup> 一个经典例子是以性别为条件考察人的身高：若某人群中49.8%为男性，则总体期望身高为0.498乘以男性条件均值加上相应的女性项。<sup>[10](https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/93cad640cf3ed0b23ef70688f452d4d5_MIT6_042JF10_notes.pdf)</sup> 同样的结构可处理递归情形，如几何实验中期望试验次数，对第一次试验结果条件化会产生一个方程，该公式使其得以闭合。<sup>[11](https://www.probabilitycourse.com/chapter5/5_1_3_conditioning_independence.php)</sup>

该公式也是将条件均值解释为预测的基础。函数 \( \mathbf{E}[X \mid Y] \) 是在均方意义下由 \( Y \) 预测 \( X \) 的最佳可能预测器，这正是回归关涉条件均值的原因。<sup>[12](https://calc-path.com/probability/modules/expectation)</sup> 在计量经济学中，迭代期望公式用于证明与条件化变量正交的回归扰动具有零无条件均值，从而使线性投影系数呈现其熟悉的形式。<sup>[13](https://people.stern.nyu.edu/wgreene/Econometrics/Econometrics-I-2.pdf)</sup>

**相关恒等式。** 全方差公式将方差分解为组内部分和组间部分，其证明利用全期望公式及条件方差的定义。<sup>[7](https://agdenadel.github.io/Law-of-Total-Variance/)</sup> 在贝叶斯统计中，全方差公式为分层模型中的后验预测方差生成替代表达式，而该方差在各表达式间的不变性可作为计算的守恒检验。<sup>[14](https://arxiv.org/abs/2406.11806)</sup>

## 名称

该定理在文献中有许多名称：全期望公式、迭代期望公式、全期望定理和塔性质。<sup>[1](https://statproofbook.github.io/P/mean-tot.html)</sup><sup> • </sup><sup>[15](https://proofwiki.org/wiki/Total_Expectation_Theorem)</sup> 在广受欢迎的哈佛统计110课程传统中，它被称为亚当公式；据哈佛大学统计学实践教授乔·布利茨斯坦（Joe Blitzstein）所述，该名称可追溯至伯克利统计系创始人耶日·奈曼（Jerzy Neyman）。<sup>[16](https://math.stackexchange.com/questions/4857382/lotus-and-adams-law-nomenclature)</sup>

## 在因果推断中的应用

当因果一致性、正值性和条件可交换性成立时，迭代期望公式可重述为g公式——因果推断的标准化公式——以两种在无参数假设下等价的方式表达：NICE版本使用条件结果均值的一个加权平均，ICE版本则由相互嵌套的期望构建。<sup>[17](https://arxiv.org/abs/2606.20078)</sup>

## References

1. [Proof: Law of total expectation, The Book of Statistical Proofs](https://statproofbook.github.io/P/mean-tot.html)
2. [Statistics 201A lecture notes, University of California, Berkeley](https://www.stat.berkeley.edu/~aditya/resources/AllLectures2018Fall201A.pdf)
3. [Introduction to Probability (Bertsekas and Tsitsiklis), textbook summary, MIT OpenCourseWare](https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/d973b10c2587781f86ca4f2aff49098f_MITRES_6_012S18_Textbook.pdf)
4. [Introduction to Probability for Data Science, Section 5.4](https://probability4datascience.com/eBook/ch05-4.html)
5. [The Mathematics of Indirect Treatment Comparisons, Chapter 4](https://choxos.github.io/Mathematics-of-ITC/chapters/part1/04-probability.html)
6. [Advanced Probability lecture notes, UC Berkeley](https://math.berkeley.edu/~ltomczak/notes/Mich2022/AdvProb_Notes.pdf)
7. [Law of Total Variance, A. DenAdel](https://agdenadel.github.io/Law-of-Total-Variance/)
8. [CSE 312 Section 9, University of Washington](https://courses.cs.washington.edu/courses/cse312/26sp/files/sections/section9/section9.html)
9. [Conditional expectation, MATH4/67201 Martingale Theory notes](https://keesvs.net/UoM/teaching/martingales/notes/Chapter4.html)
10. [Mathematics for Computer Science (6.042J) course notes, MIT OpenCourseWare](https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/93cad640cf3ed0b23ef70688f452d4d5_MIT6_042JF10_notes.pdf)
11. [Conditioning, Independence, CDF, ProbabilityCourse.com](https://www.probabilitycourse.com/chapter5/5_1_3_conditioning_independence.php)
12. [Probability: Expectation, Covariance and Conditional Expectation](https://calc-path.com/probability/modules/expectation)
13. [Econometrics I, W. Greene, NYU Stern](https://people.stern.nyu.edu/wgreene/Econometrics/Econometrics-I-2.pdf)
14. [A conservation law for posterior predictive variance, arXiv](https://arxiv.org/abs/2406.11806)
15. [Total Expectation Theorem, ProofWiki](https://proofwiki.org/wiki/Total_Expectation_Theorem)
16. [LOTUS and Adam's Law nomenclature, Mathematics Stack Exchange](https://math.stackexchange.com/questions/4857382/lotus-and-adams-law-nomenclature)
17. [A Law of Iterated Expectation Primer for Causal Inference, arXiv](https://arxiv.org/abs/2606.20078)

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

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Expectation, moments, and inequalities › Laws and rules of expectation

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/law-of-total-expectation

English original: https://www.edgepedia.org/law-of-total-expectation
