打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Randomly sample trees
第一种方法:
#http://blog.phytools.org/2013/04/picking-tree-or-set-of-trees-at-random.html
A friend recently asked:
"Does anybody know how to, in R, select a single tree at random from a posterior distribution of trees (e.g., generated via MrBayes)?"
This is not too hard. A set of trees read into memory using read.tree or read.nexus is just a list of trees with the class attribute set to "multiPhylo". To pick one at random we can just do:
random.tree<-sample(trees,size=1)[[1]]
We include the index [[1]] to (non-recursively) unlist the object returned by sample.
If we want to sample more than one, say 100 random trees from a posterior sample of 1,000, the procedure is the same. So we can just do:
random.trees<-sample(trees,size=100)
That's it.
Posted by Liam Revell at 7:26 PM
#######################################################################
第二种方法:
Alice VershininaApril 2, 2013 at 7:20 AM
Very useful and so simple! Thank you, Liam!
Few weeks ago, I found another approach, which takes into account burn-in.
http://coleoguy.blogspot.ru/2012/09/randomly-sampling-trees.html
#########################################################################
第三种方法:
https://github.com/FePhyFoFum/phyx/wiki/Program-list
利用phyx工具箱中的pxlog程序:
Resamples parameter or tree MCMC samples using some burnin and thinning across an arbitrary number of log files. NOTE: resampling parameters are in terms of number of samples, not number of generations. To determine the attributes of the log files, you can first use the -i (--info) flag:
./pxlog -t tree_files -i
and then sample accordingly:
./pxlog -t tree_files -b some_burnin -n some_thinning #每隔多少个样,sample一个。#pxlog -t 100conphy_mp70.trees -o 1000random.trees -b 1060 -r 1000
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
OpenCV:: Random Trees(一)
【HDU】1693:Eat the Trees【插头DP】
原产地证明(英文)样本(SAMPLE CERTIFICATE OF ORIGIN)
ML之LoR&Bagging&RF:依次利用Bagging、RF算法对泰坦尼克号数据集 (Kaggle经典案例)获救人员进行二分类预测——模型融合
can't help to do(to可以省略吗)
python 按行读文件
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服