-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw2.Rmd
More file actions
101 lines (72 loc) · 1.52 KB
/
Copy pathhw2.Rmd
File metadata and controls
101 lines (72 loc) · 1.52 KB
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
---
title: "Homework #2"
author: "Ming Chen & Wenqiang Feng"
date: "2/2/2017"
output: html_document
---
## You can also get the [PDF format](./pdf/HW2.pdf) of Wenqiang's Homework.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Q1
* a. $n=10, \pi=0.2, y=3$
```{R}
P = dbinom(3, 10, 0.2)
P
```
* b. $n=4, \pi=0.4, y=2$
```{R}
P = dbinom(2, 4, 0.4)
P
```
* c. $n=16, \pi=0.7, y=12$
```{R}
P = dbinom(12, 16, 0.7)
P
```
## Q2
* a. $P(y\leq4)$
```{R}
P = pbinom(4, 8, 0.4)
P
```
* b. $P(y>4) = 1 - P(y\leq4)$
```{R}
P = 1 - pbinom(4, 8, 0.4)
P
```
* c. $P(y\leq7) = P(y\leq7) - P(y=7)$
```{R}
P = pbinom(7, 8, 0.4) - dbinom(7, 8, 0.4)
P
```
* d. $P(y\geq6) = 1 - P(y\leq6) + P(y=6)$
```{R}
P = 1 - pbinom(6, 8, 0.4) + dbinom(6, 8, 0.4)
P
```
## Q3 Exercise 4.46
* a. two are rated as outstanding
+ P(outstanding) = 0.1
+ P(X=2) = `dbinom(2, 10, 0.1)` = `r dbinom(2, 10, 0.1)`
```{R}
dbinom(2, 10, 0.1)
```
* b. two or more are rated as outstanding
+ P(outstanding) = 0.1
+ $P(X\geq2) = 1 - P(X\leq1)$ = `1 - pbinom(1, 10, 0.1)` = `r 1 - pbinom(1, 10, 0.1)`
```{R}
1 - pbinom(1, 10, 0.1)
```
* c. eight of the ten are rated either outstanding or excellent
+ P(outstanding or excellent) = 0.1 + 0.75 = 0.85
+ P(X=8) = `dbinom(8, 10, 0.85)` = `r dbinom(8, 10, 0.85)`
```{R}
dbinom(8, 10, 0.85)
```
* d. none of the trainees is rated as unsatisfactory
+ P(unsatisfactory) = 0.05
+ P(X=0) = `dbinom(0, 10, 0.05)` = `r dbinom(0, 10, 0.05)`
```{R}
dbinom(0, 10, 0.05)
```