In: Statistics and Probability
Speed Dating Use these female measures of male attractiveness given in Exercise 18 “Speed Dating” in Section 7-2 on page 329: 5, 8, 3, 8, 6, 10, 3, 7, 9, 8, 5, 5, 6, 8, 8, 7, 3, 5, 5, 6, 8, 7, 8, 8, 8, 7. Use the bootstrap method with 1000 bootstrap samples.
a) The 99% confidence interval estimate of the population mean is (5.549, 7.605).
Again, the 99% confidence interval estimate of the population mean using the bootstrap method with 1000 bootstrap samples is(5.615192, 7.538654). The CI results between the parametric and bootstrap do not dramatically different.
b) The 95% confidence interval estimate of the population standard deviation using the parametric method is (1.47, 2.59). Again the 95% confidence interval estimate of the population standard deviation using the bootstrap method is (1.297937, 2.236433). The CI results between the parametric and bootstrap do not dramatically different.
#### RUN IN R
> x=c(5, 8, 3, 8, 6, 10, 3, 7, 9, 8, 5, 5, 6, 8, 8, 7, 3, 5,
5, 6,
+ 8, 7, 8, 8, 8, 7)
>
>
> #######
# a) 99% confidence interval estimate of the population mean
>
> Boot_mean=function(data, nsim)
+ {
+ n=length(data)
+ BOOT=list()
+ MEAN=list()
+ SD=list()
+ for(i in 1:nsim)
+ {
+ BOOT[[i]]=sample(data, size=n, replace = TRUE)
+ MEAN[[i]]=mean(BOOT[[i]])
+ }
+ return(MEAN)
+ }
>
>
> ## Run
>
> MEAN=Boot_mean(data=x, nsim=1000)
>
> MEAN=unlist(MEAN)
> # 95% CI of MEAN
> QMEAN=quantile(MEAN, c(.005, .995))
> QMEAN
0.5% 99.5%
5.615192 7.538654
> ### b) 95% confidence interval estimate of the population
standard deviation
> Boot_SD=function(data, nsim)
+ {
+ n=length(data)
+ BOOT=list()
+ SD=list()
+ for(i in 1:nsim)
+ {
+ BOOT[[i]]=sample(data, size=n, replace = TRUE)
+ SD[[i]]=sd(BOOT[[i]])
+ }
+ return(SD)
+ }
>
> ### RUN
> SD=Boot_SD(data=x, nsim=200)
>
> SD=unlist(SD)
> # 95% CI of SD
> QSD=quantile(SD, c(.025, .975))
> QSD
2.5% 97.5%
1.297937 2.236433
###
x=c(5, 8, 3, 8, 6, 10, 3, 7, 9, 8, 5, 5, 6, 8, 8, 7, 3, 5, 5,
6,
8, 7, 8, 8, 8, 7)
#######
# a) 99% confidence interval estimate of the population mean
Boot_mean=function(data, nsim)
{
n=length(data)
BOOT=list()
MEAN=list()
SD=list()
for(i in 1:nsim)
{
BOOT[[i]]=sample(data, size=n, replace = TRUE)
MEAN[[i]]=mean(BOOT[[i]])
}
return(MEAN)
}
## Run
MEAN=Boot_mean(data=x, nsim=1000)
MEAN=unlist(MEAN)
# 95% CI of MEAN
QMEAN=quantile(MEAN, c(.005, .995))
QMEAN
####
### b) 95% confidence interval estimate of the population standard
deviation
Boot_SD=function(data, nsim)
{
n=length(data)
BOOT=list()
SD=list()
for(i in 1:nsim)
{
BOOT[[i]]=sample(data, size=n, replace = TRUE)
SD[[i]]=sd(BOOT[[i]])
}
return(SD)
}
### RUN
SD=Boot_SD(data=x, nsim=200)
SD=unlist(SD)
# 95% CI of SD
QSD=quantile(SD, c(.025, .975))
QSD