Learn R Programming

TreeSim (version 2.4)

LTT.plot.gen: LTT.plot.gen: Calculates the number of lineages through time for each input tree, as well as the average number of lineages over all trees.

Description

LTT.plot.gen calculates the number of lineages through time for each input tree, as well as the average number of lineages over all trees. The trees may be simulated using any function in TreeSim, or may be empirical trees. The method works for ultrametric and non-ultrametric trees which are binary or have polytomies.

Usage

LTT.plot.gen(trees,bound=10^(-12))

Arguments

trees

List with one or two entries. First component: list of phylogenetic trees; second component: vector with time of origins (can be empty).

bound

Determines the value by which leaf times may differ in an ultrametric tree. If two tips are further apart, they are considered as sequentially sampled tips.

Value

out

out[[1]]: First column are the branching times of ALL input trees. Second column is the number of lineages after the branching time. out[[i]]: Equivalent vector as out [[1]], but for tree i-1.

References

T. Stadler. Simulating trees on a fixed number of extant species. Syst. Biol., 60: 676-684, 2011.

See Also

LTT.plot,sim.bd.taxa, sim.bd.age, sim.rateshift.taxa, sim.gsa.taxa, birthdeath.tree

Examples

Run this code
# NOT RUN {
# Simulation of a tree with a mrca at time 10 in the past, 
# under the density-dependent model
numbsim<-10
age<-10
lambda<-0.3
mu<-0.2
K<-40
# You can produce LTT plots as follows. 
# (for now this is un-commented, as some combinations of geiger / TreeSim on certain platforms 
# produce problems. If this is the case for you, please report to tanjs.stadler@bsse.ethz.ch).
# }
# NOT RUN {
<!-- % tree<- sim.bd.age(age,numbsim,lambda,mu,mrca=TRUE,complete=FALSE,K=K) -->
# }
# NOT RUN {
<!-- % # Plot of tree -->
# }
# NOT RUN {
<!-- % ltttrees<-LTT.plot.gen(list(tree)) -->
# }
# NOT RUN {
<!-- % plot(ltttrees[[1]],type="l") -->
# }
# NOT RUN {
<!-- % #alternatively use LTT.plot() for plotting: -->
# }
# NOT RUN {
<!-- % LTT.plot(list(tree),avg=TRUE) -->
# }
# NOT RUN {
# }
# NOT RUN {
<!-- % # Simulation of a tree with the first lineage at time 10 in the past,  -->
# }
# NOT RUN {
<!-- % # under the density-dependent model -->
# }
# NOT RUN {
<!-- % numbsim<-10 -->
# }
# NOT RUN {
<!-- % age<-10 -->
# }
# NOT RUN {
<!-- % lambda<-0.3 -->
# }
# NOT RUN {
<!-- % mu<-0 -->
# }
# NOT RUN {
<!-- % K<-40 -->
# }
# NOT RUN {
<!-- % tree<- sim.bd.age(age,numbsim,lambda,mu,mrca=FALSE,complete=FALSE,K=K) -->
# }
# NOT RUN {
<!-- % # Plot of tree -->
# }
# NOT RUN {
<!-- % ltttrees<-LTT.plot.gen(c(list(tree),list((1:10)*0+age))) -->
# }
# NOT RUN {
<!-- % plot(ltttrees[[5]],type="l") -->
# }
# NOT RUN {
<!-- % #alternatively use LTT.plot() for plotting! -->
# }

Run the code above in your browser using DataLab