A random sample of twenty Texas Tech law school graduates took the bar exam and
ID: 3071250 • Letter: A
Question
A random sample of twenty Texas Tech law school graduates took the bar exam and 18 of them passed. Consider p is the proportion of the Texas Tech law school graduates that passed the test. From the sample we have ˆp = 18 20 = 0.9.
1. Explain how do the bootstrap methods work?
2. Calculate the confidence intervals of the population proportion p using the bootstrap procedure, for the following setups:
a. The confidence level {90%, 95%, 99%}
b. The number of replications {250; 1000; 5000; 10000}
3. Plot the histograms of the bootstrap statistics for each case.
4. Discuss and comment on the results.
Explanation / Answer
Use the code below in R:
rm(list = ls())
set.seed(1001)
Bootstarp.size <- c(250,1000,5000,10000)
data <- c(rep(1,18),0,0)
gen <- function(b){
res <- numeric(b)
for(i in 1:b){
data.boot <- data[sample(1:length(data),length(data),TRUE)]
res[i] <- sum(data.boot)/length(data.boot)
}
conf1 <- quantile(res,c(0.1/2,1-0.1/2))
conf2 <- quantile(res,c(0.05/2,1-0.05/2))
conf3 <- quantile(res,c(0.01/2,1-0.01/2))
hist(res, main = paste0("Bootstrap sample size ",b))
return(list(percentile90 = conf1 , percentile95 = conf2 , percentile99 = conf3))
}
gen(250)
gen(1000)
gen(5000)
gen(10000)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.