6.19 College smokers. We are interested in estimating the proportion of students at a university who smoke. Out of a random sample of 200 students from this university, 40 students smoke.

  1. Calculate a 95% confidence interval for the proportion of students at this university who smoke, and interpret this interval in context. (Reminder: check conditions)

Solution

n <- 200
p <- 40/200

se <- sqrt ((p * (1 - p)) / n)

z <- 1.96
me <- z * se

ci <- round(p - me, 3); round(p + me, 3)
## [1] 0.255
ci
## [1] 0.145

We are 95% confident that between 14.5% to 25.5% of student at this usnversity somkes.

Condition check: The sample is large enough at 200 and is less than 10% of the population, so the data is independent. 40 students somke and 160 students do not smoke, both are over 10.


  1. If we wanted the margin of error to be no larger than 2% at a 95% confidence level for the proportion of students who smoke, how big of a sample would we need?

Solution

p <- 40/200
z <- 1.96
me <- .02
se <- me/z
n <- round(p * (1-p) / se^2)
n
## [1] 1537

To have margin of error no larger than 2% at a 95% confidence level for the proportion of students who smoke the sample size has to be at least 1537.