Sources

R packages

"diversitree" (FitzJohn 2012)

Codes

Example 1: the simple BiSSE model

The binary-state speciation and extinction (BiSSE) model is a powerful framework to model and analyze diversification where the speciation and extinction rates vary with respect to a binary trait (taking values 0 or 1) which itself evolves under a Markov model (see detailed description in the book). We define the parameter values such that the speciation rate is the same for both states (λ = 0.1), the extinction rate (μ) is larger for species in state 0 (0.05) than in state 1 (0.01), and the transition from 0 → 1 is slower than the transition 1 → 0 (0.05 and 0.1, respectively).

library(diversitree)
pars <- c(0.1, 0.1, 0.05, 0.01, 0.05, 0.1)
res <- tree.bisse(pars, max.taxa = 100)
res
## 
## Phylogenetic tree with 100 tips and 99 internal nodes.
## 
## Tip labels:
## 	sp5, sp8, sp9, sp10, sp16, sp17, ...
## Node labels:
## 	nd1, nd2, nd3, nd6, nd7, nd9, ...
## 
## Rooted; includes branch lengths.

The output is a tree which can be plotted or further examined with the usual functions in ape. Furthermore, this tree has additional elements specific to the simulations. For instance, we can see that most species are in state 0 at the end of the simulation:

table(res$tip.state)
## 
##  0  1 
## 65 35

Thus, even though species in state 0 go extinct faster than those in state 1, they are more abundant because state 1 is more unstable.

References