-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlotus-continuous.Rmd
83 lines (68 loc) · 4.02 KB
/
lotus-continuous.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
# LOTUS for Continuous Random Variables {#lotus-continuous}
## Theory {-}
```{theorem, name="LOTUS for a Continuous Random Variable"}
Let $X$ be a continuous random variable with p.d.f. $f(x)$. Then, the
expected value of $g(X)$ is
\begin{equation}
E[g(X)] = \int_{-\infty}^\infty g(x) \cdot f(x)\,dx.
(\#eq:lotus-continuous)
\end{equation}
```
Compare this definition with LOTUS for a discrete random
variable \@ref(eq:lotus). We simply replaced the p.m.f. by the p.d.f. and
the sum by an integral.
```{example ev-unif-sq, name="Expected Value of the Square of a Uniform"}
Suppose the current (in Amperes) flowing through a 1-ohm resistor is a $\text{Uniform}(a, b)$
random variable $I$ for $a, b > 0$. The power dissipated by this resistor is
$X = I^2$. What is the expected power dissipated by the resistor?
There are two ways to calculate this.
**Method 1 (The Long Way)** We can first derive the p.d.f. of the power, $X = I^2$,
using the methods of Lesson \@ref(transformations).
\begin{align*}
F_X(x) &= P(X \leq x) \\
&= P(I^2 \leq x) \\
&= P(I \leq \sqrt{x}) & (\text{if $x \geq 0$, since $a, b > 0$})\\
&= \begin{cases} 0 & x < a^2 \\ \frac{\sqrt{x} - a}{b - a} & a^2 \leq x \leq b^2 \\ 1 & x > b^2 \end{cases} \\
f_X(x) &= \frac{d}{dx} F_X(x) \\
&= \begin{cases} \frac{1}{2(b-a)\sqrt{x}} & a^2 \leq x \leq b^2 \\ 0 & \text{otherwise} \end{cases}
\end{align*}
Now that we have the p.d.f., we calculate the expected value using the definition \@ref(eq:ev-continuous). Note the
limits of integration:
\[ E[X] = \int_{a^2}^{b^2} x \cdot \frac{1}{2(b-a)\sqrt{x}}\,dx = \frac{b^3 - a^3}{3(b-a)}. \]
**Method 2 (Using LOTUS)** LOTUS allows us to calculate the expected value of $X$
without working out the p.d.f. of $X$. All we need is the p.d.f. of $I$, which we
already have and is simple.
\[ E[X] = E[I^2] = \int_a^b i^2 \cdot \frac{1}{b-a}\,di = \frac{i^{3}}{3} \frac{1}{b-a} \Big|_a^b = \frac{b^3 - a^3}{3(b-a)}. \]
In fact, we did not use the fact that $a, b > 0$ at all in this calculation, so this formula is
valid for all uniform distributions, not just uniform distributions on positive values.
```
```{example ev-expo-sq, name="Expected Value of the Square of an Exponential"}
Continuing with the previous example, suppose that the current $I$ instead follows an $\text{Exponential}(\lambda)$
distribution. What is the expected power dissipated by the resistor?
Again, we will use LOTUS. This is an unpleasant exercise in integration by parts. We
simply set up the integral and [use software to evaluate the integral](https://www.wolframalpha.com/input/?i=integrate+i%5E2+*+lambda+*+exp%28-lambda+*+i%29+from+i%3D0+to+infinity).
\[ E[I^2] = \int_0^\infty i^2 \cdot \lambda e^{-\lambda i}\,di = \frac{2}{\lambda^2}. \]
```
```{example, name="Expected Value of a Cosine"}
Let $\Theta$ be a random angle, from a $\text{Uniform}(-\pi, \pi)$ distribution. Then, the p.d.f.
of $\Theta$ is
\[ f(\theta) = \begin{cases} \frac{1}{\pi - (-\pi)} & -\pi \leq x \leq \pi \\ 0 & \text{otherwise} \end{cases}, \]
and the expected value of the cosine is:
\begin{align*}
E[\cos(\Theta)] &= \int_{-\pi}^\pi \cos(\theta)\cdot \frac{1}{\pi - (-\pi)}\,d\theta \\
&= \frac{1}{2\pi} \sin\theta \Big|_{-\pi}^\pi \\
&= \frac{1}{2\pi} (0 - 0) \\
&= 0.
\end{align*}
```
## Essential Practice {-}
1. You inflate a spherical balloon in a single breath. If the volume of air you exhale in a
single breath (in cubic inches) is $\text{Uniform}(a=36\pi, b=288\pi)$ random variable, what
is the expected radius of the balloon (in inches)?
(Use LOTUS, but feel free to check
your answer using the p.d.f. you derived in Lesson \@ref(transformations).)
2. The distance (in hundreds of miles) driven by a trucker in one day is a continuous
random variable $X$ whose cumulative distribution function (c.d.f.) is given by:
\[ F(x) = \begin{cases} 0 & x < 0 \\ x^3 / 216 & 0 \leq x \leq 6 \\ 1 & x > 6 \end{cases}. \]
Let the random variable $D$ represent the time (in days) required for the trucker
to make a 1500-mile trip, so $D = 15 / X$. Calculate the expected value of $D$.