Testing continuous rates
One of the major functions in the Brownie library is testing hypotheses about rates of evolution of continuously valued characters. The method for testing hypotheses about rates is discussed in detail by O'Meara et al. (2006). Briefly stated, these methods test for the presence of evolutionary rate shifts on phylogenetic trees. As an example, Collar et al. (2009) used Brownie to test the hypothesis that the development of piscivory (a discrete, binary trait) in centrarchid fishes had a limiting effect on the morphological diversification of key parts of the skull and jaw.
Brownie allows the user to first estimate the rate of continuous trait evolution for groups defined a priori and then test whether the inferred evolutionary rates for each group are meaningfully different. A group can be a clade, or it can be all the branches in a phylogeny for which the mapped character trait has a certain value (e.g. all lineages that are assumed to have the piscivory trait). Currently, there are two options for modelling the evolutionary dynamics of a continuous trait under observation: Brownian motion (BM) and the Ornstein–Uhlenbeck process (OU). Further, Brownie implements two approaches for fitting either of these continuous trait evolution models: the non-censored approach (BM and OU) and the censored approach (BM only) (in RBrownie, see the runNonCensored and runCensored commands, respectively). The two approaches differ in how they treat the branches along which group membership is inferred to have changed.
For either Brownian motion or Ornstein–Uhlenbeck processes, the null hypothesis of both the censored and the non-censored approaches constrains all branches to the same set of parameter values. The alternative hypothesis for the non-censored approach constrains the rate (BM) or mean (OU) parameter to be the same for all branches within each user-specified group, while in the censored approach, the branches on which group changes occur are deleted, and evolutionary parameter values are inferred for each resulting subtree independently. Group membership is assigned either explicitly by a character state that is mapped onto each branch (Huelsenbeck, Nielsen & Bollback 2003) or implicitly by whether or not the branch is included in a subtree which only comprises a subset of all the taxa.
In RBrownie, character states are handled as attributes assigned to each branch of a tree. When character traits change along a branch, that branch is divided into sub-branches that indicate where along the branch the change took place. Character states can be added to trees in R directly through accessor functions, or they can be read in from branch-annotated nexus tree files (Maddison, Swofford & Maddison 1997; Bollback 2006; Supporting Information) similar to those used by mesquite (Maddison & Maddison 2010), allowing a variety of methods to be used to assign state changes to branches. Similarly, RBrownie allows users to define sets of taxa (for implicitly assigning group membership) through accessor functions, or they can be read in from an optional ASSUMPTIONS block within the nexus file. Once group membership and the approach (censored or non-censored) have been specified, maximum likelihood is used to fit a continuous time model to the data under both sets of constraints (the null and the alternative). Finally, the likelihood values that are returned may be compared.
It is important to note that RBrownie is not constrained to operate on a single tree or a single morphological character. For example, when presented with multiple trees, the user can iterate analyses over all possible combinations of trees and/or characters and the same censored or non-censored analysis can be performed on each, giving an indication of the consistency of the results with regard to phylogenetic uncertainty.
Discrete character evolution
When tips are labelled with discrete data, RBrownie can estimate the ancestral states of those data given a particular tree or set of trees (see the runDiscrete command) following the method described in O'Meara (2008; Chapter 3). The design is flexible allowing users to arbitrarily specify rate matrices and state frequency vectors and supports constraining certain elements of the rate matrix to be equal. It also allows state changes to occur explicitly along branches and not only at internal nodes. The number of changes that occur along a branch connecting two nodes can be given an upper limit by the user. Trees are returned with the ancestral states mapped onto the branches, using sub-branches where needed, and flexible plotting functions are provided for visualizing where changes occurred on each branch.