Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. ABC
  2. PPL
  3. DDC
  4. ZEC
  5.  
  6. ABC
  7. CCD
  8. RL3
  9.  
  10. list1 <- 1:30
  11. list2 <- 1:40
  12. list3 <- 1:50
  13.  
  14. n <- 1000
  15. runs <- data.frame(run=1:n,threes=NA,twos=NA)
  16. for(i in 1:n) {
  17. sample_list1 <-(sample(list1,5, replace=FALSE))
  18. sample_list2 <-(sample(list2,10, replace=FALSE))
  19. sample_list3 <-(sample(list3,20, replace=FALSE))
  20.  
  21. combined_lists <- c(sample_list1, sample_list2, sample_list3)
  22. combined_counts <- as.data.frame(table(combined_lists))
  23.  
  24. runs$three[i] <- sum(combined_counts$Freq==3)
  25.  
  26. }
  27.  
  28. runs
  29.  
  30. #calculate p value when 994 overlaps observed in real data
  31. pval3 = sum(runs$threee >= 994)/1000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement