Skip to content

Commit 2844d60

Browse files
committed
Worked on hw2
1 parent d0510cf commit 2844d60

File tree

3 files changed

+139
-52
lines changed

3 files changed

+139
-52
lines changed

06_StatisticalInference/homework/hw2.Rmd

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
title : Statistical Inference Second Homework
3-
subtitle :
2+
title : Homework 2 for Stat Inference
3+
subtitle : Extra problems for Stat Inference
44
author : Brian Caffo
55
job : Johns Hopkins Bloomberg School of Public Health
6-
logo : bloomberg_shield.png
76
framework : io2012
87
highlighter : highlight.js
98
hitheme : tomorrow
10-
url:
11-
lib: ../../librariesNew #Remove new if using old slidify
12-
assets: ../../assets
9+
#url:
10+
# lib: ../../librariesNew #Remove new if using old slidify
11+
# assets: ../../assets
1312
widgets : [mathjax, quiz, bootstrap]
1413
mode : selfcontained # {standalone, draft}
15-
---
14+
---
1615
```{r setup, cache = F, echo = F, message = F, warning = F, tidy = F, results='hide'}
1716
# make this an external chunk that can be included in any file
1817
library(knitr)
@@ -31,6 +30,14 @@ knit_hooks$set(plot = knitr:::hook_plot_html)
3130
runif(1)
3231
```
3332

33+
## About these slides
34+
- These are some practice problems for Statistical Inference Quiz 1
35+
- They were created using slidify interactive which you will learn in
36+
Creating Data Products
37+
- Please help improve this with pull requests here
38+
(https://github.com/bcaffo/courses)
39+
runif(1)
40+
3441
--- &radio
3542
The probability that a manuscript gets accepted to a journal is 12% (say). However,
3643
given that a revision is asked for, the probability that it gets accepted

06_StatisticalInference/homework/hw2.html

Lines changed: 67 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Statistical Inference Second Homework</title>
4+
<title>Homework 2 for Stat Inference</title>
55
<meta charset="utf-8">
6-
<meta name="description" content="Statistical Inference Second Homework">
6+
<meta name="description" content="Homework 2 for Stat Inference">
77
<meta name="author" content="Brian Caffo">
88
<meta name="generator" content="slidify" />
99
<meta name="apple-mobile-web-app-capable" content="yes">
1010
<meta http-equiv="X-UA-Compatible" content="chrome=1">
11-
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/default.css" media="all" >
12-
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/phone.css"
11+
<link rel="stylesheet" href="libraries/frameworks/io2012/css/default.css" media="all" >
12+
<link rel="stylesheet" href="libraries/frameworks/io2012/css/phone.css"
1313
media="only screen and (max-device-width: 480px)" >
14-
<link rel="stylesheet" href="../../librariesNew/frameworks/io2012/css/slidify.css" >
15-
<link rel="stylesheet" href="../../librariesNew/highlighters/highlight.js/css/tomorrow.css" />
16-
<base target="_blank"> <!-- This amazingness opens all links in a new tab. --> <link rel=stylesheet href="../../librariesNew/widgets/quiz/css/demo.css"></link>
17-
<link rel=stylesheet href="../../librariesNew/widgets/bootstrap/css/bootstrap.css"></link>
14+
<link rel="stylesheet" href="libraries/frameworks/io2012/css/slidify.css" >
15+
<link rel="stylesheet" href="libraries/highlighters/highlight.js/css/tomorrow.css" />
16+
<base target="_blank"> <!-- This amazingness opens all links in a new tab. --> <link rel=stylesheet href="libraries/widgets/quiz/css/demo.css"></link>
17+
<link rel=stylesheet href="libraries/widgets/bootstrap/css/bootstrap.css"></link>
1818

1919

2020
<!-- Grab CDN jQuery, fall back to local if offline -->
2121
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js"></script>
22-
<script>window.jQuery || document.write('<script src="../../librariesNew/widgets/quiz/js/jquery.js"><\/script>')</script>
23-
<script data-main="../../librariesNew/frameworks/io2012/js/slides"
24-
src="../../librariesNew/frameworks/io2012/js/require-1.0.8.min.js">
22+
<script>window.jQuery || document.write('<script src="libraries/widgets/quiz/js/jquery.js"><\/script>')</script>
23+
<script data-main="libraries/frameworks/io2012/js/slides"
24+
src="libraries/frameworks/io2012/js/require-1.0.8.min.js">
2525
</script>
2626

2727

@@ -32,12 +32,9 @@
3232

3333
<!-- LOGO SLIDE -->
3434
<slide class="title-slide segue nobackground">
35-
<aside class="gdbar">
36-
<img src="../../assets/img/bloomberg_shield.png">
37-
</aside>
3835
<hgroup class="auto-fadein">
39-
<h1>Statistical Inference Second Homework</h1>
40-
<h2></h2>
36+
<h1>Homework 2 for Stat Inference</h1>
37+
<h2>Extra problems for Stat Inference</h2>
4138
<p>Brian Caffo<br/>Johns Hopkins Bloomberg School of Public Health</p>
4239
</hgroup>
4340
<article></article>
@@ -46,8 +43,19 @@ <h2></h2>
4643

4744
<!-- SLIDES -->
4845
<slide class="" id="slide-1" style="background:;">
46+
<hgroup>
47+
<h2>About these slides</h2>
48+
</hgroup>
4949
<article data-timings="">
50-
50+
<ul>
51+
<li>These are some practice problems for Statistical Inference Quiz 1</li>
52+
<li>They were created using slidify interactive which you will learn in
53+
Creating Data Products</li>
54+
<li>Please help improve this with pull requests here
55+
(<a href="https://github.com/bcaffo/courses">https://github.com/bcaffo/courses</a>)
56+
runif(1)</li>
57+
</ul>
58+
5159
</article>
5260
<!-- Presenter Notes -->
5361
</slide>
@@ -105,7 +113,11 @@ <h2></h2>
105113

106114
</div>
107115
<div class="quiz-explanation">
108-
<p>round(pnorm(93, mean = 100, sd = 10) * 100)[1] 24</p>
116+
<pre><code class="r">round(pnorm(93, mean = 100, sd = 10) * 100)
117+
</code></pre>
118+
119+
<pre><code>[1] 24
120+
</code></pre>
109121

110122
</div>
111123
</div>
@@ -145,8 +157,13 @@ <h2></h2>
145157
<p>We want
146158
\[
147159
P(A^c | T_-) = \frac{P(T_- | A^c) P(A^c)}{P(T_- | A^c) P(A^c) + P(T_- | A) P(A)}
148-
\]
149-
(.88 * .95) / (.88 * .95 + .07 * .05)[1] 0.9958</p>
160+
\]</p>
161+
162+
<pre><code class="r">(.88 * .95) / (.88 * .95 + .07 * .05)
163+
</code></pre>
164+
165+
<pre><code>[1] 0.9958
166+
</code></pre>
150167

151168
</div>
152169
</div>
@@ -173,8 +190,17 @@ <h2></h2>
173190

174191
</div>
175192
<div class="quiz-explanation">
176-
<p>round(qnorm(.95, mean = 100, sd = 10), 3)[1] 116.4
177-
round(qnorm(.05, mean = 100, sd = 10, lower.tail = FALSE), 3)[1] 116.4</p>
193+
<pre><code class="r">round(qnorm(.95, mean = 100, sd = 10), 3)
194+
</code></pre>
195+
196+
<pre><code>[1] 116.4
197+
</code></pre>
198+
199+
<pre><code class="r">round(qnorm(.05, mean = 100, sd = 10, lower.tail = FALSE), 3)
200+
</code></pre>
201+
202+
<pre><code>[1] 116.4
203+
</code></pre>
178204

179205
</div>
180206
</div>
@@ -202,8 +228,17 @@ <h2></h2>
202228

203229
</div>
204230
<div class="quiz-explanation">
205-
<p>round(qnorm(.95, mean = 100, sd = 10 / sqrt(50) ), 3)[1] 102.3
206-
round(qnorm(.05, mean = 100, sd = 10 / sqrt(50), lower.tail = FALSE), 3)[1] 102.3</p>
231+
<pre><code class="r">round(qnorm(.95, mean = 100, sd = 10 / sqrt(50) ), 3)
232+
</code></pre>
233+
234+
<pre><code>[1] 102.3
235+
</code></pre>
236+
237+
<pre><code class="r">round(qnorm(.05, mean = 100, sd = 10 / sqrt(50), lower.tail = FALSE), 3)
238+
</code></pre>
239+
240+
<pre><code>[1] 102.3
241+
</code></pre>
207242

208243
</div>
209244
</div>
@@ -217,7 +252,7 @@ <h2></h2>
217252
<ul>
218253
<li>
219254
<a href="#" target="_self" rel='tooltip'
220-
data-slide=1 title=''>
255+
data-slide=1 title='About these slides'>
221256
1
222257
</a>
223258
</li>
@@ -260,11 +295,11 @@ <h2></h2>
260295
<![endif]-->
261296
</body>
262297
<!-- Load Javascripts for Widgets -->
263-
<script src="../../librariesNew/widgets/quiz/js/jquery.quiz.js"></script>
264-
<script src="../../librariesNew/widgets/quiz/js/mustache.min.js"></script>
265-
<script src="../../librariesNew/widgets/quiz/js/quiz-app.js"></script>
266-
<script src="../../librariesNew/widgets/bootstrap/js/bootstrap.min.js"></script>
267-
<script src="../../librariesNew/widgets/bootstrap/js/bootbox.min.js"></script>
298+
<script src="libraries/widgets/quiz/js/jquery.quiz.js"></script>
299+
<script src="libraries/widgets/quiz/js/mustache.min.js"></script>
300+
<script src="libraries/widgets/quiz/js/quiz-app.js"></script>
301+
<script src="libraries/widgets/bootstrap/js/bootstrap.min.js"></script>
302+
<script src="libraries/widgets/bootstrap/js/bootbox.min.js"></script>
268303

269304
<!-- MathJax: Fall back to local if CDN offline but local image fonts are not supported (saves >100MB) -->
270305
<script type="text/x-mathjax-config">
@@ -278,7 +313,7 @@ <h2></h2>
278313
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
279314
<!-- <script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
280315
</script> -->
281-
<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>')
316+
<script>window.MathJax || document.write('<script type="text/x-mathjax-config">MathJax.Hub.Config({"HTML-CSS":{imageFont:null}});<\/script><script src="libraries/widgets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"><\/script>')
282317
</script>
283318
<script>
284319
$(function (){
@@ -287,7 +322,7 @@ <h2></h2>
287322
});
288323
</script>
289324
<!-- LOAD HIGHLIGHTER JS FILES -->
290-
<script src="../../librariesNew/highlighters/highlight.js/highlight.pack.js"></script>
325+
<script src="libraries/highlighters/highlight.js/highlight.pack.js"></script>
291326
<script>hljs.initHighlightingOnLoad();</script>
292327
<!-- DONE LOADING HIGHLIGHTER JS FILES -->
293328

06_StatisticalInference/homework/hw2.md

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
---
2-
title : Statistical Inference Second Homework
3-
subtitle :
2+
title : Homework 2 for Stat Inference
3+
subtitle : Extra problems for Stat Inference
44
author : Brian Caffo
55
job : Johns Hopkins Bloomberg School of Public Health
6-
logo : bloomberg_shield.png
76
framework : io2012
87
highlighter : highlight.js
98
hitheme : tomorrow
10-
url:
11-
lib: ../../librariesNew #Remove new if using old slidify
12-
assets: ../../assets
9+
#url:
10+
# lib: ../../librariesNew #Remove new if using old slidify
11+
# assets: ../../assets
1312
widgets : [mathjax, quiz, bootstrap]
1413
mode : selfcontained # {standalone, draft}
15-
---
14+
---
15+
1616

1717

18+
## About these slides
19+
- These are some practice problems for Statistical Inference Quiz 1
20+
- They were created using slidify interactive which you will learn in
21+
Creating Data Products
22+
- Please help improve this with pull requests here
23+
(https://github.com/bcaffo/courses)
24+
runif(1)
1825

1926
--- &radio
2027
The probability that a manuscript gets accepted to a journal is 12% (say). However,
@@ -44,8 +51,14 @@ Let $X$ be the number of hits per day. We want $P(X \leq 93)$ given that
4451
$X$ is $N(100, 10^2)$.
4552

4653
*** .explanation
47-
round(pnorm(93, mean = 100, sd = 10) * 100)[1] 24
4854

55+
```r
56+
round(pnorm(93, mean = 100, sd = 10) * 100)
57+
```
58+
59+
```
60+
[1] 24
61+
```
4962

5063

5164

@@ -71,8 +84,14 @@ We want
7184
$$
7285
P(A^c | T_-) = \frac{P(T_- | A^c) P(A^c)}{P(T_- | A^c) P(A^c) + P(T_- | A) P(A)}
7386
$$
74-
(.88 * .95) / (.88 * .95 + .07 * .05)[1] 0.9958
7587

88+
```r
89+
(.88 * .95) / (.88 * .95 + .07 * .05)
90+
```
91+
92+
```
93+
[1] 0.9958
94+
```
7695

7796

7897

@@ -87,9 +106,22 @@ Let $X$ be the number of hits per day. We want $P(X \leq 93)$ given that
87106
$X$ is $N(100, 10^2)$.
88107

89108
*** .explanation
90-
round(qnorm(.95, mean = 100, sd = 10), 3)[1] 116.4
91-
round(qnorm(.05, mean = 100, sd = 10, lower.tail = FALSE), 3)[1] 116.4
92109

110+
```r
111+
round(qnorm(.95, mean = 100, sd = 10), 3)
112+
```
113+
114+
```
115+
[1] 116.4
116+
```
117+
118+
```r
119+
round(qnorm(.05, mean = 100, sd = 10, lower.tail = FALSE), 3)
120+
```
121+
122+
```
123+
[1] 116.4
124+
```
93125

94126

95127

@@ -104,8 +136,21 @@ Let $\bar X$ be the average number of hits per day for 50 randomly sampled days.
104136
$X$ is $N(100, 10^2 / 50)$.
105137

106138
*** .explanation
107-
round(qnorm(.95, mean = 100, sd = 10 / sqrt(50) ), 3)[1] 102.3
108-
round(qnorm(.05, mean = 100, sd = 10 / sqrt(50), lower.tail = FALSE), 3)[1] 102.3
109139

140+
```r
141+
round(qnorm(.95, mean = 100, sd = 10 / sqrt(50) ), 3)
142+
```
143+
144+
```
145+
[1] 102.3
146+
```
147+
148+
```r
149+
round(qnorm(.05, mean = 100, sd = 10 / sqrt(50), lower.tail = FALSE), 3)
150+
```
151+
152+
```
153+
[1] 102.3
154+
```
110155

111156

0 commit comments

Comments
 (0)