[R] How to compute p-Values

David Winsemius dwinsemius at comcast.net
Wed Jan 14 15:35:47 CET 2009


I read the problem a bit differently than Andreas. I thought you were  
trying to create a *substitute* for the parametric t-test.

A p-value is not a statement about a group of tests. It is a statement  
about one sample of data in comparison with the theoretical (in the  
case of the parametric test), or on your case, with the bootstrap  
distribution. You want to construct a CDF of your distribution of  
means/s.d. values and package it up in a form that would allow you to  
return the *proportion* of values (the "p-value") above one particular  
new sample value.

?ecdf   #will give you information on how to turn 1000 realizations  
into a function, it's really pretty simple.

If your sample of potentially (but not necessarily) t-like statistics  
is tt then ttCDF <- ecdf(tt) will return nothing, but result in ttCDF  
becoming a function. Then with a sample value mean_a to test, you get  
useful results with:

ttCDF(mean_a)

Turning this into a "test" requires a bit more packaging but it think  
the road is clear ahead.

-- 
David Winsemius


On Jan 14, 2009, at 4:52 AM, Andreas Klein wrote:

> Hello.
>
>
> How can I compute the Bootstrap p-Value for a one- and two sided  
> test, when I have a bootstrap sample of a statistic of 1000 for  
> example?
>
> My hypothesis are for example:
>
> 1. Two-Sided: H0: mean=0 vs. H1: mean!=0
> 2. One Sided: H0: mean>=0 vs. H1: mean<0
>
>
>
> I hope you can help me
>
>
> Thanks in advance
>
>
> Regards,
> Andreas
>
>
>
>
> ______________________________________________
> 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