Chapter 1 - Conditional Probability and Conditional Expectation
Chapter 1 - Conditional Probability and Conditional Expectation
Conditional Expectation
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 1 / 34
Conditional Probability for Events
P (E ∩ F )
P (E | F ) = .
P (F )
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 2 / 34
Conditional Distribution
Let X and Y be discrete random variables. The conditional probability mass
function of X given Y = y is
pX|Y (x | y) = P (X = x | Y = y)
P (X = x, Y = y)
=
P (Y = y)
p(x, y)
=
pY (y)
for all values of y such that P (Y = y) > 0, where p(·, ·) denotes the joint
probability mass function of (X, Y ), and pY (·) denotes the marginal probability
mass function of Y .
FX|Y (x | y) = P (X ≤ x | Y = y)
X
= pX|Y (k | y).
k≤x
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 3 / 34
Conditional Distribution
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 4 / 34
Conditional Distribution
Example 1.1 Suppose that p(x, y), the joint probability mass function of X
and Y , is given by
Hence,
pX|Y (1 | 1) = P (X = 1 | Y = 1)
P (X = 1, Y = 1) p(1, 1) 5
= = = .
P (Y = 1) pY (1) 6
1
Likewise, pX|Y (2 | 1) = .
6
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 5 / 34
Conditional Distribution
Example 1.2 If X1 and X2 are independent binomial random variables with
respective parameters (n1 , p) and (n2 , p), calculate the conditional probability
mass function of X1 given that X1 + X2 = m for some non-negative
m ≤ n1 + n2 .
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 6 / 34
Conditional Distribution
Example 1.3 If X and Y are independent Poisson random variables with
respective parameters λ1 and λ2 , calculate the conditional probability mass
function of X given that X + Y = n.
Solution. For 0 ≤ k ≤ n,
P (X = k, X + Y = n)
P (X = k | X + Y = n) =
P (X + Y = n)
P (X = k, Y = n − k)
=
P (X + Y = n)
P (X = k)P (Y = n − k)
=
P (X + Y = n)
−1
e−λ1 λk1 e−λ2 λn−k
2 e−(λ1 +λ2 ) (λ1 + λ2 )n
=
k! (n − k)! n!
k n−k
n λ1 λ2
= .
k λ1 + λ2 λ1 + λ2
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 7 / 34
Conditional Distribution
If X and Y have a joint probability density function f (x, y), then the
conditional density function of X, given Y = y, is defined for all values of y
such that fY (y) > 0, by
f (x, y)
fX|Y (x | y) = ,
fY (y)
To motivate this definition, multiply the left side by dx and the right side of
(dxdy)/dy to get
f (x, y) dxdy
fX|Y (x | y) dx =
fY (y) dy
P (x ≤ X ≤ x + dx, y ≤ Y ≤ y + dy)
≈
P (y ≤ Y ≤ y + dy)
= P (x ≤ X ≤ x + dx | y ≤ Y ≤ y + dy).
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 8 / 34
Conditional Distribution
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 9 / 34
Conditional Distribution
f (x, 1)
1
(1)e−x(1)
fX|Y (x | 1) = = R ∞ 21 = e−x
fY (1) 2
(1)e −x(1) dx
0
Hence,
Z ∞ Z ∞
E(eX/2 | Y = 1) = ex/2 fX|Y (x | 1) dx = ex/2 e−x dx
0 0
Z ∞
= e−x/2 dx = 2.
0
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 10 / 34
Conditional Distribution
Solution. First, note that if f (x, y) is the joint density of X and Y , then the
joint density of X and X + Y is
g1 (x, y) = x g2 (x, y) = x + y
is equal to 1.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 11 / 34
Conditional Distribution
where
µ1 µ2 e−µ2 t
C=
fX1 +X2 (t)
is a constant.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 12 / 34
Computation of Expectations by Conditioning
Let us denote by E(X | Y ) the function of the random variable Y whose value
at Y = y is E(X | Y = y). Note that E(X | Y ) is a random variable.
If Y is discrete, then
X
E(X) = E(X | Y = y)P (Y = y).
y
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 13 / 34
Computation of Expectations by Conditioning
= E(X).
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 14 / 34
Computation of Expectations by Conditioning
Example 1.6 Suppose that the expected number of accidents per week at an
industrial plant is 4. Suppose also that the numbers of workers injured in each
accident are independent random variables with a common mean of 2. In
addition, assume that the number of workers injured in each accident is
independent of the number of accidents that occur. What is the expected
number of injuries during a week?
Solution. Let N denote the number of accidents and Xi the number injured in
the ith accident,
PN i = 1, 2, . . ., then the total number of injuries can be
expressed as i=1
Xi . Now,
N
X N
h X i
E Xi =E E Xi | N .
i=1 i=1
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 15 / 34
Computation of Expectations by Conditioning
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 16 / 34
Computation of Expectations by Conditioning
Example 1.7 (Random Hats Problem) At a party, N men throw their hats
into the center of a room. The hats are mixed up and each man randomly
selects one. Find the expected number of men who select their own hats.
Solution. Let X denote the number of men who select their own hats. Note
that X = H1 + H2 + · · · + HN , where
1, if the ith man selects his own hat;
Hi =
0, otherwise.
Now, because the ith man is equally likely to select any of the N hats, it
follows that
1
P (Hi = 1) = P (ith man selects his own hat) =
N
1
and so E(Hi ) = 1P (Hi = 1) + 0P (Hi = 0) = N
. Hence,
N
E(X) = E(H1 ) + · · · + E(HN ) = = 1.
N
Therefore, on average exactly one of the men will select his own hat.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 17 / 34
Computation of Expectations by Conditioning
Example 1.8 (The Matching Rounds Problem) Suppose that in the previous
example, those choosing their own hats depart, while the others (those without
a match) put their selected hats in the center of the room, mix them up, and
then reselect. Also, suppose that this process continues until each individual
has his own hat.
(a) Find E(Rn ), where Rn is the number of rounds that are necessary when
n individuals are initially present.
(b) Find E(Sn ), where Sn is the total number of selections made by the n
individuals for n ≥ 2.
(c) Find the expected number of false selections made by one of the n people
for n ≥ 2.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 18 / 34
Computation of Expectations by Conditioning
Solution.
(a) It follows from the previous example that no matter how many people
remain, there will, on average, be one match per round. Hence, one
might suggest that E(Rn ) = n. This turns out to be true, and an
induction proof will now be given.
Now, given a total of i matches in the initial round, the number of rounds
needed will equal 1 plus the number of rounds that are required when
n − i persons are to be matched with their hats.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 19 / 34
Computation of Expectations by Conditioning
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 20 / 34
Computation of Expectations by Conditioning
Solution. (con’t)
(b) For n ≥ 2, conditionally on Xn , we have
n n
X X
E(Sn ) = E(Sn | Xn = i)P (Xn = i) = [n + E(Sn−i )]P (Xn = i)
i=0 i=0
n
X
= n+ E(Sn−i )P (Xn = i),
i=0
where E(S0 ) = 0.
Using the facts that E(Xn ) = Var(Xn ) = 1 (why?), we conclude that the
above equation holds with b = 1/2 and a = 1.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 21 / 34
Computation of Expectations by Conditioning
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 22 / 34
Computation of Expectations by Conditioning
Solution. (con’t)
(c) Let Cj denote the number of hats chosen by person j (j = 1, . . . , n), then
n
X
C j = Sn .
j=1
Taking expectation and using the fact that each Cj has the same mean,
yields the result
E(Cj ) = E(Sn )/n = 1 + n/2.
Hence, the expected number of false selections by person j is
E(Cj − 1) = n/2.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 23 / 34
Computation of Variances by Conditioning
Similar to the case of expectation, it is easier to compute the variance of a
random variable X by conditioning on another variable Y in many cases.
Theorem 1.1 (Law of total variance)
If X and Y are random variables on the same probability space, and the
variance of X is finite, then
Proof. First,
E[Var(X | Y )] = E E(X 2 | Y ) − E(X | Y )2
= E[E(X 2 | Y )] − E E(X | Y )2
= E(X 2 ) − E E(X | Y )2 .
Also,
2
Var[E(X | Y )] = E E(X | Y )2 − E[E(X | Y )]
= E E(X | Y )2 − [E(X)]2 .
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 25 / 34
Computation of Variances by Conditioning
PN
Solution. (con’t) If N is a Poisson random variable, then S = i=1
Xi is
called a compound Poisson random variable.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 26 / 34
Computation of Probabilities by Conditioning
E(X) = P (E)
E(X | Y = y) = P (E | Y = y) for any random variable Y (P (Y = y) > 0).
Therefore, we have
X
P (E | Y = y)P (Y = y), if Y is discrete;
y
P (E) = Z ∞
P (E | Y = y)fY (y) dy, if Y is continuous.
−∞
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 27 / 34
Computation of Probabilities by Conditioning
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 28 / 34
Computation of Probabilities by Conditioning
Example 1.11 An insurance company supposes that the number of accidents
that each of its policyholders will have in a year is Poisson-distributed, with the
mean of the Poisson distribution depending on the policyholder. If the Poisson
mean of a randomly chosen policyholder has a gamma distribution with density
function
g(λ) = λe−λ , λ > 0,
what is the probability that a randomly chosen policyholder has exactly n
accidents next year?
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 29 / 34
Computation of Probabilities by Conditioning
2e−2λ (2λ)n+1
h(λ) = , λ>0
(n + 1)!
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 30 / 34
Computation of Probabilities by Conditioning
Example 1.12 (The Best Prize Problem) Suppose that we are to be presented
with n distinct prizes in sequence. After being presented with a prize we must
immediately decide whether to accept it or reject it and consider the next prize.
The only information we are given when deciding whether to accept a prize is
the relative rank of that prize compared to the ones already seen. That is, for
instance, when the fifth prize is presented we learn how it compares with the
first four prizes already seen.
Suppose that once a prize is rejected, it is lost, and that our objective is to
maximize the probability of obtaining the best prize. Assuming that all n!
orderings of the prizes are equally likely, how well can we do?
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 31 / 34
Computation of Probabilities by Conditioning
Solution. Fix a value k (0 ≤ k < n), and consider the strategy that rejects the
first k prizes and then accepts the first one that is better than all of those first
k.
Let Pk (best) denote the probability that the best prize is selected when this
strategy is employed. To compute this probability, condition on X, the position
of the best prize. This gives
n
X
Pk (best) = Pk (best | X = i)P (X = i)
i=1
n
1X
= Pk (best | X = i).
n
i=1
Now, if the overall best prize is among the first k, then no prize is ever selected
under the strategy considered. On the other hand, if the best prize is in
position i, where i > k, then the best prize will be selected if the best of the
first k prizes is also the best of the first i − 1 prizes.
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 32 / 34
Computation of Probabilities by Conditioning
Pk (best | X = i) = 0, if i ≤ k;
Pk (best | X = i) = P (best of first i − 1 is among the first k)
= k/(i − 1), if i > k.
We have
n
k X 1
Pk (best) =
n i−1
i=k+1
Z n−1
k 1
≈ dx
n k x
k n−1
= log
n k
k n
≈ log .
n k
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 33 / 34
Computation of Probabilities by Conditioning
Thus, since Pk (best) ≈ g(k), we see that the best strategy of the type
considered is to let the first n/e prizes go by and then accept the first one to
appear that is better than all of those.
In addition, since g(n/e) = 1/e, the probability that this strategy selects the
best prize is approximately 1/e ≈ 0.36788.
Reference
AMA3658 Stochastic Processes for Investment Chapter 1 - Conditional Prob. & Expectation 34 / 34