sim.bdtree: birth-death tree simulator

sim.bdtreeR Documentation

birth-death tree simulator

Description

simulating phylogenetic trees under a uniform birth-death process

Usage

sim.bdtree(b=1, d=0, stop=c("taxa", "time"), n=100, t=4, seed=0, extinct=TRUE)

Arguments

b

per-lineage birth (speciation) rate

d

per-lineage death (extinction) rate

stop

stopping criterion

n

maximum number of taxa in simulation

t

maximum time steps of simulation

seed

random number seed (default is to seed based on the clock)

extinct

whether to return trees where all lineages have gone extinct (see Details)

Details

Starting from a root node - i.e., two living lineages - this function simulates the growth of a phylogenetic tree under a uniform, time-homogeneous birth-death process. This means that every lineage has a constant probability of speciating, and a constant probability of going extinct, per unit time. If birth is greater than death, then the number of lineages is expected to grow exponentially. If extinct=FALSE, the function will build trees until one is simulated with at least one surviving lineage.

Value

A phylogenetic tree in 'phylo' format is returned. If death rate is non-zero, then the returned tree will likely include some extinct lineages (terminating before the present day). See drop.extinct for a function to remove these lineages.

Note

One note of caution: it is easy to set parameter values that result in tremendously huge trees. If the function seems to hang up, this could be the problem.

Other tree simulators are available from the packages ape (rbdtree), TreeSim (sim.bd.taxa, sim.bd.age, and sim.bd.taxa.age), and phytools (pbtree).

Author(s)

LJ Harmon and J Weir

See Also

sim.bd for non-phylogenetic simulations; drop.extinct

Examples


# Pure-birth tree
p1 <- sim.bdtree(b=0.1, d=0, stop="time", t=20)
plot(p1)

# Birth-death tree with extinct taxa
# The extinct flag prevents trees with no survivors

p2 <- sim.bdtree(b=0.2, d=0.05, stop="time", t=20, extinct=FALSE)
plot(p2)

# Previous tree with extinct taxa removed
p3 <- drop.extinct(p2)


geiger documentation built on April 4, 2023, 1:07 a.m.