[R] Extract the P-value from of permutation tests

Imri bisrael at agri.huji.ac.il
Mon Jul 20 09:54:14 CEST 2009


I’m trying to do multiply permutation tests, my code look like:
 >one.test<- function(x,y){

+ xstar<-sample(x)

+ anova(lm(y ~ xstar))

+ }

>z<-function(x) replicate (1000,one.test(x,BPH)$"F value"[1])  # gives me
1000 permute F values

> perm_Fvalue<- apply(assoc_BPH[,3:900],2,z)

>a <- function(x) anova(lm(BPH ~ x))$"F value”[1]  # # give me the reals F
values

> real_F <- apply(assoc_BPH[,3:900],2,a)

#  How can I attach the “real_F” function  and a calculation function for
the new P-value  to the original z function, so by 

>  apply(assoc_BPH[,3:900],2,z)

I will get the new P-value for each variable?

        Thanks
                     Imri
                 
-- 
View this message in context: http://www.nabble.com/Extract-the-P-value-from-of-permutation-tests-tp24565402p24565402.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list