x <- c(rnorm(100, mean = 50, sd=150))
group <- rep(0:1, each=50)

df <- data.frame(group, x)

df$group <- as.factor(df$group)

t.test(df$x ~ df$group, paired=T)

boot.diff <- function(d, i) {
  d$group <- d$group[i]
  mean = tapply(d$x, INDEX = d$group, mean)
  Diff = mean[1] - mean[2]

boot(df, boot.diff, R=1000)
boot.ci(boot(df, boot.diff, R=1000))
plot(boot(df, boot.diff, R=1000))

Attached above is my code - I'm fairly new to the idea of bootstrapping statistics - In the above code I'm trying to get the bootstrapped difference between two means, similar to a paired t-test.

Can someone please explain the various differences in the confidence intervals produced from the boot package, i.e "normal" "percentile" "Bca" "Basic"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.