Displaying 1 result from an estimated 1 matches for "samplemean".
Did you mean:
samp_mean
2010 Aug 16
2
When to use bootstrap confidence intervals?
...tstrap BCA intervals (with the
boot package). I calculated the proportion of confidence intervals
lying entirely above the true mean, the proportion entirely below the
true mean, and the proportion containing the true mean. I used a
normal distribution and a t distribution with 3 df.
library(boot)
samplemean <- function(x, ind) mean(x[ind])
ci.norm <- function(sample.size, n.samples, mu=0, sigma=1, boot.reps) {
t.under <- 0; t.over <- 0
bca.under <- 0; bca.over <- 0
for (k in 1:n.samples) {
x <- rnorm(sample.size, mu, sigma)
b <- boot(x, samplemean, R = boot....