library(boot)
set.seed(20)
x <- rgamma(100, 1)
b.mean <- one.boot(x, mean, 500)
print(b.mean)
boot.ci(b.mean) ## No studentized interval here
hist(b.mean)
## Bootstrap with weights
set.seed(10)
w <- runif(100)
bw <- one.boot(x, median, 100, weights = w)
print(bw)
## Studentized
bw.stud <- one.boot(x, median, R = 100, student = TRUE, M = 50,
weights = w)
boot.ci(bw.stud, type = "stud")
Run the code above in your browser using DataLab