# Conditional expectation

In probability theory, the conditional expectation of a random variable is another random variable equal to the average of the former over each possible "condition". In the case when the random variable is defined over a discrete probability space, the "conditions" are a partition of this probability space. This definition is then generalized to any probability space using measure theory.

Conditional expectation is also known as conditional expected value or conditional mean.

In modern probability theory the concept of conditional probability is defined in terms of conditional expectation.

## Concept

The concept of conditional probability can be nicely illustrated through the following example. Suppose we have daily rainfall data (mm of rain each day) collected by a weather station on every day of the ten year period from Jan 1, 1990 to Dec 31, 1999. The conditional expectation of daily rainfall knowing the month of the year is the average of daily rainfall over all days of the ten year period that fall in a given month. These data then may be considered either as a function of each day (so for example its value for Mar 3, 1992, would be the sum of daily rainfalls on all days that are in the month of March during the ten years, divided by the number of these days, which is 310) or as a function of just the month (so for example the value for March would be equal to the value of the previous example).

It is important to note the following.

• The conditional expectation of daily rainfall knowing that we are in a month of March of the given ten years is not a monthly rainfall data, that is it is not the average of the ten monthly total March rainfalls. That number would be 31 times higher.
• The average daily rainfall in March 1992 is not equal to the conditional expectation of daily rainfall knowing that we are in a month of March of the given ten years, because we have restricted ourselves to 1992, that is we have more conditions than just that of being in March. This shows that reasoning as "we are in March 1992, so I know we are in March, so the average daily rainfall is the March average daily rainfall" is incorrect. Stated differently, although we use the expression "conditional expectation knowing that we are in March" this really means "conditional expectation knowing nothing other than that we are in March".

## History

The related concept of conditional probability dates back at least to Laplace who calculated conditional distributions. It was Andrey Kolmogorov who in 1933 formalized it using the Radon–Nikodym theorem.[1] In works of Paul Halmos 1950[2] and Joseph L. Doob 1953[3] conditional expectation was generalized to its now usual definition using sub-sigma-algebras.[4]

## Classical definition

### Conditional expectation with respect to an event

In classical probability theory the conditional expectation of X given an event H (which may be the event Y=y for a random variable Y) is the average of X over all outcomes in H, that is

$\operatorname{E} (X \mid H ) = \frac{\sum_{\omega \in H} X(\omega)}{|H|}$

The sum above can be grouped by different values of $\scriptstyle X(\omega)$, to get a sum over the range $\scriptstyle \mathcal{X}$ of X

$\operatorname{E} (X \mid H ) = \sum_{x\in\mathcal{X}} x \, \frac{|\{\omega \in H \mid X(\omega) = x\}|}{|H|}$

In modern probability theory, when H is an event with strictly positive probability, it is possible to give a similar formula. This is notably the case for a discrete random variable Y and for y in the range of Y if the event H is Y=y. Let $\scriptstyle (\Omega, \mathcal{F}, P)$ be a probability space, X a random variable on that probability space, and $\scriptstyle H \in \mathcal{F}$ an event with strictly positive probability $\scriptstyle P(H) > 0$. Then the conditional expectation of X given the event H is

$\operatorname{E} (X \mid H) = \frac{\operatorname{E}(1_H X)}{\operatorname{P}(H)} = \int_{x\in\mathcal{X}} x \operatorname{P}(dx \mid H),$

where $\scriptstyle \mathcal{X}$ is the range of X and $\operatorname{P}(A \mid H) = \frac{\operatorname{P}(A \cap H)}{\operatorname{P}(H)}$ is the conditional probability of A knowing H.

When P(H) = 0 (for instance if Y is a continuous random variable and H is the event Y=y, this is in general the case), the Borel–Kolmogorov paradox demonstrates the ambiguity of attempting to define the conditional probability knowing the event H. The above formula shows that this problem transposes to the conditional expectation. So instead one only defines the conditional expectation with respect to a sigma-algebra or a random variable.

### Conditional expectation with respect to a random variable

If Y is a discrete random variable with range $\scriptstyle \mathcal{Y}$, then we can define on $\scriptstyle \mathcal{Y}$ the function

$g: y \mapsto \operatorname{E} (X \mid Y=y ).$

Sometimes this function is called the conditional expectation of X with respect to Y. In fact, according to the modern definition, it is $\scriptstyle g \circ Y$ that is called the conditional expectation of X with respect to Y, so that we have

$\operatorname{E} (X \mid Y): \omega \mapsto \operatorname{E} (X \mid Y=Y(\omega)).$

which is a random variable.

As mentioned above, if Y is a continuous random variable, it is not possible to define $\scriptstyle \operatorname{E} (X \mid Y)$ by this method. As explained in the Borel–Kolmogorov paradox, we have to specify what limiting procedure produces the set Y = y. This can be naturally done by defining the set $\scriptstyle H_y^\epsilon = \{ \omega \mid \|Y(\omega)-y\| < \epsilon \}$, and taking the limit $\scriptstyle \epsilon \to 0$, so that if $\scriptstyle P(H_y^\epsilon) > 0$ for all $\scriptstyle \epsilon > 0$, then

$g: y \mapsto \lim_{\epsilon \to 0}\operatorname{E} (X \mid H_y^\varepsilon )$.

The modern definition is analogous to the above except that the above limiting process is replaced by the Radon–Nikodym derivative, so the result holds more generally.

## Formal definition

### Conditional expectation with respect to a σ-algebra

Conditional expectation with respect to a sigma-algebra: in this example the probability space $\scriptstyle (\Omega, \mathcal {F}, \operatorname {P} )$ is the [0,1] interval with the Lebesgue measure. We define the following σ-algebras: $\scriptstyle \mathcal{A} = \mathcal{F}$ while $\scriptstyle \mathcal{B}$ is the σ-algebra generated by the intervals with end-points 0, ¼, ½, ¾, 1 and $\scriptstyle \mathcal{C}$ is the σ-algebra generated by the intervals with end-points 0, ½, 1. Here the conditional expectation is effectively the average over the minimal sets of the σ-algebra.

Consider the following

• $\scriptstyle (\Omega, \mathcal {F}, \operatorname {P} )$ is a probability space
• $\scriptstyle X:\Omega \to \mathbb{R}^n$ is a random variable on that probability space
• $\scriptstyle \mathcal {H} \subseteq \mathcal {F}$ is a sub-σ-algebra of $\scriptstyle \mathcal {F}$

Then a conditional expectation of X given $\scriptstyle \mathcal {H}$, denoted as $\scriptstyle \operatorname{E}(X\mid\mathcal {H})$, is any $\scriptstyle \mathcal {H}$-measurable function ($\scriptstyle \Omega \to \mathbb{R}^n$) which satisfies:

$\int_H \operatorname{E}(X \mid \mathcal{H}) \; dP_{|\mathcal{H}} = \int_H X \; dP \qquad \text{for each} \quad H \in \mathcal{H}$.[5]

The existence of $\scriptstyle \operatorname{E}(X\mid\mathcal {H})$ can be established by noting that $\scriptstyle \mu^X: F \mapsto \int_F X$ for $\scriptstyle F \in \mathcal{F}$is a measure on $\scriptstyle (\Omega, \mathcal {F})$ that is absolutely continuous with respect to $\scriptstyle P$. Furthermore, if $\scriptstyle h$ is the natural injection from $\scriptstyle \mathcal {H}$ to $\scriptstyle \mathcal {F}$ then $\scriptstyle \mu^X \circ h = \mu^X_{|\mathcal{H}}$ is the restriction of $\scriptstyle \mu^X$ to $\scriptstyle \mathcal{H}$ and $\scriptstyle P \circ h = P_{|\mathcal{H}}$ is the restriction of $\scriptstyle P$ to $\scriptstyle \mathcal {H}$ and $\scriptstyle \mu^X \circ h$ is absolutely continuous with respect to $\scriptstyle P \circ h$ since $\scriptstyle P \circ h (H) = 0 \Leftrightarrow P(h(H)) = 0 \Rightarrow \mu^X(h(H)) = 0 \Leftrightarrow \mu^X \circ h(H) = 0$. Thus, we have

$\operatorname{E}(X\mid\mathcal {H}) = \frac{d\mu^X_{|\mathcal{H}}}{dP_{|\mathcal{H}}} = \frac{d(\mu^X \circ h)}{d(P \circ h)}$

where the derivatives are Radon–Nikodym derivatives of measures.

### Conditional expectation with respect to a random variable

Consider further to the above

• $\scriptstyle (U, \Sigma)$ is a measurable space
• $\scriptstyle Y:\Omega \to U$ is a random variable

Then for any $\scriptstyle \Sigma$-measurable function $\scriptstyle g: U \to \mathbb{R}^n$ which satisfies:

$\int g(Y) f(Y) = \int X f(Y) \qquad \text{for every }\Sigma\text{-measurable function} \quad f:U \to \mathbb{R}^n$.

the random variable $\scriptstyle g(Y)$, denoted as $\scriptstyle \operatorname{E}(X\mid Y)$, is a conditional expectation of X given $\scriptstyle Y$.

This definition is equivalent to defining the conditional expectation using the pre-image of Σ with respect to Y. If we define

$\mathcal {H} = \sigma(Y) := Y^{-1}\left(\Sigma\right) := \{Y^{-1}(B) : B \in \Sigma \}$

then

$\operatorname{E}(X\mid Y) = \operatorname{E}(X\mid\mathcal {H}) = \frac{d(\mu^X \circ Y^{-1})}{d(P \circ Y^{-1})} \circ Y$.

### Discussion

A couple of points worth noting about the definition:

• This is not a constructive definition; we are merely given the required property that a conditional expectation must satisfy.
• The definition of $\scriptstyle \operatorname{E}(X \mid \mathcal{H})$ may resemble that of $\scriptstyle \operatorname{E}(X \mid H)$ but these are very different objects, the former being a $\scriptstyle \mathcal {H}$-measurable function $\scriptstyle \Omega \to \mathbb{R}^n$, while the latter is an element of $\scriptstyle \mathbb{R}^n$ for fixed $\scriptstyle H$, or a function $\scriptstyle \mathcal {F} \to \mathbb{R}^n$ if considered as the function $\scriptstyle H \mapsto \operatorname{E}(X \mid H)$.
• Existence of a conditional expectation function is determined by the Radon–Nikodym theorem, a sufficient condition is that the (unconditional) expected value for X exist.
• Uniqueness can be shown to be almost sure: that is, versions of the same conditional expectation will only differ on a set of probability zero.
• The σ-algebra $\scriptstyle \mathcal {H}$ controls the "granularity" of the conditioning. A conditional expectation $\scriptstyle{E}(X\mid\mathcal {H})$ over a finer-grained σ-algebra $\scriptstyle \mathcal {H}$ will allow us to condition on a wider variety of events.

## Conditioning as factorization

In the definition of conditional expectation that we provided above, the fact that $Y$ is a real random element is irrelevant. Let $(U, \Sigma)$ be a measurable space, where $\Sigma \subset \mathcal{P}(U)$ is a σ-algebra in $U$. A $U$-valued random element is a measurable function $Y\colon \Omega \to U$, i.e. $Y^{-1}(B)\in \mathcal F$ for all $B\in \Sigma$. The distribution of $Y$ is the probability measure $\mathbb{P}_Y : \Sigma \to \mathbb{R}$ such that $\mathbb{P}_Y(B) = \mathbb{P}(Y^{-1}(B))$.

Theorem. If $X : \Omega \to \mathbb{R}$ is an integrable random variable, then there exists a $\mathbb{P}_Y$-unique integrable random element $\operatorname{E}(X \mid Y) : U \to \mathbb{R}$, such that

$\int_{Y^{-1}(B)} X \; d \operatorname{\mathbb{P}} = \int_{B} \operatorname{E}(X \mid Y) \; d \operatorname{\mathbb{P}_Y},$

for all $B \in \Sigma$.

Proof sketch

Let $\mu : \Sigma \to \mathbb{R}$ be such that $\mu(B) = \int_{Y^{-1}(B)} X \; d \operatorname{\mathbb{P}}$. Then $\mu$ is a signed measure which is absolutely continuous with respect to $\mathbb{P}_Y$. Indeed $\mathbb{P}_Y(B) = 0$ means exactly that $\mathbb{P}(Y^{-1}(B)) = 0$. Since the integral of an integrable function on a set of probability 0 is 0, this proves absolute continuity. The Radon–Nikodym theorem then proves the existence of a density of $\mu$ with respect to $\mathbb{P}_Y$, which we denote by $\operatorname{E}(X \mid Y)$. $\square$

Comparing with conditional expectation with respect to sub-sigma algebras, it holds that

$\operatorname{E}(X \mid Y) \circ Y= \operatorname{E}\left(X \mid Y^{-1} \left(\Sigma\right)\right).$

We can further interpret this equality by considering the abstract change of variables formula to transport the integral on the right hand side to an integral over Ω:

$\int_{Y^{-1}(B)} X \ d \operatorname{\mathbb{P}} = \int_{Y^{-1}(B)} (\operatorname{E}(X \mid Y) \circ Y) \ d \operatorname{\mathbb{P}}.$

The equation means that the integrals of $X$ and the composition $\operatorname{E}(X \mid Y) \circ Y$ over sets of the form $Y^{-1}(B)$, for $B \in \Sigma$, are identical.

This equation can be interpreted to say that the following diagram is commutative in the average.

## Computation

When X and Y are both discrete random variables, then the conditional expectation of X given the event Y=y can be considered as function of y for y in the range of Y

$\operatorname{E} (X \mid Y=y ) = \sum_{x \in \mathcal{X}} x \ \operatorname{P}(X=x\mid Y=y) = \sum_{x \in \mathcal{X}} x \ \frac{\operatorname{P}(X=x,Y=y)}{\operatorname{P}(Y=y)},$

where $\mathcal{X}$ is the range of X.

If X is a continuous random variable, while Y remains a discrete variable, the conditional expectation is:

$\operatorname{E} (X \mid Y=y )= \int_{\mathcal{X}} x f_X (x \mid Y=y) \, dx$

with $f_X (x \mid Y=y) = \frac{f_{X, Y}(x, y)}{\operatorname{P}(Y=y)}$ (where fX,Y(x, y) gives the joint density of X and Y) is the conditional density of X given Y=y.

If both X and Y are continuous random variables, then the conditional expectation is:

$\operatorname{E} (X \mid Y=y )= \int_{\mathcal{X}} x f_{X\mid Y} (x\mid y) \, dx$

where $f_{X\mid Y} (x\mid y) = \frac{f_{X, Y}(x, y)}{f_Y(y)}$ (where fY(y) gives the density of Y).

## Basic properties

All the following formulas are to be understood in an almost sure sense. The sigma-algebra $\scriptstyle \mathcal{H}$ could be replaced by a random variable $\scriptstyle Z$

• Pulling out independent factors:
• If $X$ is independent of $\mathcal{H}$, then $E(X\mid\mathcal{H}) = E(X)$.
• If $X$ is independent of $\sigma(Y, \mathcal{H})$, then $E(XY\mid \mathcal{H}) = E(X) \, E(Y\mid\mathcal{H})$. Note that this is not necessarily the case if $X$ is only independent of $\mathcal{H}$ and of $Y$.
• If $X,Y$ are independent, $\mathcal{G},\mathcal{H}$ are independent, $X$ is independent of $\mathcal{H}$ and $Y$ is independent of $\mathcal{G}$, then $E(E(XY\mid\mathcal{G})\mid\mathcal{H}) = E(X) E(Y) = E(E(XY\mid\mathcal{H})\mid\mathcal{G}).$
• Stability:
• If $X$ is $\mathcal{H}$-measurable, then $E(X\mid\mathcal{H}) = X$.
• If Z is a random variable, then $\operatorname{E}(f(Z) \mid Z)=f(Z)$ and in its simplest form: $\operatorname{E}(Z \mid Z)=Z$
• Pulling out known factors:
• If $X$ is $\mathcal{H}$-measurable, then $E(XY\mid\mathcal{H}) = X \, E(Y\mid\mathcal{H})$.
• If Z is a random variable, then $\operatorname{E}(f(Z) Y \mid Z)=f(Z)\operatorname{E}(Y \mid Z)$
• Tower property: for sub-σ-algebras $\mathcal{H}_1\subset\mathcal{H}_2 \subset\mathcal{F}$ we have $E(E(X\mid\mathcal{H}_2)\mid\mathcal{H}_1) = E(X\mid\mathcal{H}_1) = E(E(X|\mathcal{H}_1)\mid\mathcal{H}_2)$.
• A special case is when Z is a $\mathcal{H}$-measurable random variable. Then $\sigma(Z) \subset \mathcal{H}$ and thus $E(E(X \mid \mathcal{H}) \mid Z) = E(X \mid Z)$
• Doob martingale property: the above with $Z = E(X \mid \mathcal{H})$ (which is $\mathcal{H}$-measurable), and using also $\operatorname{E}(Z \mid Z)=Z$, gives $E(X \mid E(X \mid \mathcal{H})) = E(X \mid \mathcal{H})$.
• Linearity: we have $E(X_1 + X_2 \mid \mathcal{H}) = E(X_1 \mid \mathcal{H}) + E(X_2 \mid \mathcal{H})$ and $E(a X \mid \mathcal{H}) = a \, E(X \mid \mathcal{H})$ for $a\in\R$.
• Positivity: If $X \ge 0$ then $E(X \mid \mathcal{H}) \ge 0$.
• Monotonicity: If $X_1 \le X_2$ then $E(X_1 \mid \mathcal{H}) \le E(X_2 \mid \mathcal{H})$.
• Monotone convergence: If $0\leq X_n \uparrow X$ then $E(X_n \mid \mathcal{H}) \uparrow E(X \mid \mathcal{H})$.
• Dominated convergence: If $X_n \to X$ and $|X_n| \le Y$ with $Y \in L^1$ then $E(X_n \mid \mathcal{H}) \to E(X \mid \mathcal{H})$.
• Fatou's lemma: If $\textstyle E(\inf_n X_n \mid \mathcal{H}) > -\infty$ then $\textstyle E(\liminf_{n\to\infty} X_n \mid \mathcal{H}) \le \liminf_{n\to\infty} E(X_n \mid \mathcal{H})$.
• Jensen's inequality: If $f \colon \mathbb{R} \rightarrow \mathbb{R}$ is a convex function, then $f(E(X\mid \mathcal{H})) \le E(f(X)\mid\mathcal{H})$.
• Conditional variance: Using the conditional expectation we can define, by analogy with the definition of the variance as the mean square deviation from the average, the conditional variance
• Definition: $\operatorname{Var}(X \mid \mathcal{H}) = \operatorname{E}\bigl( (X - \operatorname{E}(X \mid \mathcal{H}))^2 \mid \mathcal{H} \bigr)$
• Algebraic formula for the variance: $\operatorname{Var}(X \mid \mathcal{H}) = \operatorname{E}(X^2 \mid \mathcal{H}) - \bigl(\operatorname{E}(X \mid \mathcal{H})\bigr)^2$
• Law of total variance: $\operatorname{Var}(X) = \operatorname{E}(\operatorname{Var}(X \mid \mathcal{H})) + \operatorname{Var}(\operatorname{E}(X \mid \mathcal{H}))$.
• Martingale convergence: For a random variable $X$, that has finite expectation, we have $E(X\mid\mathcal{H}_n) \to E(X\mid\mathcal{H})$, if either $\mathcal{H}_1 \subset \mathcal{H}_2 \subset \dotsb$ is an increasing series of sub-σ-algebras and $\textstyle \mathcal{H} = \sigma(\bigcup_{n=1}^\infty \mathcal{H}_n)$ or if $\mathcal{H}_1 \supset \mathcal{H}_2 \supset \dotsb$ is a decreasing series of sub-σ-algebras and $\textstyle \mathcal{H} = \bigcap_{n=1}^\infty \mathcal{H}_n$.
• Conditional expectation as $L^2$-projection: If $X,Y$ are in the Hilbert space of square-integrable real random variables (real random variables with finite second moment) then
• for $\mathcal{H}$-measurable $Y$ we have $E(Y(X - E(X\mid\mathcal{H}))) = 0$, i.e. the conditional expectation $E(X\mid\mathcal{H})$ is in the sense of the L2(P) scalar product the orthogonal projection from $X$ to the linear subspace of $\mathcal{H}$-measurable functions. (This allows to define and prove the existence of the conditional expectation based on the Hilbert projection theorem.)
• the mapping $X \mapsto \operatorname{E}(X\mid\mathcal{H})$ is self-adjoint: $\operatorname E(X \operatorname E(Y \mid \mathcal{H})) = \operatorname E\left(\operatorname E(X \mid \mathcal{H}) \operatorname E(Y \mid \mathcal{H})\right) = \operatorname E(\operatorname E(X \mid \mathcal{H}) Y)$
• Conditioning is a contractive projection of Lp spaces $L^s_P(\Omega; \mathcal{F}) \rightarrow L^s_P(\Omega; \mathcal{H})$ i.e. $\operatorname{E}|\operatorname{E}(X \mid\mathcal{H})|^s \le \operatorname{E}|X|^s$ for any s ≥ 1.

## Notes

1. ^ Kolmogorov, Andrey (1933). Grundbegriffe der Wahrscheinlichkeitsrechnung (in German). Berlin: Julius Springer. p. 46.[page needed]
2. ^ Oxtoby, J. C. (1953). "Review: Measure theory, by P. R. Halmos" (PDF). Bull. Amer. Math. Soc. 59 (1): 89–91. doi:10.1090/s0002-9904-1953-09662-8.
3. ^ J. L. Doob (1953). Stochastic Processes. John Wiley & Sons. ISBN 0-471-52369-0.
4. ^ Olav Kallenberg: Foundations of Modern Probability. 2. edition. Springer, New York 2002, ISBN 0-387-95313-2, S. 573.
5. ^ Loève, Michel (1978). "Chapter 27. Concept of Conditioning". Probability Theory vol. II (4th ed.). Springer. ISBN 0-387-90262-7.[page needed]

## References

• William Feller, An Introduction to Probability Theory and its Applications, vol 1, 1950, page 223
• Paul A. Meyer, Probability and Potentials, Blaisdell Publishing Co., 1966[page needed]
• Grimmett, Geoffrey; Stirzaker, David (2001). Probability and Random Processes (3rd ed.). Oxford University Press. ISBN 0-19-857222-0., pages 67–69