[R] How to compute Bootstrap p-values

Murray Cooper myrmail at earthlink.net
Fri Jan 9 18:32:23 CET 2009


Do you really need the p-value or do you want to test at one
of the socially acceptable levels (i.e. .05 or .01). If all you want
is the test, use:

quantile(bootsample,c(0.025,0.975))

If the quantile range includes 0 then you decide there is no evidence
that the mean is different from zero, at the .05 level.

If the quantile range does not include 0 then you decide there is evidence
that the mean is different from zero, at the .05 level.

If you wanted to use .01 level then use:

quantile(bootsample,c(0.005,0.995))

Murray M Cooper
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richstat at earthlink.net

----- Original Message ----- 
From: "Andreas Klein" <klein82517 at yahoo.de>
To: <r-help at r-project.org>
Sent: Friday, January 09, 2009 4:36 AM
Subject: [R] How to compute Bootstrap p-values


> 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.
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list