Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(4)
- x = matrix(rnorm(100*5),nrow=100)
- set.seed(5)
- y = matrix(rnorm(100*5),nrow=100)
- set.seed(6)
- y[81:100,]= rnorm(100, mean=3)
- p = sapply(1:100, function(i) t.test(x[i,],y[i,])$p.val)
- sort.p<-sort(p)
- eq<-function(){(q*(1:n))/n}
- rej.pvals <- sort.p[sort.p<=eq()] #Find all the p-values which are smaller than q*i/n
- > sum(match(rej.p,p)<=80)
- [1] 4
Add Comment
Please, Sign In to add comment