Please do this in Rstudio (R code). In the year 2001 Youth Risk Behavior survey
ID: 3249749 • Letter: P
Question
Please do this in Rstudio (R code).
In the year 2001 Youth Risk Behavior survey done by the U.S. Centers for Disease Control, 747 out of 1168 female 12th graders said they always use a seatbelt when driving. Lets construct a 98% confidence interval for the proportion of 12th grade females in the population who always use a seatbelt when driving (a) Use R to find the score CI for the proportion of 12th grade females in the population who always use a seatbelt when driving. (b) Use R to find the traditional CI for the proportion of 12th grade females in the population who always use a seatbelt when driving. (c) Assuming there is no prior information or past experience available, what is the sample size necessary to control the traditional 98% CI width to be within 0.01.Explanation / Answer
Solution:
Please find the solution below using the R - code:
The complete R snipptet is as follows
k 747
n 1168
pbar = k/n
98% CI
SE = sqrt(pbar(1pbar)/n); SE # standard error
E = qnorm(.99)SE; E
#
pbar + c(E, E)
The results are
> SE = sqrt(pbar(1pbar)/n); SE # standard error
[1] 0.01404873
> E = qnorm(.99)SE; E
[1] 0.03268223
> pbar + c(E, E)
[1] 0.6068726 0.6722370
# c) to calculate n we need the form
n = pbar(1pbar)/((0.01/qnorm(.99))^2)
n = 12475.74