10/16/2019

Scenario

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.

Solution (a)

  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.)

R Output to calculate 95% Confidence Interval

Formula I used: \[SE=\sqrt{p(1-p)/n}\]

n <- 200 ; p <- 40/200
se <- sqrt((p*(1-p))/n)
z <- 1.96
me <- z * se
LO <- round(p - me, 3)
HI <- round(p + me, 3)
HI ; LO
## [1] 0.255
## [1] 0.145

Answer:

We are 95% confident that between 14.5% and 25.5% of students smokes in this university.

Condition Check

Independence condition is satisfied as this scenario is based on a random sample of 200. Also the sample size is considered sufficiently large and we can prove this by checking success-faliure condition (40 smokers and 160 non-smokers) when

\[np >=10\]
\[n(1-p)>=10\]

Solution (b)

  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?

our goal is to find smallest sample size n so that the margin of error (me) is smaller than 0.02 For 95% confidence level.

value z* corresponds to 1.96

R Output to find the size of the sample needed

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

Answer:

Formula I used:

\[SE=\sqrt{p(1-p)/n}\]

To have margin of error no later than 2% at a 95% confidence interval for the proportion of students who smoke, you have to have a sample size of 1537.