Skip to content

Commit f597822

Browse files
author
buruzaemon
committed
more fine-tuning, clean-up of text
1 parent 6813776 commit f597822

28 files changed

+884
-520
lines changed

Lecture_03.ipynb

+11
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@
202202
"----"
203203
]
204204
},
205+
{
206+
"cell_type": "markdown",
207+
"metadata": {},
208+
"source": [
209+
"## Appendix A: The Birthday Paradox Experiment\n",
210+
"\n",
211+
"Here's a very [nice, interactive explanation of the Birthday Paradox](http://bit.ly/2NUDoPa).\n",
212+
"\n",
213+
"----"
214+
]
215+
},
205216
{
206217
"cell_type": "markdown",
207218
"metadata": {},

Lecture_07.ipynb

+9-7
Large diffs are not rendered by default.

Lecture_08.ipynb

+14-12
Large diffs are not rendered by default.

Lecture_09.ipynb

+12-10
Large diffs are not rendered by default.

Lecture_10.ipynb

+8-6
Large diffs are not rendered by default.

Lecture_11.ipynb

+21-15
Large diffs are not rendered by default.

Lecture_12.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"> Variance is a measure of how a random variable is spread about its mean.\n",
128128
">\n",
129129
"> \\\\begin{align}\n",
130-
"> Var(X) &= \\mathbb{E}(X - \\mathbb{E}X)^2 & \\quad \\text{or alternatively} \\\\\\\\\n",
130+
"> \\operatorname{Var}(X) &= \\mathbb{E}(X - \\mathbb{E}X)^2 & \\quad \\text{or alternatively} \\\\\\\\\n",
131131
"> \\\\\\\\\n",
132132
"> &= \\mathbb{E}X^2 - 2X(\\mathbb{E}X) + \\mathbb{E}(X^2) & \\quad \\text{by Linearity}\\\\\\\\\n",
133133
"> &= \\boxed{\\mathbb{E}X^2 - \\mathbb{E}(X)^2}\n",
@@ -154,7 +154,7 @@
154154
"> The _standard deviation_ the square root of the variance.\n",
155155
">\n",
156156
"> \\\\begin{align} \n",
157-
"> SD(X) &= \\sqrt{Var(X)}\n",
157+
"> SD(X) &= \\sqrt{\\operatorname{Var}(X)}\n",
158158
"> \\\\end{align}\n",
159159
"\n",
160160
"Note that like variance, the formula for standard deviation is the same for both discrete and continuous r.v.\n",
@@ -176,7 +176,7 @@
176176
"\n",
177177
"### Notation\n",
178178
"\n",
179-
"$X \\sim \\mathcal{Unif}(a,b)$\n",
179+
"$X \\sim \\operatorname{Unif}(a,b)$\n",
180180
"\n",
181181
"### Parameters\n",
182182
"\n",
@@ -257,7 +257,7 @@
257257
" \\mathbb{E}(g(x)) = \\sum_{x} g(x) P(X=x)\n",
258258
"\\end{align}\n",
259259
"\n",
260-
"### Variance of $U \\sim \\mathcal{Unif}(0,1)$\n",
260+
"### Variance of $U \\sim \\operatorname{Unif}(0,1)$\n",
261261
"\n",
262262
"\\begin{align}\n",
263263
" \\mathbb{E}(U) &= \\frac{1}{b-a} \\\\\n",
@@ -283,7 +283,7 @@
283283
"source": [
284284
"## Universality of the Uniform\n",
285285
"\n",
286-
"Given an arbitrary CDF $F$ and the uniform $\\mathcal{U} \\sim \\mathcal{Unif}(0,1)$, it is possible to simulate a draw from the continuous r.v. of the CDF $F$.\n",
286+
"Given an arbitrary CDF $F$ and the uniform $\\operatorname{U} \\sim \\operatorname{Unif}(0,1)$, it is possible to simulate a draw from the continuous r.v. of the CDF $F$.\n",
287287
"\n",
288288
"Assume:\n",
289289
"\n",

Lecture_13.ipynb

+126-53
Large diffs are not rendered by default.

Lecture_14.ipynb

+38-30
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# Lecture 14: Location, Scale and LOTUS\n",
88
"\n",
99
"\n",
10-
"## Stat 110, Joe Blitzstein, Harvard University\n",
10+
"## Stat 110, Prof. Joe Blitzstein, Harvard University\n",
1111
"\n",
1212
"----"
1313
]
@@ -24,7 +24,7 @@
2424
"- PDF $\\frac{1}{\\sqrt{2\\pi}} ~~ e^{-\\frac{z^2}{2}}$\n",
2525
"- CDF $\\Phi$\n",
2626
"- Mean $\\mathbb{E}(\\mathcal{Z}) = 0$\n",
27-
"- Variance $\\mathbb{Var}(\\mathcal{Z}) = \\mathbb{E}(\\mathcal{Z}^2) = 1$\n",
27+
"- Variance $\\operatorname{Var}(\\mathcal{Z}) = \\mathbb{E}(\\mathcal{Z}^2) = 1$\n",
2828
"- Skew (3<sup>rd</sup> moment) $\\mathbb{E}(\\mathcal{Z^3}) = 0$ (odd moments are 0 since they are odd functions)\n",
2929
"- $-\\mathcal{Z} \\sim \\mathcal{N}(0,1)$ (by symmetry; this simply flips the bell curve about its mean)\n",
3030
"\n",
@@ -42,27 +42,28 @@
4242
"## Rules on Variance\n",
4343
"\n",
4444
"\\begin{align}\n",
45-
" \\mathbb{Var}(X) &= \\mathbb{E}( (X - \\mathbb{E}X)^2 ) \\\\\n",
46-
" &= \\mathbb{E}X^2 - (\\mathbb{E}X)^2 \\\\\n",
45+
" & \\text{[1]} & \\operatorname{Var}(X) &= \\mathbb{E}( (X - \\mathbb{E}X)^2 ) \\\\\n",
46+
" & & &= \\mathbb{E}X^2 - (\\mathbb{E}X)^2 \\\\\n",
4747
" \\\\\n",
48-
" \\mathbb{Var}(X+c) &= \\mathbb{Var}(X) \\\\\n",
48+
" & \\text{[2]} & \\operatorname{Var}(X+c) &= \\operatorname{Var}(X) \\\\\n",
4949
" \\\\\n",
50-
" \\mathbb{Var}(cX) &= c^2 ~~ \\mathbb{Var}(X) \\\\\n",
50+
" & \\text{[3]} & \\operatorname{Var}(cX) &= c^2 ~~ \\operatorname{Var}(X) \\\\\n",
5151
" \\\\\n",
52-
" \\mathbb{Var}(X+Y) &\\neq \\mathbb{Var}(X) + \\mathbb{Var}(Y) ~~ \\text{in general} \n",
52+
" & \\text{[4]} & \\operatorname{Var}(X+Y) &\\neq \\operatorname{Var}(X) + \\operatorname{Var}(Y) ~~ \\text{in general} \n",
5353
"\\end{align}\n",
5454
"\n",
55-
"1. We already know this.\n",
56-
"1. Adding a constant $c$ has no effect on $\\mathbb{Var}(X)$.\n",
57-
"1. $\\mathbb{Var}(X) \\ge 0$; $\\mathbb{Var}(X)=0$ if and only if $P(X=a) = 1$ for some $a$... _variance can never be negative!_\n",
58-
"1. Unlike expected value, variance is _not_ linear. But if $X$ and $Y$ are independent, then $\\mathbb{Var}(X+Y) = \\mathbb{Var}(X) + \\mathbb{Var}(Y)$.\n",
55+
"* We already know $\\text{[1]}$\n",
56+
"* Re $\\text{[2]}$, adding a constant $c$ has no effect on $\\operatorname{Var}(X)$.\n",
57+
"* Re $\\text{[3]}$, pulling out a scaling constant $c$ means you have to square it.\n",
58+
"* $\\operatorname{Var}(X) \\ge 0$; $\\operatorname{Var}(X)=0$ if and only if $P(X=a) = 1$ for some $a$... _variance can never be negative!_\n",
59+
"* Re $\\text{[4]}$, unlike expected value, variance is _not_ linear. But if $X$ and $Y$ are independent, then $\\operatorname{Var}(X+Y) = \\operatorname{Var}(X) + \\operatorname{Var}(Y)$.\n",
5960
"\n",
6061
"As a case in point for (4), consider\n",
6162
"\n",
6263
"\\begin{align}\n",
63-
" \\mathbb{Var}(X + X) &= \\mathbb{Var}(2X) \\\\\n",
64-
" &= 4 ~~ \\mathbb{Var}(X) \\\\\n",
65-
" &\\neq 2 ~~ \\mathbb{Var}(X) & \\quad \\blacksquare \\\\\n",
64+
" \\operatorname{Var}(X + X) &= \\operatorname{Var}(2X) \\\\\n",
65+
" &= 4 ~~ \\operatorname{Var}(X) \\\\\n",
66+
" &\\neq 2 ~~ \\operatorname{Var}(X) & \\quad \\blacksquare \\\\\n",
6667
"\\end{align}\n",
6768
"\n",
6869
"... and now we know enough about variance to return back to the general form of the normal distribution.\n",
@@ -98,7 +99,7 @@
9899
"From what we know about variance,\n",
99100
"\n",
100101
"\\begin{align}\n",
101-
" \\mathbb{Var}(\\mu + \\sigma \\mathcal{Z}) &= \\sigma^2 ~~ \\mathbb{Var}(\\mathcal{Z}) \\\\\n",
102+
" \\operatorname{Var}(\\mu + \\sigma \\mathcal{Z}) &= \\sigma^2 ~~ \\operatorname{Var}(\\mathcal{Z}) \\\\\n",
102103
" &= \\sigma^2\n",
103104
"\\end{align}\n",
104105
"\n",
@@ -165,7 +166,7 @@
165166
"collapsed": true
166167
},
167168
"source": [
168-
"## Variance of $\\mathbb{Pois}(\\lambda)$\n",
169+
"## Variance of $\\operatorname{Pois}(\\lambda)$\n",
169170
"\n",
170171
"### Intuition\n",
171172
"\n",
@@ -184,11 +185,11 @@
184185
" \\mathbb{E}(X^2) &= \\sum_x x^2 ~ P(X=x) \\\\\n",
185186
"\\end{align}\n",
186187
"\n",
187-
"### The case for $Pois(\\lambda)$\n",
188+
"### The case for $\\operatorname{Pois}(\\lambda)$\n",
188189
"\n",
189-
"Let $X \\sim \\mathbb{Pois}(\\lambda)$. \n",
190+
"Let $X \\sim \\operatorname{Pois}(\\lambda)$. \n",
190191
"\n",
191-
"Recall that $\\mathbb{Var}(X) = \\mathbb{E}X^2 - (\\mathbb{E}X)^2$. We know that $\\mathbb{E}(X) = \\lambda$, so all we need to do is figure out what $\\mathbb{E}(X^2)$ is.\n",
192+
"Recall that $\\operatorname{Var}(X) = \\mathbb{E}X^2 - (\\mathbb{E}X)^2$. We know that $\\mathbb{E}(X) = \\lambda$, so all we need to do is figure out what $\\mathbb{E}(X^2)$ is.\n",
192193
"\n",
193194
"\\begin{align}\n",
194195
" \\mathbb{E}(X^2) &= \\sum_{k=0}^{\\infty} k^2 ~ \\frac{e^{-\\lambda} \\lambda^k}{k!} \\\\\n",
@@ -204,7 +205,7 @@
204205
" &= e^{-\\lambda} \\lambda e^{\\lambda} (\\lambda + 1) \\\\\n",
205206
" &= \\lambda^2 + \\lambda \\\\\n",
206207
" \\\\\n",
207-
" \\mathbb{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
208+
" \\operatorname{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
208209
" &= \\lambda^2 + \\lambda - \\lambda^2 \\\\\n",
209210
" &= \\lambda & \\quad \\blacksquare\n",
210211
"\\end{align}\n",
@@ -216,22 +217,22 @@
216217
"cell_type": "markdown",
217218
"metadata": {},
218219
"source": [
219-
"## Variance of $\\mathbb{Binom}(X)$\n",
220+
"## Variance of $\\operatorname{Binom}(X)$\n",
220221
"\n",
221-
"Let $X \\sim \\mathbb{Binom}(n,p)$.\n",
222+
"Let $X \\sim \\operatorname{Binom}(n,p)$.\n",
222223
"\n",
223224
"$\\mathbb{E}(X) = np$. \n",
224225
"\n",
225-
"Find $\\mathbb{Var}(X)$ using all the tricks you have at your disposal.\n",
226+
"Find $\\operatorname{Var}(X)$ using all the tricks you have at your disposal.\n",
226227
"\n",
227228
"### The path of least resistance\n",
228229
"\n",
229230
"Let's try applying (4) from the above Rules of Variance. \n",
230231
"\n",
231-
"We can do so because $X \\sim \\mathbb{Binom}(n,p)$ means that the $n$ trials are _independent Bernoulli_.\n",
232+
"We can do so because $X \\sim \\operatorname{Binom}(n,p)$ means that the $n$ trials are _independent Bernoulli_.\n",
232233
"\n",
233234
"\\begin{align}\n",
234-
" X &= I_1 + I_2 + \\dots + I_n & \\quad \\text{where } I_j \\text{ are i.i.d. } \\mathbb{Bern}(p) \\\\\n",
235+
" X &= I_1 + I_2 + \\dots + I_n & \\quad \\text{where } I_j \\text{ are i.i.d. } \\operatorname{Bern}(p) \\\\\n",
235236
" \\\\\n",
236237
" \\Rightarrow X^2 &= I_1^2 + I_2^2 + \\dots + I_n^2 + 2I_1I_2 + 2I_1I_3 + \\dots + 2I_{n-1}I_n & \\quad \\text{don't worry, this is not as bad as it looks} \\\\\n",
237238
" \\\\\n",
@@ -240,7 +241,7 @@
240241
" &= n p + n (n-1) p^2 & \\quad \\text{since } I_1I_2 \\text{ is the event that both } I_1 \\text{ and } I_2 \\text{ are successes} \\\\\n",
241242
" &= np + n^2 p^2 - np^2 \\\\\n",
242243
" \\\\\n",
243-
" \\mathbb{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
244+
" \\operatorname{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
244245
" &= np + n^2 p^2 - np^2 - (np)^2 \\\\\n",
245246
" &= np - np^2 \\\\\n",
246247
" &= np(1-p) \\\\\n",
@@ -254,13 +255,13 @@
254255
"cell_type": "markdown",
255256
"metadata": {},
256257
"source": [
257-
"## Variance of $\\mathbb{Geom}(p)$\n",
258+
"## Variance of $\\operatorname{Geom}(p)$\n",
258259
"\n",
259-
"Let $X \\sim \\mathbb{Geom}(p)$.\n",
260+
"Let $X \\sim \\operatorname{Geom}(p)$.\n",
260261
"\n",
261262
"It has PDF $q^{k-1}p$.\n",
262263
"\n",
263-
"Find $\\mathbb{Var}(X)$.\n",
264+
"Find $\\operatorname{Var}(X)$.\n",
264265
"\n",
265266
"### Applying what we know of the Geometric Series\n",
266267
"\n",
@@ -285,7 +286,7 @@
285286
" &= p \\frac{q+1}{p^3} \\\\\n",
286287
" &= \\frac{q+1}{p^2} \\\\\n",
287288
" \\\\\n",
288-
" \\mathbb{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
289+
" \\operatorname{Var}(X) &= \\mathbb{E}(X^2) - (\\mathbb{E}X)^2 \\\\\n",
289290
" &= \\frac{q+1}{p^2} - \\left( \\frac{1}{p} \\right)^2 \\\\\n",
290291
" &= \\frac{q+1}{p^2} - \\frac{1}{p^2} \\\\\n",
291292
" &= \\boxed{\\frac{q}{p^2}} & \\quad \\blacksquare\n",
@@ -313,6 +314,13 @@
313314
"\n",
314315
"----"
315316
]
317+
},
318+
{
319+
"cell_type": "markdown",
320+
"metadata": {},
321+
"source": [
322+
"View [Lecture 14: Location, Scale, and LOTUS | Statistics 110](http://bit.ly/2CyYFg4) on YouTube."
323+
]
316324
}
317325
],
318326
"metadata": {

Lecture_16.ipynb

+67-31
Large diffs are not rendered by default.

Lecture_17.ipynb

+20-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# Lecture 17: Moment Generating Functions (MGFs), hybrid Bayes' rule, Laplace's rule of succession\n",
88
"\n",
99
"\n",
10-
"## Stat 110, Joe Blitzstein, Harvard University\n",
10+
"## Stat 110, Prof. Joe Blitzstein, Harvard University\n",
1111
"\n",
1212
"----"
1313
]
@@ -16,9 +16,9 @@
1616
"cell_type": "markdown",
1717
"metadata": {},
1818
"source": [
19-
"## $\\mathbb{Expo}(\\lambda)$ and the Memorylessness Property\n",
19+
"## $\\operatorname{Expo}(\\lambda)$ and the Memorylessness Property\n",
2020
"\n",
21-
"#### Theorem: If $X$ is a positive, continuous r.v. with the memorylessness property, then $X \\sim \\mathbb{Expo}(\\lambda)$ for some $\\lambda$.\n",
21+
"#### Theorem: If $X$ is a positive, continuous r.v. with the memorylessness property, then $X \\sim \\operatorname{Expo}(\\lambda)$ for some $\\lambda$.\n",
2222
"\n",
2323
"Let $F$ be the CDF of $X$, $G(x) = P(X \\ge x) = 1 - F(x)$.\n",
2424
"\n",
@@ -52,7 +52,7 @@
5252
" & & &= e^{-\\lambda x} & \\quad \\blacksquare \\\\\n",
5353
"\\end{align}\n",
5454
"\n",
55-
"And so now we see that in the continuous case, $\\mathbb{Expo}(\\lambda)$ is the only distribution with the memorylessness property."
55+
"And so now we see that in the continuous case, $\\operatorname{Expo}(\\lambda)$ is the only distribution with the memorylessness property."
5656
]
5757
},
5858
{
@@ -81,7 +81,7 @@
8181
"#### Moments\n",
8282
"\n",
8383
"* the average value for a random variable $X$ $\\mathbb{E}(X)$ is known as the _first moment_\n",
84-
"* the _second moment_ of $X$ is $\\mathbb{E}(X^{2})$ which helps use derive $\\mathbb{Var}(X)$\n",
84+
"* the _second moment_ of $X$ is $\\mathbb{E}(X^{2})$ which helps use derive $\\operatorname{Var}(X)$\n",
8585
"* higher moments are easily generated (derived), as well\n",
8686
"\n",
8787
"### 3 reasons why MGF is important\n",
@@ -104,14 +104,14 @@
104104
"\n",
105105
"### MGF for $Bern(p)$\n",
106106
"\n",
107-
"Given $X \\sim Bern(p)$, we obtain the MGF with\n",
107+
"Given $X \\sim \\operatorname{Bern}(p)$, we obtain the MGF with\n",
108108
"\n",
109109
"\\begin{align}\n",
110110
" M(t) &= \\mathbb{E}(e^{tX}) \\\\\n",
111111
" &= p \\, e^t * q &\\quad \\text{ where } q = 1-p\n",
112112
"\\end{align}\n",
113113
"\n",
114-
"### MGF for $Bin(p)$\n",
114+
"### MGF for $\\operatorname{Bin}(p)$\n",
115115
"\n",
116116
"Given $X \\sim Bin(n,p)$, we obtain the MGF with\n",
117117
"\n",
@@ -168,13 +168,13 @@
168168
"\n",
169169
"_If we have observed the sun rising for the past $n$ days in succession, then what is the probability that the sun will rise tomorrow?_\n",
170170
"\n",
171-
"Given $p$ is the probability that the sun will rise on any given day $X_k$, we can consider a consecutive string of days $X_1, X_2, \\dots \\text{ i.i.d. } Bern(p)$ which is conditional on $p$. But for the question above, we do not know what $p$ is. Bayesians treat $p$ as an r.v.\n",
171+
"Given $p$ is the probability that the sun will rise on any given day $X_k$, we can consider a consecutive string of days $X_1, X_2, \\dots \\text{ i.i.d. } \\operatorname{Bern}(p)$ which is conditional on $p$. But for the question above, we do not know what $p$ is. Bayesians treat $p$ as an r.v.\n",
172172
"\n",
173173
"### Problem structure\n",
174174
"\n",
175-
"* Let $p \\sim Unif(0,1)$ be our _prior_; we choose $Unif(0,1)$ since $p$ could be _anything_\n",
175+
"* Let $p \\sim \\operatorname{Unif}(0,1)$ be our _prior_; we choose $\\operatorname{Unif}(0,1)$ since $p$ could be _anything_\n",
176176
"* Let $S_n = X_1 + X_2 + \\cdots + X_n$\n",
177-
"* So we then assume $S_n | p \\sim Bin(n,p) \\text{, } p \\sim Unif(0,1)$\n",
177+
"* So we then assume $S_n | p \\sim \\operatorname{Bin}(n,p) \\text{, } p \\sim \\operatorname{Unif}(0,1)$\n",
178178
"\n",
179179
"### Questions\n",
180180
"\n",
@@ -209,7 +209,16 @@
209209
" \\text{and } P(X_{n+1}=1 | S_n=n) &= \\int_{0}^{1} (n+1) \\, p \\, p^n \\, dp &\\quad \\text{ Fundamental Bridge, } \\mathbb{E}(p | S_n=n) \\\\ \n",
210210
" &= \\int_{0}^{1} (n+1) \\, p^{n+1} \\, dp \\\\\n",
211211
" &= \\boxed{\\frac{n+1}{n+2}}\n",
212-
"\\end{align}\n"
212+
"\\end{align}\n",
213+
"\n",
214+
"----"
215+
]
216+
},
217+
{
218+
"cell_type": "markdown",
219+
"metadata": {},
220+
"source": [
221+
"View [Lecture 17: Moment Generating Functions | Statistics 110](http://bit.ly/2CxVsgR) on YouTube."
213222
]
214223
}
215224
],

0 commit comments

Comments
 (0)