Running Phylip's contrast application for trait pairs from R

Here is some code to run Phylip’s contrast application from R and get the output within R to easily manipulate yourself. Importantly, the code is written specifically for trait pairs only as the regular expression work in the code specifically grabs data from contast results when only two traits are input. You could easily change the code to do N traits. Note that the p-value calculated for the chi-square statistic is not output from contrast, but is calculated within the function ‘PhylipWithinSpContr’....

April 26, 2011 · 2 min · Scott Chamberlain

Phylometa from R: Randomization via Tip Shuffle

—UPDATE: I am now using code formatting from gist.github, so I replaced the old prettyR code (sorry guys). The github way is much easier and prettier. I hope readers like the change. I wrote earlier about some code I wrote for running Phylometa (software to do phylogenetic meta-analysis) from R. I have been concerned about what exactly is the right penalty for including phylogeny in a meta-analysis. E.g.: AIC is calculated from Q in Phylometa, and Q increases with tree size....

April 16, 2011 · 2 min · Scott Chamberlain

Adjust branch lengths with node ages: comparison of two methods

Here is an approach for comparing two methods of adjusting branch lengths on trees: bladj in the program Phylocom and a fxn written by Gene Hunt at the Smithsonian. Get the code and example files (tree and node ages) at Get phylocom at Gene Hunt’s method has many options you can mess with, including setting tip ages (not available in bladj), setting node ages, and minimum branch length imposed....

April 10, 2011 · 2 min · Scott Chamberlain

Phylometa from R - UDPATE

A while back I posted some messy code to run Phylometa from R, especially useful for processing the output data from Phylometa which is not easily done. The code is still quite messy, but it should work now. I have run the code with tens of different data sets and phylogenies so it should work. I fixed errors when parentheses came up against numbers in the output, and other things. You can use the code for up to 4 levels of your grouping variable....

April 1, 2011 · 2 min · Scott Chamberlain

Check out

They have online seminars that you can join in on live, and watch later as recorded videos. Check it out at

March 4, 2011 · 1 min · Scott Chamberlain

Phylogenetic analysis with the phangorn package: an example

The phangorn package is a relatively new package in R for the analysis and comparison of phylogenies. See here for the Bioinformatics paper and here for the package. Here is an example of using phangorn from getting sequences to making phylogenies and visualizing them:Getting sequences from GenbankMultiple alignmentMaximum likelihood tree reconstructionVisualizing treesVisualizing trees and traitsMake fake traits:Visualize them on trees:

February 21, 2011 · 1 min · Scott Chamberlain

New approach to analysis of phylogenetic community structure

Anthony Ives, of University of Wisconsin-Madison, and Matthew Helmus of the Xishuangbanna Tropical Botanical Garden, present a new statistical method for analyzing phylogenetic community structure in an early view paper in Ecological Monographs. See the abstract here. Up to now, most phylogenetic community structure papers have calculated metrics and used randomization tests to determine if observed metrics are different from random. The approach of Ives and Helmus fits models to observed data, instead of calculating single metrics....

January 5, 2011 · 1 min · Scott Chamberlain

Phylogenetic meta-analysis in R using Phylometa

Here is some code to run Phylometa from R. Phylometa is a program that conducts phylogenetic meta-analyses. The great advantage of the approach below is that you can easily run Phylometa from R, and manipulate the output from Phylometa in R. Phylometa was created by Marc Lajeunesse at University of South Florida, and is described in his 2009 AmNat paper. Phylometa can be downloaded free here. Save phylometa_fxn.R (get here) to your working directory....

December 28, 2010 · 3 min · Scott Chamberlain