WOLFRAM|DEMONSTRATIONS PROJECT

A Conditional Probability Mass Function

​
probability bubble
conditioning
Y given X
X given Y
x
1
2
3
4
5
P(X = x)
0.092
0.210
0.395
0.210
0.092
E[Y | X = x]
3.000
3.000
3.000
3.000
3.000
E[Y] = 3.000
The probability mass function of a pair of discrete random variables
(X,Y)
is the function
f(x,y)=P(X=x,Y=y)
. The conditional mass function of
Y
given
X
is the function
f(y|x)=P(Y=y|X=x)
. Thus the mass function (left-hand plot) computes probabilities of intersections, while the conditional mass function (right-hand plot) computes conditional probabilities. For each
x
value, the slice through the conditional mass function at that value gives the distribution of
Y
when
X
assumes the value
x
. The mean of this distribution is the conditional expectation of
Y
given
X=x
,
E[Y|X=x]
. The weighted average of the conditional expectations, with the weights given by the probability that
X=x
,
is the expected value of
Y
.
You can reverse the roles of
X
and
Y
to obtain the conditional mass function of
X
given
Y
and the conditional expectation of
X
given
Y=y
.