- 90% of all plants species are classified as angiosperms (flowering plants). If you were to randomly sample 200 plants from the list of all known plant species, what is the probability that at least 95% of plants in your sample will be flowering plants.
pbinom((200*.95)-1, size=200, prob=.9, lower.tail=FALSE)
## [1] 0.00807125
or
sum( dbinom((200*.95):200, size=200, prob=.9) )
## [1] 0.00807125
- The GSS found that 571 out of 670 (~85%) of Americans answered the question on experimental design correctly. Estimate (using a 95% confidence interval) the proportion of all Americans who have good intuition about experimental design?
n=670
p=.85
CI=.95
z.star=round(qnorm(CI+(1-CI)/2),2)
SE=sqrt( (p*(1-p))/n )
p+c(-1,1)*z.star*SE
## [1] 0.822962 0.877038
We are 95% confident that 82.3% to 87.7% of all Americans have good intuition about experimental design.
- The margin of error for the previous confidence interval was 2.7%. If, for a new confidence interval based on a new sample, we wanted to reduce the margin of error to 1% while keeping the confidence level the same, at least how many respondents should we sample?
newError=0.01
n=((z.star**2)*p*(1-p))/(newError**2)
print(n)
## [1] 4898.04
we need at least 4899