StatlectThe Digital Textbook
Index > Fundamentals of probability

Conditional expectation

The conditional expectation (or conditional mean, or conditional expected value) of a random variable is the expected value of the random variable itself, computed with respect to its conditional probability distribution.

As in the case of the expected value, giving a completely rigorous definition of conditional expected value requires a complicated mathematical apparatus. To make things simpler, we do not give a completely rigorous definition in this lecture. We rather give an informal definition and we show how conditional expectation can be computed. In particular, we discuss how to compute the expected value of a random variable X when we observe the realization of another random variable Y, i.e. when we receive the information that Y=y. The expected value of X conditional on the information that Y=y is called conditional expectation of X given Y=y.

Table of Contents

Definition

The following informal definition is very similar to the definition of expected value we have given in the lecture entitled Expected value.

Definition (informal) Let X and Y be two random variables. The conditional expectation of X given Y=y is the weighted average of the values that $X $ can take on, where each possible value is weighted by its respective conditional probability (conditional on the information that Y=y).

The expectation of a random variable X conditional on Y=y is denoted by [eq1].

Conditional expectation of a discrete random variable

In the case in which X and Y are two discrete random variables and, considered together, they form a discrete random vector, the formula for computing the conditional expectation of X given Y=y is a straightforward implementation of the above informal definition of conditional expectation: the weights of the average are given by the conditional probability mass function of X.

Definition Let X and Y be two discrete random variables. Let R_X be the support of X and let [eq2] be the conditional probability mass function of X given Y=y. The conditional expectation of X given Y=y is[eq3]provided that[eq4]

If you do not understand the symbol $sum_{xin R_{X}}$ and the finiteness condition above (absolute summability) go back to the lecture entitled Expected value, where they are explained.

Example Let the support of the random vector [eq5] be [eq6]and its joint probability mass function be[eq7]Let us compute the conditional probability mass function of X given $Y=0$. The marginal probability mass function of Y evaluated at $y=0$ is[eq8]The support of X is[eq9]Thus, the conditional probability mass function of X given $Y=0$ is[eq10]The conditional expectation of X given $Y=0$ is[eq11]

Conditional expectation of an absolutely continuous random variable

When X and Y are absolutely continuous random variables, forming an absolutely continuous random vector, the formula for computing the conditional expectation of X given Y=y involves an integral, which can be thought of as the limiting case of the summation [eq12] found in the discrete case above.

Definition Let X and Y be two absolutely continuous random variables. Let R_X be the support of X and let [eq13] be the conditional probability density function of X given Y=y. The conditional expectation of X given Y=y is[eq14]provided that[eq15]

If you do not understand why an integration is required and why the finiteness condition above (absolute integrability) is imposed, you can find an explanation in the lecture entitled Expected value.

Example Let the support of the random vector [eq16] be [eq17]and its joint probability density function be[eq18]Let us compute the conditional probability density function of X given $Y=2 $. The support of Y is[eq19]When [eq20], the marginal probability density function of Y is 0; when [eq21], the marginal probability density function is[eq22]Thus, the marginal probability density function of Y is[eq23]When evaluated at $y=2$, it is[eq24]The support of X is[eq25]Thus, the conditional probability density function of X given $Y=2$ is[eq26]The conditional expectation of X given $Y=2$ is[eq27]

Conditional expectation in general

The general formula for computing the conditional expectation of X given Y=y does not require that the two variables form a discrete or an absolutely continuous random vector, but it is applicable to any random vector.

Definition Let [eq28] be the conditional distribution function of X given Y=y. The conditional expectation of X given Y=y is[eq29]where the integral is a Riemann-Stieltjes integral and the expected value exists and is well-defined only as long as the integral is well-defined.

The above formula follows the same logic of the formula for the expected value [eq30]with the only difference that the unconditional distribution function [eq31] has now been replaced with the conditional distribution function [eq32]. The reader who feels unfamiliar with this formula can go back to the lecture entitled Expected value and read an intuitive introduction to the Riemann-Stieltjes integral and its use in probability theory.

More details

The following subsections contain more details about conditional expectation.

Properties of conditional expectation

From the above sections, it should be clear that the conditional expectation is computed exactly as the expected value, with the only difference that probabilities and probability densities are replaced by conditional probabilities and conditional probability densities. Therefore, the properties enjoyed by the expected value, such as linearity, are also enjoyed by the conditional expectation. For an exposition of the properties of the expected value, you can go to the lecture entitled Properties of the expected value.

Law of iterated expectations

Quite obviously, before knowing the realization of Y, the conditional expectation of X given Y is unknown and can itself be regarded as a random variable. We denote it by [eq33]. In other words, [eq34] is a random variable such that its realization equals [eq35] when $y$ is the realization of Y.

This random variable satisfies a very important property, known as law of iterated expectations:[eq36]

Proof

For discrete random variables this is proved as follows:[eq37]For absolutely continuous random variables the proof is analogous:[eq38]

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Let [eq39] be a discrete random vector with support [eq40]and joint probability mass function[eq41]What is the conditional expectation of X given $Y=2$?

Solution

Let us compute the conditional probability mass function of X given $Y=2$. The marginal probability mass function of Y evaluated at $y=2$ is[eq42]The support of X is[eq43]Thus, the conditional probability mass function of X given $Y=2$ is[eq44]The conditional expectation of X given $Y=2$ is[eq45]

Exercise 2

Suppose [eq39] is a continuous random vector with support [eq47]and joint probability density function[eq48]Compute the expected value of Y conditional on $X=1$.

Solution

We first need to compute the conditional probability density function of Y given $X=1$, by using the formula [eq49]Note that, by using indicator functions, we can write[eq50]The marginal probability density function [eq51] is obtained by marginalizing the joint density:[eq52]When evaluated at $x=1$, it is[eq53]Furthermore, [eq54]Thus, the conditional probability density function of Y given $X=1$ is[eq55]The conditional expectation of Y given $X=1$ is[eq56]

Exercise 3

Let X and Y be two random variables. Remember that the variance of X can be computed as[eq57]In a similar manner, the conditional variance of X, given Y=y, can be defined as[eq58]Use the law of iterated expectations to prove that[eq59]

Solution

This is proved as follows:

[eq60]where: in step $box{A}$ we have used the law of iterated expectations; in step $box{B}$ we have used the formula[eq61] in step $box{C}$ we have used the linearity of the expected value; in step $box{D}$ we have used the formula[eq62]

The book

Most of the learning materials found on this website are now available in a traditional textbook format.