|
26 | 26 | "source": [
|
27 | 27 | "###The Law of Large Numbers\n",
|
28 | 28 | "\n",
|
29 |
| - "Let $Z_i$ be samples from some probability distribution. According to *the Law of Large numbers*, so long as $E[Z]$ is finite, the following holds,\n", |
| 29 | + "Let $Z_i$ be $N$ independent samples from some probability distribution. According to *the Law of Large numbers*, so long as the expected value $E[Z]$ is finite, the following holds,\n", |
30 | 30 | "\n",
|
31 |
| - "$$\\frac{1}{N} \\sum_{i=0}^N Z_i \\rightarrow E[ Z ], \\;\\;\\; N \\rightarrow \\infty$$\n", |
| 31 | + "$$\\frac{1}{N} \\sum_{i=1}^N Z_i \\rightarrow E[ Z ], \\;\\;\\; N \\rightarrow \\infty.$$\n", |
32 | 32 | "\n",
|
33 | 33 | "In words:\n",
|
34 | 34 | "\n",
|
|
48 | 48 | "Consider a random variable $Z$ that can take only two values, $c_1$ and $c_2$. Suppose we have a large number of samples of $Z$, denoting a specific sample $Z_i$. The Law says that we can approximate the expected value of $Z$ by averaging over all samples. Consider the average:\n",
|
49 | 49 | "\n",
|
50 | 50 | "\n",
|
51 |
| - "$$ \\frac{1}{N} \\sum_{i=0}^N \\;Z_i $$\n", |
| 51 | + "$$ \\frac{1}{N} \\sum_{i=1}^N \\;Z_i $$\n", |
52 | 52 | "\n",
|
53 | 53 | "\n",
|
54 | 54 | "By construction, $Z_i$ can only take on $c_1$ or $c_2$, hence we can partition the sum over these two values:\n",
|
55 | 55 | "\n",
|
56 | 56 | "\\begin{align}\n",
|
57 |
| - "\\frac{1}{N} \\sum_{i=0}^N \\;Z_i\n", |
| 57 | + "\\frac{1}{N} \\sum_{i=1}^N \\;Z_i\n", |
58 | 58 | "& =\\frac{1}{N} \\big( \\sum_{ Z_i = c_1}c_1 + \\sum_{Z_i=c_2}c_2 \\big) \\\\\\\\[5pt]\n",
|
59 | 59 | "& = c_1 \\sum_{ Z_i = c_1}\\frac{1}{N} + c_2 \\sum_{ Z_i = c_2}\\frac{1}{N} \\\\\\\\[5pt]\n",
|
60 | 60 | "& = c_1 \\times \\text{ (approximate frequency of $c_1$) } \\\\\\\\ \n",
|
|
134 | 134 | "\n",
|
135 | 135 | "Another very relevant question we can ask is *how quickly am I converging to the expected value?* Let's plot something new. For a specific $N$, let's do the above trials thousands of times and compute how far away we are from the true expected value, on average. But wait — *compute on average*? This simply the law of large numbers again! For example, we are interested in, for a specific $N$, the quantity:\n",
|
136 | 136 | "\n",
|
137 |
| - "$$D(N) = \\sqrt{ \\;E\\left[\\;\\; \\left( \\frac{1}{N}\\sum_{i=0}^NZ_i - 4.5 \\;\\right)^2 \\;\\;\\right] \\;\\;}$$\n", |
| 137 | + "$$D(N) = \\sqrt{ \\;E\\left[\\;\\; \\left( \\frac{1}{N}\\sum_{i=1}^NZ_i - 4.5 \\;\\right)^2 \\;\\;\\right] \\;\\;}$$\n", |
138 | 138 | "\n",
|
139 | 139 | "(We take the square root so the dimensions of the above quantity and our random variables are the same). As the above is an expected value, it can be approximated using the law of large numbers: instead of averaging $Z_i$, we calculate the following multiple times and average them:\n",
|
140 | 140 | "\n",
|
141 |
| - "$$ Y_k = \\left( \\;\\frac{1}{N}\\sum_{i=0}^NZ_i - 4.5 \\; \\right)^2 $$\n", |
| 141 | + "$$ Y_k = \\left( \\;\\frac{1}{N}\\sum_{i=1}^NZ_i - 4.5 \\; \\right)^2 $$\n", |
142 | 142 | "\n",
|
143 | 143 | "i.e., we consider the average\n",
|
144 | 144 | "\n",
|
|
210 | 210 | "\n",
|
211 | 211 | "The variance is simply another expected value that can be approximated! Consider the following, once we have the expected value (by using the Law of Large Numbers to estimate it, denote it $\\mu$), we can estimate the variance:\n",
|
212 | 212 | "\n",
|
213 |
| - "$$ \\frac{1}{N}\\sum_{i=0}^N \\;(Z_i - \\mu)^2 \\rightarrow E[ \\;( Z - \\mu)^2 \\;] = Var( Z )$$\n", |
| 213 | + "$$ \\frac{1}{N}\\sum_{i=1}^N \\;(Z_i - \\mu)^2 \\rightarrow E[ \\;( Z - \\mu)^2 \\;] = Var( Z )$$\n", |
214 | 214 | "\n",
|
215 | 215 | "### Expected values and probabilities \n",
|
216 | 216 | "There is an even less explicit relationship between expected value and estimating probabilities. Define the *indicator function*\n",
|
|
0 commit comments