Skip to content
Prev 166979 / 398502 Next

How to compute p-Values

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.