Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need the R code for this exercise. Thank You. In the year 2001 Youth Risk Beha

ID: 3234815 • Letter: I

Question

I need the R code for this exercise. Thank You.

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 in R code:

#sample proportion:
p= 747/1168
n=1168
SD=sqrt(p*(1-p))
SE=SD/sqrt(n)
z=qnorm(.99)

#98% CI= [0.6069, 0.6722]:
Lower_bound=p-z*SE
Upper_bound=p+z*SE

#sample size required n= 12476:
E=0.01
n=(z*SD/E)^2