Skip to content

A question regarding bootstrap

2 messages · Erika Ahl, Stephan Kolassa

#
Hi Erika,

the bootstrap is more of a tool to assess variability and create 
confidence intervals, and people like me prefer permutation tests for 
testing hypotheses, perhaps something like this:

###############################################

sample1 <- rnorm(20)
sample2 <- rnorm(20)

n.perms <- 1000
xx <- rep(NA, n.perms)

for ( ii in 1:n.perms ) {
   sample.perm <- sample(c(sample1,sample2),replace=FALSE)
   xx[ii] <- 
mean(sample.perm[1:length(sample1)])-mean(sample.perm[(length(sample1)+1):length(sample.perm)])
}

cat("p =",1-ecdf(xx)(mean(sample1)-mean(sample2)),"\n")

###############################################

Nevertheless, you can do significance testing with the bootstrap. Create 
a confidence interval for your difference in sampled means using 
quantile(x,probs=c(0.025,0.975)) and check whether your observed 
difference lies outside it. Or directly use the ecdf(). The bootstrap 
has low power for very small samples, but n=20 per group should be quite 
enough here.

Readable introductions are:

Good, P. I. Permutation, Parametric, and Bootstrap Tests of Hypotheses. 
Springer, 2005

Good, P. I. Resampling Methods. Birkh?user, 2006

HTH,
Stephan


Erika Ahl schrieb: