A restaurant feeds 400 customers per day. On the average 20 percent of the customers order apple pie. (a) Give a range (called a 95 percent confidence interval) for the number of pieces of apple pie ordered on a given day such that you can be 95 percent sure that the actual number will fall in this range.
n<-400
p<-0.2
stDev<-sqrt(p*(1-p)/n)
print(stDev)
## [1] 0.02
upper<-p+2*stDev
lower<-p-2*stDev
paste0("The upper value is ", upper, " and the lower value is ", lower )
## [1] "The upper value is 0.24 and the lower value is 0.16"
Therefore, there is 95% confidence that between 16-24% that apple pie was ordered.
p1=.19 #lower limit
p = 0.21
q = 0.8
# .19 = .2 - 2SD
stDev= (0.21 -0.19)/2
stDev
## [1] 0.01
n <- (p*q)/ stDev^2
(n)
## [1] 1680
The restaurant will have an average of 1680 customers.