Problems 1 - 4 and parts a) - d) of Problem 5 are on separte piece of paper to be turned in on 9/18/19 in class.

Problem 5

  1. Now it’s your turn! Please write code to simulate this distribution and find the p-value for your simulation. Include your code.
nsim=10000
n=30
x_obs=17
p0=0.69
nullDist<-rbinom(nsim, n, p0)

head(nullDist)
## [1] 21 23 22 24 17 21
hist(nullDist)
abline(v=17, col="red")

head(nullDist<=x_obs)
## [1] FALSE FALSE FALSE FALSE  TRUE FALSE
mean(nullDist<=x_obs)*2
## [1] 0.2092