/working/checkVMAT.R

http://github.com/eastman/auteur · R · 27 lines · 25 code · 2 blank · 0 comment · 2 complexity · 6c334580d83df61569a5ab62d451c6c8 MD5 · raw file

  1. require(auteur)
  2. bytens=function(x, num) sapply(0:num, function(y)x*(10^y))
  3. vcv2 <- function(tree){
  4. res = cophenetic(tree) / 2
  5. max(res) - res
  6. }
  7. n=bytens(20,2)
  8. reps=5
  9. out=array(dim=c(length(n)*reps,5))
  10. for(i in n){
  11. for(j in 1:reps){
  12. cat(paste("working on rep", j, "of size", i, "\n",sep=" "))
  13. phy=rcoal(i)
  14. ii=which(n==i)
  15. sA=system.time(vcv(phy)->vA)[3]
  16. sR=system.time(vmat(phy)->vR)[3]
  17. s2=system.time(vcv2(phy)->v2)[3]
  18. match=all(vA==vR&vA==v2)
  19. out[(ii-1)*reps+j,]=c(match, sA,sR,s2,Ntip(phy))
  20. }
  21. }
  22. out=data.frame(out)
  23. out=cbind(out, out[,2]/out[,3],out[,2]/out[,4])
  24. names(out)=c("match","ape","rjmcmc","klaus","treesize","speedupRJMCMC","speedupKLAUS")
  25. save(out,file="checkVMAT.rda")