[R] How to compute Bootstrap p-values

Andreas Klein klein82517 at yahoo.de
Fri Jan 9 10:36:14 CET 2009


Hello.

How can I compute the Bootstrap p-value for a two-sided test problem like H_0: beta=0 vs. H_1: beta!=0 ?

Example for the sample mean:

x <- rnorm(100)

bootsample <- numeric(1000)

for(i in 1:1000) {

  idx <- sample(1:100,100,replace=TRUE)

  bootsample[i] <- mean(x[idx])

}


How can I compute the Bootstrap p-value for the mean of x?

H_0: "mean of x" = 0 vs. H_1: "mean of x" != 0



Thank you in advance.


Sincerely,
Andreas Klein.







More information about the R-help mailing list