Examples
This section is a workout in finding expectation and variance by conditioning. As before, if you are trying to find a probability, expectation, or variance, and you think, “If only I knew the value of this other random variable, I’d have the answer,” then that’s a sign that you should consider conditioning on that other random variable.
Mixture of Two Distributions
Let X have mean μX and SD σX. Let Y have mean μY and SD σY. Now let p be a number between 0 and 1, and define the random variable M as follows.
M={X with probability pY with probability q=1−pThe distribution of M is called a mixture of the distributions of X and Y.
One way to express the definition of M compactly is to let IH be the indicator of heads in one toss of a p-coin; then
M=XIH+Y(1−IH)To find the expectation of M we can use the expression above, but here we will condition on IH because we can continue with that method to find Var(M).
The distribution table of the random variable E(M∣IH) is
Value | μX | μY |
---|---|---|
Probability | p | q |
The distribution table of the random variable Var(M∣IH) is
Value | σ2X | σ2Y |
---|---|---|
Probability | p | q |
So
E(M) = E(E(M∣IH)) = μXp+μYqand
Var(M) = E(Var(M∣IH))+Var(E(M∣IH))= σ2Xp+σ2Yq+(μ2Xp+μ2Yq−(E(M))2)This is true no matter what the distributions of X and Y are.
Notice also that the answer for the variance can be written as
Var(M) = (μ2X+σ2X)p+(μ2Y+σ2Y)q−(E(M))2That’s what you would have got had you first found E(M2) by conditioning on IH.
Variance of the Geometric Distribution
We have managed to come quite far into the course without deriving the variance of the geometric distribution. Let’s find it now by using the results about mixtures derived above.
Toss a coin that lands heads with probability p and stop when you see a head. The number of tosses X has the geometric (p) distribution on 1,2,…. Let E(X)=μ and Var(X)=σ2. We will use conditioning to confirm that E(X)=1/p and also to find Var(X).
Now
X={1 with probability p1+X∗ with probability q=1−pwhere X∗ is an independent copy of X. By the previous example,
μ = E(X) = 1p+(1+μ)q So μ=1/p as we have known for some time.
By the variance formula of the previous example,
σ2=Var(X)=02p+σ2q+(12p+(1+1p)2q−1p2)So
σ2p = p3+(p+1)2q−1p2 = p3+(1+p)(1−p2)−1p2 = p(1−p)p2and so Var(X)=σ2=q/p2.
Normal with a Normal Mean
Let M be normal (μ,σ2M), and given M=m, let X be normal (m,σ2X).
Then
E(X∣M) = M, Var(X∣M) = σ2XNotice that the conditional variance is a constant; it is the same no matter what the value of M turns out to be.
So E(X)=E(M)=μ and
Var(X) = E(σ2X)+Var(M) = σ2X+σ2MRandom Sum
Let N be a random variable with values 0,1,2,…, mean μN, and SD σN. Let X1,X2,… be i.i.d. with mean μX and SD σX, independent of N.
Define the random sum SN as
SN={0 if N=0X1+X2+⋯+Xn if N=n>0Then as we have seen before, E(SN∣N=n)=nμX for all n (including n=0) and so
E(SN∣N) = NμXAlso
Var(SN∣N) = Nσ2XSo
E(SN) = E(NμX) = μXE(N) = μNμXThis is consistent with intuition: you expect to be adding μN i.i.d. random variables, each with mean μX. For the variance, intuition needs some guidance, which is provided by our variance decomposition formula.
Var(SN) = E(Nσ2X)+Var(NμX) = μNσ2X+μ2Xσ2N