Diversitree logo


Comparative phylogenetic analysis of diversification in R. The "diversitree" package includes a number of comparative phylogenetic methods, mostly focussing on analysing diversification and character evolution.

Contains implementations of BiSSE (Binary State Speciation and Extinction: Maddison et al. 2007) and its extension to incompletely resolved phylogenies (FitzJohn et al. 2009), MuSSE (Multiple State Speciation and Extinction) and QuaSSE (Quantitative State Speciation and Extinction: FitzJohn 2010).

For non-anagenetic character evolution, there are two included methods: GeoSSE (Geographic State Speciation and Extinction; Goldberg et al. 2011) and BiSSE-ness (BiSSE-Node Enhanced State Shift: Magnuson-Ford and Otto in press).

The package also includes support for Markov models of character evolution (e.g., Pagel 1994, and Brownian motion) and character-independent speciation/extinction (Nee et al. 1994).

Install diversitree from within R:


or see below for more information, or for installation from source.


Diversitree has been used in a number of studies. If you use diversitree in a paper, please let me know!


A tutorial is available here, which outlines use of the main models. Most of the examples here use simulated data, but to run the shorebird, primates, and chaparral example, you will need a number of files from here.

Additional help is available through R's online help system; type library(help=diversitree) for a list of topics. A PDF version of this manual is available here.

Frequently asked questions and answers are here.

I am starting to convert help for users to small documents if I think that they will be of sufficiently broad interest. See here for a number of documented worked examples using diversitree. (As this grows, please also check here and the faq before emailing.)

It is possible to extend diversitree to add your own models. The way this works changes over time, but some pointers are available in the extending diversitree manual.


Diversitree is released under the GPL, version 2.

It uses the excellent Expokit library for matrix exponential calculations for using BiSSE with terminally unresolved clades, and FFTW (Fastest Fourier Transforms in the West) for QuaSSE calculations.


The citation for diversitree (aside from the individual method's papers) is FitzJohn RG, 2012. Diversitree: comparative phylogenetic analyses of diversification in R. Methods in Ecology and Evolution. In press doi:10.1111/j.2041-210X.2012.00234.x

Releases / Changes

A history of previous releases, and copies of previous versions, can be found here.

Download & installation

The simplest route is to install the package through R:


which will install diversitree from CRAN (current CRAN version: 0.9-1)

Alternatively, diversitree can be installed from source. Download the source package from here (current version 0.9-3).

It is important that this file is not uncompressed by your browser. If the file is downloaded without the "gz" extension, try right-clicking the file and selecting "Save file as" (or similar depending on your browser). Mac users might try

curl -O http://www.zoology.ubc.ca/prog/diversitree/diversitree_0.9-3.tar.gz

from the command line.

This download is a source package only; you will need a working C and Fortran compiler to install the package. (Xcode + gfortran is sufficient on Mac OS X, most Linux systems are probably fine as-is, and on windows consider MinGW or the tools here). First, install the packages deSolve, ape, and subplex From within R, run

install.packages("diversitree_0.9-3.tar.gz", repos=NULL, type="source")

which will compile and install the package.

diversitree is also on github -- github.com/richfitz/diversitree. If you want to play with the sources, this is probably the place to get it. Please let me know if you do though. Also, be aware that I use this as a backup and the version on github may not compile, may work incorrectly, or cause any number of problems for your analyses.

See here for more information and for information about setting up QuaSSE.