[R] How to compute p-Values
gregor rolshausen
gregor.rolshausen at biologie.uni-freiburg.de
Wed Jan 14 11:31:56 CET 2009
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
>
>
hi,
do you want to test your original t.test against t.tests of bootstrapped
samples from you data?
if so, you can just write a function creating a vector with the
statistics (t) of the single t.tests (in your case 1000 t.tests each
with a bootstrapped sample of your original data -> 1000 simulated
t-values).
you extract them by:
> tvalue=t.test(a~factor)$statistic
then just calculate the proportion of t-values from you bootstrapped
tests that are bigger than your original t-value.
>p=sum(simualted_tvalue>original_tvalue)/1000
(or did I get the question wrong?)
cheers,
gregor
More information about the R-help
mailing list