- This line was added.
- This line was removed.
- Formatting was changed.
R: the ape package
It is easy to generate an LTT in R using the ape package. If you haven't already done so, install ape, and load the package:
Then, read the tree using the read.nexus() function and view the tree graphically:
IE.phy=read.nexus("./IEchrono2.nex") # I first changed the working directory to the folder with the tree file plot(IE.phy)
Notice that three extinct lineages are present on this tree: Hittite, Tocharian A, and Tocharian B. The LTT can be used with extinct lineages, but it is more often focused on analyses of extant lineages. Thus, let's drop these three extinct lineages from the tree with the "drop.tip()" function:
IE.phy_extant=drop.tip(IE.phy, c("TOCHARIAN_A","TOCHARIAN_B","HITTITE")) # note the underscore for TOCHARIAN; these are removed for the plot, but need to be in the code plot(IE.phy_extant)
Notice that the three extinct lineages are now removed from the tree.
We are ready to create the LTT, and this is easily done in R. Importantly, however, we need to take the log number of lineages, with the prediction that the log number of lineages will increase linearly with time. Thus,
ltt.plot(IE.phy_extant, xlab="Time", ylab="Log Number of Lineages", main="Lineages Through Time Plot", log="y") # the log=y gives log transformation for the y axis; other arguments are for graphics.
You should see something like this:Image Removed
One might conclude that lineages arose rapidly, there was a period of stability, and then a sharp rise in the number of lineages as we approach the present. This "pull of the present" is also consistent with a relatively high rate of extinction. For an explanation of this effect, see Chapter 8 of the book.
To get more of a sense of how extinction influences the pattern on the LTT, we can also simulate lineages with different speciation and extinction rates. For example, this code uses the rbdtree() function to produce a tree with a speciation rate of 0.2, and an extinction rate of 0.16. With this function all extinct lineages pruned from the tree [cf. rlineages()].
Similarly, this code produces a tree with a speciation rate of 0.2, but no extinction (a Yule model):
tree2= rbdtree(0.2,0,Tmax=30) # Tmax can be lower than above because lineages are not going extinct. plot(tree2) # careful, this could take a while... be patient, or stop the execution if you want to move on.
Now, if we produce an LTT for each of these trees, we should see a more linear relationship for tree2 than for tree1, with the pull of the present producing an apparent "uptick" in speciation toward the present (see Chapter 8).
ltt.plot(tree2, xlab="Time", ylab="Log Number of Lineages", main="Lineages Through Time Plot", log="y")
ltt.plot(tree1, xlab="Time", ylab="Log Number of Lineages", main="Lineages Through Time Plot", log="y")
If you don't see the pull of the present, generate a new tree with a higher extinction rate (relative to speciation). Good luck!
Extra credit: Hone your R skills by trying out Liam Revell's code for LTT. Hint: copy and paste the ltt() function code into R, and then use it.
It is also easy to obtain an LTT in Mesquite (with the Diverse package).
Start by opening Mesquite, and then opening the IEchrono2.nex file from above. Under the "Taxa&Trees" menu, choose "New Tree Window," and select "Default trees." You will see the dated Indo-European tree.
Now, under the Analysis window, simply choose "Lineages through time", and you will see your beautiful creation:Image Removed
You might think it is easier than R. However, the graphics are not as good, and there is substantially less flexibility in the analyses and graphics options.
Other Resources to Explore
The program Phylogen can be used to generate random under a variety of processes, and then to create LTT plots. To my knowledge, however, it is not possible to import a tree and create an LTT from that tree.
Also check out the function plotLtt in the R package laser.
Gray, R. D., and Q. D. Atkinson. 2003. Language-tree divergence times support the Anatolian theory of Indo-European origin. Nature 426:435-439.
Webb, C.O., Ackerly, D.D., and Kembel, S.W. 2007. Phylocom: software for the analysis of community phylogenetic structure and trait evolution. Version 3.41.