set.seed(444)
#simulate trees conditioned to have no living descendants
trees <- simPaleoTrees(p=0.1,q=0.1,r=0.5,ntrees=10,all.extinct=TRUE,maxtime=100,
print.runs=TRUE,plot=TRUE)
#number of tips
sapply(trees,Ntip)
#simulate trees conditioned to have possible living taxa and perfect sampling at modern
trees <- simPaleoTrees(p=0.1,q=0.1,r=0.5,ntrees=10,all.extinct=FALSE,maxtime=100,
modern.samp.prob=TRUE,print.runs=TRUE,plot=TRUE)
#number of tips
sapply(trees,Ntip)
#simulate trees with no living descendants and return sampling events, not ranges
trees <- simPaleoTrees(p=0.1,q=0.1,r=0.5,ntrees=10,all.extinct=TRUE,maxtime=100,
print.runs=TRUE,plot=TRUE,ranges.only=FALSE)
#number of sampling events
sapply(trees,function(x) sum(sapply(x$ranges[!is.na(x$ranges)],length)))
#remove any sampling events at t=0; shouldn't be any, so should be identical
sapply(trees,function(x) sum(sapply(x$ranges[!is.na(x$ranges)],function(y) sum(y>0))))
Run the code above in your browser using DataLab