geiger (version 2.0.6.2)

sim.bdtree: 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)

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.

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.

See Also

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

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab