Load the dataset faithful from R.
(a) Assign eruption durations to another variable.
(b) Find the sample proportion of eruptions that last more than 4 min.
(c) Construct a 90% CI for the proportion (p) of eruptions that will last more than 4 min.
R codes:
d=faithful
View(d)
e=d$eruptions
a=length(which(e>4)) # it gives number of eruptions >4
p=a/length(e)
p #it gives sample propotion
q=1-p
z=qnorm(0.95,0,1) # since we want two tailed confidence interval of
90%.
n=length(e)
CI_L=p-(z*sqrt(p*q/n)) # it gives lower limit of confidence
interval
CI_U=p+(z*sqrt(p*q/n)) # it gives upper limit of confidence
interval
Answers are as follows:
b. sample proportion of eruptions that last more than 4 min is p= 0.4852941
c. 90% CI for the proportion (p) of eruptions that will last more than 4 min is
(0.4354487 , 0.5351395 )
Get Answers For Free
Most questions answered within 1 hours.