forked from rdpeng/courses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
549 lines (493 loc) · 16.4 KB
/
index.html
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
<!DOCTYPE html>
<html>
<head>
<title>Expected values</title>
<meta charset="utf-8">
<meta name="description" content="Expected values">
<meta name="author" content="Brian Caffo, Jeff Leek, Roger Peng">
<meta name="generator" content="slidify" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/default.css" media="all" >
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/phone.css"
media="only screen and (max-device-width: 480px)" >
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/slidify.css" >
<link rel="stylesheet" href="../../librariesNew/highlighters/highlight.js/css/tomorrow.css" />
<base target="_blank"> <!-- This amazingness opens all links in a new tab. -->
<!-- Grab CDN jQuery, fall back to local if offline -->
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js"></script>
<script>window.jQuery || document.write('<script src="../../librariesNew/widgets/quiz/js/jquery.js"><\/script>')</script>
<script data-main="../../librariesNew/frameworks/io2012/js/slides"
src="../../librariesNew/frameworks/io2012/js/require-1.0.8.min.js">
</script>
</head>
<body style="opacity: 0">
<slides class="layout-widescreen">
<!-- LOGO SLIDE -->
<slide class="title-slide segue nobackground">
<aside class="gdbar">
<img src="../../assets/img/bloomberg_shield.png">
</aside>
<hgroup class="auto-fadein">
<h1>Expected values</h1>
<h2>Statistical Inference</h2>
<p>Brian Caffo, Jeff Leek, Roger Peng<br/>Johns Hopkins Bloomberg School of Public Health</p>
</hgroup>
<article></article>
</slide>
<!-- SLIDES -->
<slide class="" id="slide-1" style="background:;">
<hgroup>
<h2>Expected values</h2>
</hgroup>
<article data-timings="">
<ul>
<li>The <strong>expected value</strong> or <strong>mean</strong> of a random variable is the center of its distribution</li>
<li>For discrete random variable \(X\) with PMF \(p(x)\), it is defined as follows
\[
E[X] = \sum_x xp(x).
\]
where the sum is taken over the possible values of \(x\)</li>
<li>\(E[X]\) represents the center of mass of a collection of locations and weights, \(\{x, p(x)\}\)</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-2" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<h3>Find the center of mass of the bars</h3>
<p><img src="assets/fig/unnamed-chunk-1.png" alt="plot of chunk unnamed-chunk-1"> </p>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-3" style="background:;">
<hgroup>
<h2>Using manipulate</h2>
</hgroup>
<article data-timings="">
<pre><code>library(manipulate)
myHist <- function(mu){
hist(galton$child,col="blue",breaks=100)
lines(c(mu, mu), c(0, 150),col="red",lwd=5)
mse <- mean((galton$child - mu)^2)
text(63, 150, paste("mu = ", mu))
text(63, 140, paste("Imbalance = ", round(mse, 2)))
}
manipulate(myHist(mu), mu = slider(62, 74, step = 0.5))
</code></pre>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-4" style="background:;">
<hgroup>
<h2>The center of mass is the empirical mean</h2>
</hgroup>
<article data-timings="">
<pre><code class="r">hist(galton$child, col = "blue", breaks = 100)
meanChild <- mean(galton$child)
lines(rep(meanChild, 100), seq(0, 150, length = 100), col = "red", lwd = 5)
</code></pre>
<p><img src="assets/fig/lsm.png" alt="plot of chunk lsm"> </p>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-5" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>Suppose a coin is flipped and \(X\) is declared \(0\) or \(1\) corresponding to a head or a tail, respectively</li>
<li>What is the expected value of \(X\)?
\[
E[X] = .5 \times 0 + .5 \times 1 = .5
\]</li>
<li>Note, if thought about geometrically, this answer is obvious; if two equal weights are spaced at 0 and 1, the center of mass will be \(.5\)</li>
</ul>
<p><img src="assets/fig/unnamed-chunk-2.png" alt="plot of chunk unnamed-chunk-2"> </p>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-6" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>Suppose that a die is rolled and \(X\) is the number face up</li>
<li>What is the expected value of \(X\)?
\[
E[X] = 1 \times \frac{1}{6} + 2 \times \frac{1}{6} +
3 \times \frac{1}{6} + 4 \times \frac{1}{6} +
5 \times \frac{1}{6} + 6 \times \frac{1}{6} = 3.5
\]</li>
<li>Again, the geometric argument makes this answer obvious without calculation.</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-7" style="background:;">
<hgroup>
<h2>Continuous random variables</h2>
</hgroup>
<article data-timings="">
<ul>
<li>For a continuous random variable, \(X\), with density, \(f\), the expected
value is defined as follows
\[
E[X] = \mbox{the area under the function}~~~ t f(t)
\]</li>
<li>This definition borrows from the definition of center of mass for a continuous body</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-8" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>Consider a density where \(f(x) = 1\) for \(x\) between zero and one</li>
<li>(Is this a valid density?)</li>
<li>Suppose that \(X\) follows this density; what is its expected value?<br>
<img src="assets/fig/unnamed-chunk-3.png" alt="plot of chunk unnamed-chunk-3"> </li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-9" style="background:;">
<hgroup>
<h2>Rules about expected values</h2>
</hgroup>
<article data-timings="">
<ul>
<li>The expected value is a linear operator </li>
<li>If \(a\) and \(b\) are not random and \(X\) and \(Y\) are two random variables then
<ul>
<li>\(E[aX + b] = a E[X] + b\)</li>
<li>\(E[X + Y] = E[X] + E[Y]\)</li>
</ul></li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-10" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>You flip a coin, \(X\) and simulate a uniform random number \(Y\), what is the expected value of their sum?
\[
E[X + Y] = E[X] + E[Y] = .5 + .5 = 1
\] </li>
<li>Another example, you roll a die twice. What is the expected value of the average? </li>
<li>Let \(X_1\) and \(X_2\) be the results of the two rolls
\[
E[(X_1 + X_2) / 2] = \frac{1}{2}(E[X_1] + E[X_2])
= \frac{1}{2}(3.5 + 3.5) = 3.5
\]</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-11" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ol>
<li>Let \(X_i\) for \(i=1,\ldots,n\) be a collection of random variables, each from a distribution with mean \(\mu\)</li>
<li>Calculate the expected value of the sample average of the \(X_i\)
\[
\begin{eqnarray*}
E\left[ \frac{1}{n}\sum_{i=1}^n X_i\right]
& = & \frac{1}{n} E\left[\sum_{i=1}^n X_i\right] \\
& = & \frac{1}{n} \sum_{i=1}^n E\left[X_i\right] \\
& = & \frac{1}{n} \sum_{i=1}^n \mu = \mu.
\end{eqnarray*}
\]</li>
</ol>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-12" style="background:;">
<hgroup>
<h2>Remark</h2>
</hgroup>
<article data-timings="">
<ul>
<li>Therefore, the expected value of the <strong>sample mean</strong> is the population mean that it's trying to estimate</li>
<li>When the expected value of an estimator is what its trying to estimate, we say that the estimator is <strong>unbiased</strong></li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-13" style="background:;">
<hgroup>
<h2>The variance</h2>
</hgroup>
<article data-timings="">
<ul>
<li>The variance of a random variable is a measure of <em>spread</em></li>
<li>If \(X\) is a random variable with mean \(\mu\), the variance of \(X\) is defined as</li>
</ul>
<p>\[
Var(X) = E[(X - \mu)^2]
\]</p>
<p>the expected (squared) distance from the mean</p>
<ul>
<li>Densities with a higher variance are more spread out than densities with a lower variance</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-14" style="background:;">
<article data-timings="">
<ul>
<li>Convenient computational form
\[
Var(X) = E[X^2] - E[X]^2
\]</li>
<li>If \(a\) is constant then \(Var(aX) = a^2 Var(X)\)</li>
<li>The square root of the variance is called the <strong>standard deviation</strong></li>
<li>The standard deviation has the same units as \(X\)</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-15" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li><p>What's the sample variance from the result of a toss of a die? </p>
<ul>
<li>\(E[X] = 3.5\) </li>
<li>\(E[X^2] = 1 ^ 2 \times \frac{1}{6} + 2 ^ 2 \times \frac{1}{6} + 3 ^ 2 \times \frac{1}{6} + 4 ^ 2 \times \frac{1}{6} + 5 ^ 2 \times \frac{1}{6} + 6 ^ 2 \times \frac{1}{6} = 15.17\) </li>
</ul></li>
<li><p>\(Var(X) = E[X^2] - E[X]^2 \approx 2.92\)</p></li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-16" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li><p>What's the sample variance from the result of the toss of a coin with probability of heads (1) of \(p\)? </p>
<ul>
<li>\(E[X] = 0 \times (1 - p) + 1 \times p = p\)</li>
<li>\(E[X^2] = E[X] = p\) </li>
</ul></li>
<li><p>\(Var(X) = E[X^2] - E[X]^2 = p - p^2 = p(1 - p)\)</p></li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-17" style="background:;">
<hgroup>
<h2>Interpreting variances</h2>
</hgroup>
<article data-timings="">
<ul>
<li>Chebyshev's inequality is useful for interpreting variances</li>
<li>This inequality states that
\[
P(|X - \mu| \geq k\sigma) \leq \frac{1}{k^2}
\]</li>
<li>For example, the probability that a random variable lies beyond \(k\) standard deviations from its mean is less than \(1/k^2\)
\[
\begin{eqnarray*}
2\sigma & \rightarrow & 25\% \\
3\sigma & \rightarrow & 11\% \\
4\sigma & \rightarrow & 6\%
\end{eqnarray*}
\]</li>
<li>Note this is only a bound; the actual probability might be quite a bit smaller</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-18" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>IQs are often said to be distributed with a mean of \(100\) and a sd of \(15\)</li>
<li>What is the probability of a randomly drawn person having an IQ higher than \(160\) or below \(40\)?</li>
<li>Thus we want to know the probability of a person being more than \(4\) standard deviations from the mean</li>
<li>Thus Chebyshev's inequality suggests that this will be no larger than 6\%</li>
<li>IQs distributions are often cited as being bell shaped, in which case this bound is very conservative</li>
<li>The probability of a random draw from a bell curve being \(4\) standard deviations from the mean is on the order of \(10^{-5}\) (one thousandth of one percent)</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="" id="slide-19" style="background:;">
<hgroup>
<h2>Example</h2>
</hgroup>
<article data-timings="">
<ul>
<li>A former buzz phrase in industrial quality control is Motorola's "Six Sigma" whereby businesses are suggested to control extreme events or rare defective parts</li>
<li>Chebyshev's inequality states that the probability of a "Six Sigma" event is less than \(1/6^2 \approx 3\%\)</li>
<li>If a bell curve is assumed, the probability of a "six sigma" event is on the order of \(10^{-9}\) (one ten millionth of a percent)</li>
</ul>
</article>
<!-- Presenter Notes -->
</slide>
<slide class="backdrop"></slide>
</slides>
<div class="pagination pagination-small" id='io2012-ptoc' style="display:none;">
<ul>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=1 title='Expected values'>
1
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=2 title='Example'>
2
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=3 title='Using manipulate'>
3
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=4 title='The center of mass is the empirical mean'>
4
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=5 title='Example'>
5
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=6 title='Example'>
6
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=7 title='Continuous random variables'>
7
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=8 title='Example'>
8
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=9 title='Rules about expected values'>
9
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=10 title='Example'>
10
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=11 title='Example'>
11
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=12 title='Remark'>
12
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=13 title='The variance'>
13
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=14 title=''>
14
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=15 title='Example'>
15
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=16 title='Example'>
16
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=17 title='Interpreting variances'>
17
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=18 title='Example'>
18
</a>
</li>
<li>
<a href="#" target="_self" rel='tooltip'
data-slide=19 title='Example'>
19
</a>
</li>
</ul>
</div> <!--[if IE]>
<script
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js">
</script>
<script>CFInstall.check({mode: 'overlay'});</script>
<![endif]-->
</body>
<!-- Load Javascripts for Widgets -->
<!-- MathJax: Fall back to local if CDN offline but local image fonts are not supported (saves >100MB) -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$'], ['\\(','\\)']],
processEscapes: true
}
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- <script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script> -->
<script>window.MathJax || document.write('<script type="text/x-mathjax-config">MathJax.Hub.Config({"HTML-CSS":{imageFont:null}});<\/script><script src="../../librariesNew/widgets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"><\/script>')
</script>
<!-- LOAD HIGHLIGHTER JS FILES -->
<script src="../../librariesNew/highlighters/highlight.js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- DONE LOADING HIGHLIGHTER JS FILES -->
</html>