-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathev-product.Rmd
86 lines (69 loc) · 3.78 KB
/
ev-product.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Expected Value of a Product {#ev-product}
## Theory {-}
```{theorem ev-product, name="Expected Value of a Product"}
If $X$ and $Y$ are _independent_ random variables, then
\begin{equation}
E[XY] = E[X] E[Y].
(\#eq:ev-product)
\end{equation}
In fact, if $X$ and $Y$ are independent, then for any functions $g$ and $h$,
\begin{equation}
E[g(X)h(Y)] = E[g(X)] E[h(Y)].
(\#eq:ev-product-general)
\end{equation}
```
```{example, name="Xavier and Yolanda Revisited"}
In Lesson \@ref(lotus2d), we calculated $E[XY]$, the expected product of the
numbers of times that Xavier and Yolanda win. There, we used 2D LOTUS.
Now, let's repeat the calculation using Theorem \@ref(thm:ev-product).
You might be tempted to multiply $E[X]$ and $E[Y]$. However, this is wrong
because $X$ and $Y$ are not independent. Every time Xavier wins, Yolanda
also wins. So we cannot apply Theorem \@ref(thm:ev-product) directly.
We can express the number of times Yolanda wins as:
\[ Y = X + Z, \]
where $Z$ is the number of wins in the last two spins of the roulette wheel.
Now, $X$ and $Z$ are independent. Furthermore, we know that
$X$ is $\text{Binomial}(n=3, N_1=18, N_0=20)$, and $Z$ is
$\text{Binomial}(n=2, N_1=18, N_0=20)$.
Therefore,
\begin{align*}
E[XY] &= E[X(X + Z)] & \text{(by the representation above)} \\
&= E[X^2 + XZ] & \text{(expand expression inside expected value)} \\
&= E[X^2] + E[XZ] & \text{(linearity of expectation)} \\
&= E[X^2] + E[X]E[Z] & \text{(by independence of $X$ and $Z$ and \ref{eq:ev-product})}
\end{align*}
Now, $X$ and $Z$ are binomial, so there is a simple formula for their expected value:
\begin{align*}
E[X] &= n\frac{N_1}{N} = 3\frac{18}{38} \\
E[Z] &= n\frac{N_1}{N} = 2\frac{18}{38}.
\end{align*}
The only non-trivial part is calculating $E[X^2]$. However, we showed in
Examples \@ref(exm:binomial-lotus) and \@ref(exm:binomial-lotus-2) that for a binomial random variable $X$,
\[ E[X(X-1)] = n(n-1) \frac{N_1^2}{N^2}. \]
Since $E[X(X-1)] = E[X^2 - X] = E[X^2] - E[X]$, we can solve for $E[X^2]$:
\begin{align*}
E[X^2] &= E[X(X-1)] + E[X] \\
&= n(n-1) \frac{N_1^2}{N^2} + n\frac{N_1}{N}
\end{align*}
For the number of bets that Xavier wins,
\[ E[X^2] = 3(2)\frac{18^2}{38^2} + 3\frac{18}{38}. \]
Putting it all together, we get
\[ E[XY] = 3(2)\frac{18^2}{38^2} + 3\frac{18}{38} + \left( 3\frac{18}{38} \right) \left( 2\frac{18}{38} \right) \approx 4.11, \]
which matches the answer from Lesson \@ref(lotus2d).
```
## Essential Practice {-}
1. Consider the following three scenarios:
- A fair coin is tossed 3 times. $X$ is the number of heads and $Y$ is the number of tails.
- A fair coin is tossed 4 times. $X$ is the number of heads in the first 3 tosses, $Y$ is the number of heads in the last 3 tosses.
- A fair coin is tossed 6 times. $X$ is the number of heads in the first 3 tosses, $Y$ is the number of heads in the last 3 tosses.
In Lesson \@ref(lotus2d), you showed that $E[X + Y]$ was the same for all three scenarios, but
$E[XY]$ was different. In light of Theorems \@ref(thm:linearity) and \@ref(thm:ev-product), explain why
this makes sense.
2. Two fair dice are rolled. Let $X$ be the outcome of the first die. Let $Y$ be the outcome of the
second die. Calculate the expected ratio between the numbers on the two dice, $\displaystyle E[X / Y]$.
(You can use Theorem \@ref(thm:ev-product), since $X$ and $Y$ are independent. However,
be careful because $E[X / Y] \neq E[X] / E[Y]$.)
What is $E[Y / X]$? Why does this seem paradoxical?
3. At Diablo Canyon nuclear plant, radioactive particles hit a Geiger counter according to a Poisson process
with a rate of 3.5 particles per second. Let $X$ be the number of particles detected in the first 2 seconds.
Let $Y$ be the number of particles detected in the second after that (i.e., the 3rd second). Find $E[XY]$.