Conditional expectation explained

In probability theory, the conditional expectation, conditional expected value, or conditional mean of a random variable is its expected value evaluated with respect to the conditional probability distribution. If the random variable can take on only a finite number of values, the "conditions" are that the variable can only take on a subset of those values. More formally, in the case when the random variable is defined over a discrete probability space, the "conditions" are a partition of this probability space.

Depending on the context, the conditional expectation can be either a random variable or a function. The random variable is denoted

E(X\midY)

analogously to conditional probability. The function form is either denoted

E(X\midY=y)

or a separate function symbol such as

f(y)

is introduced with the meaning

E(X\midY)=f(Y)

.

Examples

Example 1: Dice rolling

Consider the roll of a fair and let A = 1 if the number is even (i.e., 2, 4, or 6) and A = 0 otherwise. Furthermore, let B = 1 if the number is prime (i.e., 2, 3, or 5) and B = 0 otherwise.

1 2 3 4 5 6
A 0 1 0 1 0 1
B 0 1 1 0 1 0

The unconditional expectation of A is

E[A]=(0+1+0+1+0+1)/6=1/2

, but the expectation of A conditional on B = 1 (i.e., conditional on the die roll being 2, 3, or 5) is

E[A\midB=1]=(1+0+0)/3=1/3

, and the expectation of A conditional on B = 0 (i.e., conditional on the die roll being 1, 4, or 6) is

E[A\midB=0]=(0+1+1)/3=2/3

. Likewise, the expectation of B conditional on A = 1 is

E[B\midA=1]=(1+0+0)/3=1/3

, and the expectation of B conditional on A = 0 is

E[B\midA=0]=(0+1+1)/3=2/3

.

Example 2: Rainfall data

Suppose we have daily rainfall data (mm of rain each day) collected by a weather station on every day of the ten–year (3652-day) period from January 1, 1990, to December 31, 1999. The unconditional expectation of rainfall for an unspecified day is the average of the rainfall amounts for those 3652 days. The conditional expectation of rainfall for an otherwise unspecified day known to be (conditional on being) in the month of March, is the average of daily rainfall over all 310 days of the ten–year period that falls in March. And the conditional expectation of rainfall conditional on days dated March 2 is the average of the rainfall amounts that occurred on the ten days with that specific date.

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. In works of Paul Halmos and Joseph L. Doob from 1953, conditional expectation was generalized to its modern definition using sub-σ-algebras.[1]

Definitions

Conditioning on an event

If is an event in

l{F}

with nonzero probability,and is a discrete random variable, the conditional expectationof given is

\begin{aligned} \operatorname{E}(X\midA)&=\sumxxP(X=x\midA)\\ &=\sumxx

P(\{X=x\
\cap

A)}{P(A)} \end{aligned}

where the sum is taken over all possible outcomes of .

If

P(A)=0

, the conditional expectation is undefined due to the division by zero.

Discrete random variables

If and are discrete random variables,the conditional expectation of given is

\begin{aligned} \operatorname{E}(X\midY=y)&=\sumxxP(X=x\midY=y)\\ &=\sumxx

P(X=x,Y=y)
P(Y=y)

\end{aligned}

where

P(X=x,Y=y)

is the joint probability mass function of and . The sum is taken over all possible outcomes of .

Remark that as above the expression is undefined if

P(Y=y)=0

.

Conditioning on a discrete random variable is the same as conditioning on the corresponding event:

\operatorname{E}(X\midY=y)=\operatorname{E}(X\midA)

where is the set

\{Y=y\}

.

Continuous random variables

Let

X

and

Y

be continuous random variables with joint density

fX,Y(x,y),

Y

's density

fY(y),

and conditional density

stylefX|Y(x|y)=

fX,Y(x,y)
fY(y)
of

X

given the event

Y=y.

The conditional expectation of

X

given

Y=y

is

\begin{aligned} \operatorname{E}(X\midY=y)&=

infty
\int
-infty

xfX|Y(x\midy)dx\\ &=

1
fY(y)
infty
\int
-infty

xfX,Y(x,y)dx. \end{aligned}

When the denominator is zero, the expression is undefined.

Conditioning on a continuous random variable is not the same as conditioning on the event

\{Y=y\}

as it was in the discrete case. For a discussion, see Conditioning on an event of probability zero. Not respecting this distinction can lead to contradictory conclusions as illustrated by the Borel-Kolmogorov paradox.

L2 random variables

All random variables in this section are assumed to be in

L2

, that is square integrable.In its full generality, conditional expectation is developed without this assumption, see below under Conditional expectation with respect to a sub-σ-algebra. The

L2

theory is, however, considered more intuitive[2] and admits important generalizations.In the context of

L2

random variables, conditional expectation is also called regression. In what follows let

(\Omega,l{F},P)

be a probability space, and

X:\Omega\toR

in

L2

with mean

\muX

and variance
2
\sigma
X
.The expectation

\muX

minimizes the mean squared error:

minx\operatorname{E}\left((X-x)2\right)=\operatorname{E}\left((X-

2\right) =
\mu
X)
2
\sigma
X
.

The conditional expectation of is defined analogously, except instead of a single number

\muX

, the result will be a function

eX(y)

. Let

Y:\Omega\toRn

be a random vector. The conditional expectation

eX:Rn\toR

is a measurable function such that

ming\operatorname{E}\left((X-g(Y))2\right)=\operatorname{E}\left((X-

2\right)
e
X(Y))
.

Note that unlike

\muX

, the conditional expectation

eX

is not generally unique: there may be multiple minimizers of the mean squared error.

Uniqueness

Example 1: Consider the case where is the constant random variable that's always 1.Then the mean squared error is minimized by any function of the form

eX(y)=\begin{cases} \muX&ify=1\\ anynumber&otherwise \end{cases}

Example 2: Consider the case where is the 2-dimensional random vector

(X,2X)

. Then clearly

\operatorname{E}(X\midY)=X

but in terms of functions it can be expressed as

eX(y1,y2)=3y1-y2

or

e'X(y1,y2)=y2-y1

or infinitely many other ways. In the context of linear regression, this lack of uniqueness is called multicollinearity.

Conditional expectation is unique up to a set of measure zero in

Rn

. The measure used is the pushforward measure induced by .

In the first example, the pushforward measure is a Dirac distribution at 1. In the second it is concentrated on the "diagonal"

\{y:y2=2y1\}

, so that any set not intersecting it has measure 0.

Existence

The existence of a minimizer for

ming\operatorname{E}\left((X-g(Y))2\right)

is non-trivial. It can be shown that

M:=\{g(Y):gismeasurableand\operatorname{E}(g(Y)2)<infty\}=L2(\Omega,\sigma(Y))

is a closed subspace of the Hilbert space

L2(\Omega)

.[3] By the Hilbert projection theorem, the necessary and sufficient condition for

eX

to be a minimizer is that for all

f(Y)

in we have

\langleX-eX(Y),f(Y)\rangle=0

.In words, this equation says that the residual

X-eX(Y)

is orthogonal to the space of all functions of .This orthogonality condition, applied to the indicator functions

f(Y)=1Y

,is used below to extend conditional expectation to the case that and are not necessarily in

L2

.

Connections to regression

The conditional expectation is often approximated in applied mathematics and statistics due to the difficulties in analytically calculating it, and for interpolation.[4]

The Hilbert subspace

M=\{g(Y):\operatorname{E}(g(Y)2)<infty\}

defined above is replaced with subsets thereof by restricting the functional form of, rather than allowing any measurable function. Examples of this are decision tree regression when is required to be a simple function, linear regression when is required to be affine, etc.

These generalizations of conditional expectation come at the cost of many of its properties no longer holding.For example, let be the space of all linear functions of and let

l{E}M

denote this generalized conditional expectation/

L2

projection. If

M

does not contain the constant functions, the tower property

\operatorname{E}(l{E}M(X))=\operatorname{E}(X)

will not hold.

An important special case is when and are jointly normally distributed. In this caseit can be shown that the conditional expectation is equivalent to linear regression:

eX(Y)=\alpha0+\sumi\alphaiYi

for coefficients

\{\alphai\}i

described in Multivariate normal distribution#Conditional distributions.

Conditional expectation with respect to a sub-σ-algebra

Consider the following:

(\Omega,l{F},P)

is a probability space.

X\colon\Omega\toRn

is a random variable on that probability space with finite expectation.

l{H}\subseteql{F}

is a sub-σ-algebra of

l{F}

.

Since

l{H}

is a sub

\sigma

-algebra of

l{F}

, the function

X\colon\Omega\toRn

is usually not

l{H}

-measurable, thus the existence of the integrals of the form \int_H X \,dP|_\mathcal, where

H\inl{H}

and

P|l{H}

is the restriction of

P

to

l{H}

, cannot be stated in general. However, the local averages \int_H X\,dP can be recovered in

(\Omega,l{H},P|l{H})

with the help of the conditional expectation.

A conditional expectation of X given

l{H}

, denoted as

\operatorname{E}(X\midl{H})

, is any

l{H}

-measurable function

\Omega\toRn

which satisfies:

\intH\operatorname{E}(X\midl{H})dP=\intHXdP

for each

H\inl{H}

.

As noted in the

L2

discussion, this condition is equivalent to saying that the residual

X-\operatorname{E}(X\midl{H})

is orthogonal to the indicator functions

1H

:

\langleX-\operatorname{E}(X\midl{H}),1H\rangle=0

Existence

The existence of

\operatorname{E}(X\midl{H})

can be established by noting that \mu^X\colon F \mapsto \int_F X \, \mathrmP for

F\inl{F}

is a finite measure on

(\Omega,l{F})

that is absolutely continuous with respect to

P

. If

h

is the natural injection from

l{H}

to

l{F}

, then

\muX\circh=

X|
\mu
l{H}
is the restriction of

\muX

to

l{H}

and

P\circh=P|l{H}

is the restriction of

P

to

l{H}

. Furthermore,

\muX\circh

is absolutely continuous with respect to

P\circh

, because the condition

P\circh(H)=0\iffP(h(H))=0

implies

\muX(h(H))=0\iff\muX\circh(H)=0.

Thus, we have

\operatorname{E}(X\midl{H})=

X|
d\mu
l{H
} = \frac,where the derivatives are Radon–Nikodym derivatives of measures.

Conditional expectation with respect to a random variable

Consider, in addition to the above,

(U,\Sigma)

, and

Y\colon\Omega\toU

.

The conditional expectation of given is defined by applying the above construction on the σ-algebra generated by :

\operatorname{E}[X\midY]:=\operatorname{E}[X\mid\sigma(Y)]

.

By the Doob-Dynkin lemma, there exists a function

eX\colonU\toRn

such that

\operatorname{E}[X\midY]=eX(Y)

.

Discussion

\operatorname{E}(X\midl{H})

may resemble that of

\operatorname{E}(X\midH)

for an event

H

but these are very different objects. The former is a

l{H}

-measurable function

\Omega\toRn

, while the latter is an element of

Rn

and

\operatorname{E}(X\midH)P(H)=\intHXdP=\intH\operatorname{E}(X\midl{H})dP

for

H\inl{H}

.

l{H}

controls the "granularity" of the conditioning. A conditional expectation

E(X\midl{H})

over a finer (larger) σ-algebra

l{H}

retains information about the probabilities of a larger class of events. A conditional expectation over a coarser (smaller) σ-algebra averages over more events.

Conditional probability

See main article: Regular conditional probability.

For a Borel subset in

l{B}(Rn)

, one can consider the collection of random variables

\kappal{H}(\omega,B):=\operatorname{E}(1X|l{H})(\omega)

.It can be shown that they form a Markov kernel, that is, for almost all

\omega

,

\kappal{H}(\omega,-)

is a probability measure.[5]

The Law of the unconscious statistician is then

\operatorname{E}[f(X)|l{H}]=\intf(x)\kappal{H}(-,dx)

.This shows that conditional expectations are, like their unconditional counterparts, integrations,against a conditional measure.

General Definition

In full generality, consider:

(\Omega,l{A},P)

.

(E,\|\|E)

.

X:\Omega\toE

.

l{H}\subseteql{A}

.

The conditional expectation of

X

given

l{H}

is the up to a

P

-nullset unique and integrable

E

-valued

l{H}

-measurable random variable

\operatorname{E}(X\midl{H})

satisfying

\intH\operatorname{E}(X\midl{H})dP=\intHXdP

for all

H\inl{H}

.[6] [7]

In this setting the conditional expectation is sometimes also denoted in operator notation as

\operatorname{E}l{H}X

.

Basic properties

All the following formulas are to be understood in an almost sure sense. The σ-algebra

l{H}

could be replaced by a random variable

Z

, i.e.

l{H}=\sigma(Z)

.

X

is independent of

l{H}

, then

E(X\midl{H})=E(X)

.Let

B\inl{H}

. Then

X

is independent of

1B

, so we get that

\intBXdP=E(X1B)=E(X)E(1B)=E(X)P(B)=\intBE(X)dP.

Thus the definition of conditional expectation is satisfied by the constant random variable

E(X)

, as desired.

\square

X

is independent of

\sigma(Y,l{H})

, then

E(XY\midl{H})=E(X)E(Y\midl{H})

. Note that this is not necessarily the case if

X

is only independent of

l{H}

and of

Y

.

X,Y

are independent,

l{G},l{H}

are independent,

X

is independent of

l{H}

and

Y

is independent of

l{G}

, then

E(E(XY\midl{G})\midl{H})=E(X)E(Y)=E(E(XY\midl{H})\midl{G})

.

X

is

l{H}

-measurable, then

E(X\midl{H})=X

.For each

H\inl{H}

we have

\intHE(X|l{H})dP=\intHXdP

, or equivalently

\intH(E(X|l{H})-X)dP=0

Since this is true for each

H\inl{H}

, and both

E(X|l{H})

and

X

are

l{H}

-measurable (the former property holds by definition; the latter property is key here), from this one can show

\intH|E(X|l{H})-X|dP=0

And this implies

E(X|l{H})=X

almost everywhere.

\square

l{H}1\subsetl{H}2\subsetl{F}

we have

E(E(X\midl{H}1)\midl{H}2)=E(X\midl{H}1)

.

\operatorname{E}(f(Z)\midZ)=f(Z)

. In its simplest form, this says

\operatorname{E}(Z\midZ)=Z

.

X

is

l{H}

-measurable, then

E(XY\midl{H})=XE(Y\midl{H})

.

All random variables here are assumed without loss of generality to be non-negative. The general case can be treated with

X=X+-X-

.

Fix

A\inl{H}

and let

X=1A

. Then for any

H\inl{H}

\intHE(1AY|l{H})dP=\intH1AYdP=\intAYdP=\intA\capE(Y|l{H})dP=\intH1AE(Y|l{H})dP

Hence

E(1AY|l{H})=1AE(Y|l{H})

almost everywhere.

Any simple function is a finite linear combination of indicator functions. By linearity the above property holds for simple functions: if

Xn

is a simple function then

E(XnY|l{H})=XnE(Y|l{H})

.

Now let

X

be

l{H}

-measurable. Then there exists a sequence of simple functions

\{Xn\}n\geq

converging monotonically (here meaning

Xn\leqXn+1

) and pointwise to

X

. Consequently, for

Y\geq0

, the sequence

\{XnY\}n\geq

converges monotonically and pointwise to

XY

.

Also, since

E(Y|l{H})\geq0

, the sequence

\{XnE(Y|l{H})\}n\geq

converges monotonically and pointwise to

XE(Y|l{H})

Combining the special case proved for simple functions, the definition of conditional expectation, and deploying the monotone convergence theorem:

\intHXE(Y|l{H})dP = \intH\limnXnE(Y|l{H})dP = \limn\intHXnE(Y|l{H})dP = \limn\intHE(XnY|l{H})dP = \limn\intHXnYdP=\intH\limn\toXnYdP=\intHXYdP=\intHE(XY|l{H})dP

This holds for all

H\inl{H}

, whence

XE(Y|l{H})=E(XY|l{H})

almost everywhere.

\square

\operatorname{E}(f(Z)Y\midZ)=f(Z)\operatorname{E}(Y\midZ)

.

E(E(X\midl{H}))=E(X)

.[8]

l{H}1\subsetl{H}2\subsetl{F}

we have

E(E(X\midl{H}2)\midl{H}1)=E(X\midl{H}1)

.

l{H}1=\{\emptyset,\Omega\}

recovers the Law of total expectation:

E(E(X\midl{H}2))=E(X)

.

l{H}

-measurable random variable. Then

\sigma(Z)\subsetl{H}

and thus

E(E(X\midl{H})\midZ)=E(X\midZ)

.

Z=E(X\midl{H})

(which is

l{H}

-measurable), and using also

\operatorname{E}(Z\midZ)=Z

, gives

E(X\midE(X\midl{H}))=E(X\midl{H})

.

X,Y

we have

E(E(X\midY)\midf(Y))=E(X\midf(Y))

.

X,Y,Z

we have

E(E(X\midY,Z)\midY)=E(X\midY)

.

E(X1+X2\midl{H})=E(X1\midl{H})+E(X2\midl{H})

and

E(aX\midl{H})=aE(X\midl{H})

for

a\in\R

.

X\ge0

then

E(X\midl{H})\ge0

.

X1\leX2

then

E(X1\midl{H})\leE(X2\midl{H})

.

0\leqXn\uparrowX

then

E(Xn\midl{H})\uparrowE(X\midl{H})

.

Xn\toX

and

|Xn|\leY

with

Y\inL1

, then

E(Xn\midl{H})\toE(X\midl{H})

.

styleE(infnXn\midl{H})>-infty

then

styleE(\liminfn\toinftyXn\midl{H})\le\liminfn\toinftyE(Xn\midl{H})

.

f\colonRR

is a convex function, then

f(E(X\midl{H}))\leE(f(X)\midl{H})

.

\operatorname{Var}(X\midl{H})=\operatorname{E}l((X-\operatorname{E}(X\midl{H}))2\midl{H}r)

\operatorname{Var}(X\midl{H})=\operatorname{E}(X2\midl{H})-l(\operatorname{E}(X\midl{H})r)2

\operatorname{Var}(X)=\operatorname{E}(\operatorname{Var}(X\midl{H}))+\operatorname{Var}(\operatorname{E}(X\midl{H}))

.

X

, that has finite expectation, we have

E(X\midl{H}n)\toE(X\midl{H})

, if either

l{H}1\subsetl{H}2\subset...b

is an increasing series of sub-σ-algebras and

stylel{H}=

infty
\sigma(cup
n=1

l{H}n)

or if

l{H}1\supsetl{H}2\supset...b

is a decreasing series of sub-σ-algebras and

stylel{H}=

infty
cap
n=1

l{H}n

.

L2

-projection: If

X,Y

are in the Hilbert space of square-integrable real random variables (real random variables with finite second moment) then

l{H}

-measurable

Y

, we have

E(Y(X-E(X\midl{H})))=0

, i.e. the conditional expectation

E(X\midl{H})

is in the sense of the L2(P) scalar product the orthogonal projection from

X

to the linear subspace of

l{H}

-measurable functions. (This allows to define and prove the existence of the conditional expectation based on the Hilbert projection theorem.)

X\mapsto\operatorname{E}(X\midl{H})

is self-adjoint:

\operatornameE(X\operatornameE(Y\midl{H}))=\operatornameE\left(\operatornameE(X\midl{H})\operatornameE(Y\midl{H})\right)=\operatornameE(\operatornameE(X\midl{H})Y)

Lp(\Omega,l{F},P)Lp(\Omega,l{H},P)

. I.e.,

\operatorname{E}(|\operatorname{E}(X\midl{H})|p)\le\operatorname{E}(|X|p)

for any p ≥ 1.

X,Y

are conditionally independent given

Z

, then

P(X\inB\midY,Z)=P(X\inB\midZ)

(equivalently,

E(1\{X

}\mid Y,Z) = E(1_ \mid Z)).

See also

Probability laws

References

Notes and References

  1. Olav Kallenberg: Foundations of Modern Probability. 2. edition. Springer, New York 2002,, p. 573.
  2. Web site: probability - Intuition behind Conditional Expectation . Mathematics Stack Exchange.
  3. Book: Brockwell . Peter J. . Time series : theory and methods . 1991 . Springer-Verlag . New York . 978-1-4419-0320-4 . 2nd.
  4. Book: Hastie . Trevor . The elements of statistical learning : data mining, inference, and prediction . New York . 978-0-387-84858-7 . Second, corrected 7th printing .
  5. Book: Klenke . Achim . Probability theory : a comprehensive course . London . 978-1-4471-5361-0 . Second.
  6. Book: Giuseppe. Da Prato. Jerzy. Zabczyk. 2014. Stochastic Equations in Infinite Dimensions. Cambridge University Press. 10.1017/CBO9781107295513. 26. (Definition in separable Banach spaces)
  7. Book: Tuomas. Hytönen. Jan. van Neerven. Mark. Veraar. Lutz. Weis. 2016. Analysis in Banach Spaces, Volume I: Martingales and Littlewood-Paley Theory. Springer Cham. 10.1007/978-3-319-48520-1. (Definition in general Banach spaces)
  8. Web site: Conditional expectation. 2020-09-11. www.statlect.com.
  9. Book: Kallenberg, Olav. Foundations of Modern Probability. Springer. 2001. 0-387-95313-2. 2nd. York, PA, USA. 110.