Hi Guys,
# I'm simulating 1000character on a small tree (attached) using sim.history
("phytools")
library(ape)
library(phytools)
tree<-read.tree("filepath")
Q<-matrix(c(-.5,.5,.5,-.5),2,2,dimnames=list(c(0,1),c(0,1)))
file1<-sim.history (tree, Q, nsim=1000)
# first I would needto see all states for each of 8 species on the tree as a
table or something
# then I want to measure average rariry for each speciesusing this formula:
#Where s is the number of species (here=8), and p is the probabilityof sharing
the same state. In this case if species A #has state 1 and only onespecies out
7 others have that, the rarity would be 1-1/7=0.85. The scriptshould repeat the
#process for the number of simulations (here=1000) in order toreturn average
rarity of each species for 1000 #characters.
###tree:((A:1,B:1):9,((C:7,D:7):1,((E:4,F:4):1,(G:2,H:2):3):3):2);
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/