# Category Archives: Conditional Expectation

## Conditional Variance

Given two random variables, we define the conditional variance of $$X$$ given $$Y$$ by

$\text{Var}(X | Y ) = E(X^2 | Y ) – (\,E(X | Y )\,)^2$

Show that

$\text{Var}(X ) = E (\text{Var}(X | Y ) ) +\text{Var}( E(X | Y ) ) \,.$

Of course $$E(X | Y )$$ is just  random variable so we have that

$\text{Var}( E(X | Y ) ) = E [\,E(X | Y )^2\,] – [\,E(\,E(X | Y )\,)\,]^2$

also is is useful to recall that $$E(E(X | Y ))= E(X )$$.

## Random Walk

Let $$\{Z_1, Z_2, \dots, Z_n,\dots\}$$ be a sequence of i.i.d random variables such that

$P( Z_k = a ) = \begin{cases} \frac14 & \text{ If } a=1 \\\frac14 & \text{ If } a=0\\\frac12 & \text{ If } a=-1 \end{cases}$

If $$X_{n+1} = X_n + Z_n$$ and $$X_0=1$$ what is

1.  $$E( X_{n+1} | X_{n})$$?
2.  $$E( X_{n+1})$$?
3.  $$\text{Var}( X_{n+1} | X_{n})$$?
4. $$\text{Var}( X_{n+1} )$$?

Notice that $$X_n$$ depends only $$Z_{n-1},Z_{n-2},\dots,Z_1$$ and hence $$X_n$$ is independent of $$Z_n$$ !

## Which deck is rigged ?

Two decks of cards are sitting on a table. One deck is a standard deck of 52 cards. The other deck (called the rigged deck)  also has 52 cards but has had 4 of the 13 Harts replaced by Diamonds. (Recall that a standard deck has 4 suits: Diamonds, Harts, Spades, and Clubs. normal there are 13 of each suit.)

1. What is the probability one chooses 4 cards from the rigged deck and gets exactly 2 diamonds and no hearts?
2. What is the probability one chooses 4 cards from the standard deck and gets exactly 2 diamonds and no hearts?
3. You randomly chose one of the decks and draw 4 cards. You obtain exactly 2 diamonds and no hearts.
1. What is the probability you chose the cards from the rigged deck?
2. What is the probability you chose the cards from the standard deck?
3. If you had to guess which deck was used, which would you guess? The standard or the rigged ?

## Joint, Marginal and Conditioning

Let $$(X,Y)$$ have joint density $$f(x,y) = e^{-y}$$, for $$0<x<y$$, and $$f(x,y)=0$$ elsewhere.

1. Are $$X$$ and $$Y$$ independent ?
2. Compute the marginal density of $$Y$$.
3. Show that $$f_{X|Y}(x,y)=\frac1y$$, for $$0<x<y$$.
4. Compute $$E(X|Y=y)$$
5. Use the previous result to find $$E(X)$$.

## conditional densities

Let $$X$$ and $$Y$$ have the following joint density:

$f(x,y)=\begin{cases}2x+2y -4xy & \text{for } 0 \leq x\leq 1 \ \text{and}\ 0 \leq y \leq 1\\ 0& \text{otherwise}\end{cases}$

1. Find the marginal densities of $$X$$ and $$Y$$
2. find $$f_{Y|X}( y \,|\, X=\frac14)$$
3. find $$\mathbf{E}(Y \,|\, X=\frac14)$$

[Pitman p426 # 2]

## Expected max/min given min/max

Let $$X_1$$ and $$X_2$$ be the numbers on two independent fair-die rolls. Let $$M$$ be the maximum and $$N$$ the minimum of $$X_1$$ and $$X_2$$. Calculate:

1. $$\mathbf{E}( M| N=x)$$
2. $$\mathbf{E}( N| M=x)$$
3. $$\mathbf{E}( M| N)$$
4. $$\mathbf{E}( N| M)$$

## Expectation of hierachical model

Consider the following hierarchical random variable

1. $$\lambda \sim \mbox{Geometric}(p)$$
2. $$Y \mid \lambda \sim \mbox{Poisson}(\lambda)$$
Compute $$\mathbf{E}(Y)$$.