Using phylogenetics to study diversification in R

Time-calibrated phylogenies can provide a very useful tool for exploring the diversification of species through time, as they provide a historical record of the branching pattern over time. Results from such undertakings can be influenced by a variety of factors and it’s important to consider their effects on diversification patterns. This tutorial is designed to provide a first introduction to diversification studies in R at hand of lineage-through-time (LTT) plots.

What are lineage-through-time plots?

LTT plots provide a convenient tool to record the number of lineages ant any given time slice in the evolutionary history of the clade in question. Let’s take a look by means of a quick simulation.We have encountered tree simulators in the ape and phytools package so far. Let’s stick to the phytools approach here but note that there are other methods out there (geiger, TreeSim).

# loading libraries

#simulating a tree
phy <- pbtree(b=1, d=0, t=4) #we are using the time stop criterion (as opposed to number of taxa)

#plotting tree and LTT
par(mfrow=c(2,1), mar=c(4,7,1,7))
plot(phy, show.tip.label=FALSE)
div <- ltt(phy, plot=TRUE)

As the number of lineages is expected to increase exponentially through time, we are using the log-scale on the y-axis. We see in the above figure that the slope of the LTT-line changes over time, and this change is actually very informative with respect to the rate of diversification. The slope of the LTT line signifies how fast diversity is increasing, i.e., the steeper the line, the faster the diversification.

Explore 6 different values for birth rate, keeping death rate at 0, and plot the resulting LTT curves in a multi-panel figure. What are differences between the LTT curves?

Simulate 100 trees with the same birth rate (keep death rate=0) and simultaneously plot all LTT curves in the same diagram.

Using the same set of trees, which all had constant birth rate and had the same amount of time to evolve, how many species were “produced” in each? Please illustrate with a histogram displaying the number of tips across your tree sample.

[Hint: use the Ntip() function of the ape-package to extract species numbers.]

How would the LTT plot appear if the branching would have happened much earlier? We can take a look at this by rescaling the tree from above with a transformation factor that changes the length of the internal branches, called lambda. Pagel’s lambda rescales the tree so that the internal branches become shorter yet the terminal edges are lengthend so that all lineages end at time=0.

phy.alt <- rescale(phy, "lambda", 0.3) #rescaling the tree
par(mfrow=c(2,1), mar=c(4,7,1,7))
plot(phy.alt, show.tip.label=FALSE)
alt.div <- ltt(phy.alt, plot=TRUE)

This may be an evolutionary unlikely scenario but nevertheless serves well to illustrate the connection between the shape of the LTT plot and the underlying diversification pattern. THe above figure shows that we had an initially very high rate of diversification and then absolutely no further increase.

Both speciation and extinction drive diversification patterns

Now, what is missing from our simulations so far? Diversification is not only formed by splitting of lineages (speciation), but obviously also by extinction of lineages! The net diversification therefor is formed by speciation and extinction. If b is the birth rate and d the extinction rate, the net diversification rate is given by b-d.

Let’s investigate how the presence of extinct lineages may influence the pattern of diversification. Let’s simulate a tree with some lineages that don’t make it to the present day and plot the LTT’s with and without them to compare.

Vary both birth and death rate to get a better feeling for how speciation and extinction join to drive diversification patterns. One example is given below, but please produce at least 4 additional combinations.

#simulating tree with extinction
phy.all <- pbtree(b=1, d=0.6, t=5)

#cutting extinct lineages
extinct <- getExtinct(phy.all)
phy.extant <- drop.tip(phy.all, extinct)

#plotting tree and LTT, left panel with, and right panel without extinct lineages
par(mfrow=c(2,2), mar=c(4,4,1,4))

plot(phy.all, show.tip.label=FALSE)
plot(phy.extant, show.tip.label=FALSE)

all <- ltt(phy.all, plot=TRUE, col="red", ylim=c(0,4))
extant <- ltt(phy.extant, plot=TRUE, col="blue", ylim=c(0,4)) #how else can you generate this plot?

Let’s stop here and discuss as a group how these LTT plots compare.

1) What are the differences between the LTT plots with and without extinct lineages?

2) Can you imagine scenarios where the LTT plots might be drastically different?

3) What may indicate the role of extinction in the shape of trees and the corresponding LTT curve?

Solutions to problems can be found here!