Guest User

Untitled

a guest
Jun 13th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. set.seed(4)
  2. x = matrix(rnorm(100*5),nrow=100)
  3. set.seed(5)
  4. y = matrix(rnorm(100*5),nrow=100)
  5. set.seed(6)
  6. y[81:100,]= rnorm(100, mean=3)
  7.  
  8. p = sapply(1:100, function(i) t.test(x[i,],y[i,])$p.val)
  9. sort.p<-sort(p)
  10.  
  11. eq<-function(){(q*(1:n))/n}
  12.  
  13. rej.pvals <- sort.p[sort.p<=eq()] #Find all the p-values which are smaller than q*i/n
  14.  
  15. > sum(match(rej.p,p)<=80)
  16. [1] 4
Add Comment
Please, Sign In to add comment