MOTMOT: models of trait macroevolution on trees


Correspondence author. E-mail:


1. Models of trait macroevolution on trees (MOTMOT) is a new software package that tests for variation in the tempo and mode of continuous character evolution on phylogenetic trees. MOTMOT provides tools to fit a range of models of trait evolution with emphasis on variation in the rate of evolution between clades and character states.

2. We introduce a new method, trait MEDUSA, to identify the location of major changes in the rate of evolution of continuous traits on phylogenetic trees. We demonstrate trait MEDUSA and the other main functions of MOTMOT, using body size of Anolis lizards.

3. MOTMOT is open source software written in the R language and is freely available from CRAN (


Phylogenetic trees describe the evolutionary relationships among taxa but also contain information on variation in the tempo and mode of evolution among lineages and through time. Identifying variation in rates of phenotypic evolution on phylogenies provides an important step in revealing the mechanisms that have generated differences in the temporal, geographic and taxonomic distribution of biological diversity over large spatial and temporal scales. We introduce models of trait macroevolution on trees (MOTMOT), a new package written in the R programming language (R Development Core Team 2010), that provides methods for assessing patterns in the tempo of continuous trait evolution on phylogenetic trees. MOTMOT uses transforms of phylogenetic branch lengths to test for non-Brownian trait evolution and complements several other R packages notably GEIGER (Harmon et al. 2008), ape (Paradis, Claude, & Strimmer 2004) and caper (Orme et al. 2011). We demonstrate some of the main uses of MOTMOT using body size evolution in Caribbean Anolis.

Brownian motion and models of trait evolution

MOTMOT uses statistical models of trait evolution based on Brownian motion. Brownian motion has been described in the context of phylogenetic trait evolution numerous times (e.g. Felsenstein 1973; Freckleton, Harvey, & Pagel 2002; O’Meara et al. 2006), so we keep the description here brief. The central tenet is that the magnitude and direction of changes in trait values are independent of the current state of the character and have an expected mean change of zero. Trait variance accumulates linearly with time, and the expected covariances of related species are proportional to the amount of shared evolutionary history (phylogenetic branch length). Hansen & Martins (1996) showed that the Brownian model adequately describes the expected covariances among related species under some microevolutionary models including random genetic drift, random punctuated change, directional selection and stabilising selection with a shifting optimum. Under such models, the Brownian variance (σ2) can be taken as a measure of the average rate of evolution (Garland 1992; McPeek 1995; O’Meara et al. 2006; Thomas, Freckleton, & Székely 2006).

The unbiased estimate of σ2 can be obtained using generalised least squares (GLS; e.g., Pagel 1997; Garland & Ives 2000; Freckleton, Harvey, & Pagel 2002),

image(eqn 1)

where n is the number of tips, y is an × 1 vector of trait values at the tips, inline image is an × 1 vector of the phylogenetic mean for the trait (under Brownian motion, this is the estimated state at the root), V is the variance–covariance matrix representation of the phylogenetic tree and X is an × 1 vector of ones in the constant rate Brownian model but can be treated as a design matrix in heterogeneous rate models where rate varies according to the state of a discrete trait (see Thomas, Freckleton, & Székely 2006; Thomas, Meiri, & Phillimore 2009). The fit of the Brownian model to trait data and a phylogeny can be assessed with the log-likelihood equation

image(eqn 2)

Evaluation of the log likelihood with eqn 2 can be prohibitively slow for large data sets. However, for the Brownian model, GLS approaches are exactly equivalent to phylogenetically independent contrasts (Felsenstein 1973; Garland & Ives 2000; Freckleton & Jetz 2009). Following Freckleton & Jetz (2009), eqn 2 then becomes

image(eqn 3)

where ui is the unstandardised contrast at node i and Vi is the corresponding expected variance following Felsenstein (1985). Phylogenetically independent contrasts allow rapid evaluation of the log likelihood, even for trees with thousands of tips. It is possible to extend the contrasts method to multivariate data sets,

image(eqn 4)

where W is the k × k covariance matrix for the standardised contrasts with elements calculated as follows:

image(eqn 5)

in which uj,i is the contrast for trait j at node i.

The likelihood equations above assess the fit of the Brownian motion model to the data and phylogeny; however, we are generally more interested in identifying non-Brownian evolution. The expected covariances among species can be altered by adjusting the phylogenetic branch lengths, and the fit of alternative models can be used to test for the different modes of evolution (Grafen 1989; Garland, Harvey, & Ives 1992; Pagel 1992, 1994, 1997, 1999; Mooers & Heard 1997; Blomberg, Garland, & Ives 2003; Thomas, Freckleton, & Székely 2006; Harmon et al. 2010; Ingram 2011).

MOTMOT functionality

MOTMOT fits a range of models of trait evolution (see Table 1) and has two main functions for parameter estimation. The first, transformPhylo.ML, optimises the likelihood of uni- or multivariate data using the independent contrasts method (eqns 3 and 4). This allows rapid fitting of the models of trait evolution listed above (also Table 1) that assume a single mean value across all taxa. We use the L-BFGS-B routine (Byrd et al. 1995) in the optim function (stats library) for optimisation. This allows upper and lower bounds on parameters. The free model (Mooers, Vamosi, & Schluter 1999) is over-parameterised, so finding the optimum branch scaling is difficult and slow. The free model in MOTMOT should only be used to give a rough visualisation of rate variation on the phylogeny.

Table 1.   Models of trait evolution available in models of trait macroevolution on trees (MOTMOT)
ModelTests forMOTMOT FunctionMultivariate
  1. 1Pagel (1997); 2Hansen (1997); 3Ingram (2011); 4Thomas, Freckleton, & Székely (2006); Thomas, Meiri, & Phillimore (2009, 2009); 6O’Meara et al. (2006); 7Alfaro et al. (2009); 8Mooers, Vamosi, & Schluter (1999).

λ1Phylogenetic signaltransformPhylo.MLYes
α2Constraints or strength of selectiontransformPhylo.MLYes
κ1Speciational vs. gradual evolutiontransformPhylo.MLYes
ψ3Speciational vs. gradual evolutiontransformPhylo.MLYes
δ1Temporal change in ratetransformPhylo.MLYes
Hypothesised clade or trait-dependent rate shift (single mean)4–6Rate variation between lineagestransformPhylo.MLYes
Hypothesised clade or trait-dependent rate shift (multiple means)4–6Rate variation between lineagesML.RatePhyloNo
Clade rate shifts4–7Location and magnitude of rate shiftstransformPhylo.MLYes
Free8Independent branch ratestransformPhylo.MLYes

The second maximum likelihood function, ML.RatePhylo, implements methods described by Thomas, Freckleton, & Székely (2006), Thomas, Meiri, & Phillimore (2009) in which rates of trait diversification are expected to vary according to the state of a discrete trait. There are several ways in which the rate of evolution may vary among species within clades or groups of taxa (Fig. 1). First, the relative rate of evolution differs because of trait divergence among species (disparification) of one group compared to one or more other groups (Fig. 1a and b). However, changes in rate may also occur in the absence of any net divergence among focal species, for example, if there is a major change in the direction of trait evolution in the root branch but no subsequent divergence among taxa in the clade (Fig. 1c compared with Fig. 1a). Alternatively, there may be continued directional change along all branches; this change is in the same direction in each branch but with no net divergence among taxa compared with the null (Fig. 1d compared with Fig. 1a). Fig. 1c and d are characterised by a change in the mean trait value but no net change in divergence among taxa.

Figure 1.

 Forms of rate variation of traits. The rate of evolution among species is faster in (b) than in (a) but the mean is identical. The rate of evolution of among species evolution in (c) and (d) is similar to (a) but the means differ. In (c), the mean differs because of directional change in the stem lineage, whereas in (d), the mean differs because of directional change in all branches.

The function ML.RatePhylo allows the user to test for different forms of rate shift by explicitly modelling differences in mean between groups. This cannot be readily achieved using independent contrasts because it also requires specification of a design matrix (see Thomas, Meiri, & Phillimore 2009). We therefore use the GLS log-likelihood function (eqn 2) and optimise using the L-BFGS-B routine optim in ML.RatePhylo.

In addition to hypothesis testing, MOTMOT’s transformPhylo.sim function also allows the user to simulate trait evolution under all of the models described above.

Identifying Rate Shifts

While rate variation models are typically used as hypothesis tests, we frequently have no a priori expectation on the location or number of rate shifts. We take inspiration from a recent method [Modelling Evolutionary Diversification Using Stepwise AIC (MEDUSA)] for identifying the position and magnitude of shifts in the rate of lineage diversification (Rabosky 2006; Alfaro et al. 2009) and apply an analogous approach to rate shifts in continuous character diversification. The trait medusa algorithm 1 (tm1 algorithm) in the transformPhylo.ML function proceeds as follows: (1) evaluate the likelihood of a single-rate Brownian model; (2) fit rate heterogeneous models and evaluate the likelihood at each node in the phylogeny (one at a time) where the second rate is permitted in all branches descended from the focal node plus the stem branch leading to that node (new shifts are inferred only as monophyletic groups); (3) select the best-fitting two-rate model; (4) fit rate heterogeneous models with two-rate shifts where one of the shifts must occur at the node identified in step 3 (each additional shift defines a monophyletic set of taxa but rate shifts can be nested); (5) continue this procedure until a user-defined maximum number of rate shifts has been reached; (6) select the preferred model from the set of best-rate heterogeneous models using the Akaike Information Criterion (AIC). The number of parameters is equal to the total number of rates estimated plus the number of rate shifts inferred. For example, a model with two-rate shifts has three rates and hence five parameters in total.

In the interests of computational efficiency, the tm1 algorithm uses independent contrasts. As a result, the tm1 algorithm searches for clade-wide rate shifts but cannot model differences in means between groups in the same way as ML.RatePhylo. However, we only infer clade (rather than polyphyletic group) shifts, so the possibility of directional trait change rather than net trait divergence can be tested by allowing rate shifts on the stem branch leading to a clade. The ‘clade’ option in transformPhylo.ML permits post hoc tests of single-branch vs. clade-wide rate shifts. Alternatively, the tm2 algorithm provides a more thorough model fitting procedure. The tm2 algorithm proceeds in the same way as tm1; however, at each node, it evaluates the fit of the standard clade-wide shift (as described for tm1 above) and a single-branch shift where the rate shift occurs only on the stem branch leading to the focal node. At each step, the best model is chosen by comparison of all clade-wide and single-branch models. In subsequent steps (three-rate, four-rate and so on), it is possible to revisit, for example, a node with a previously inferred clade-wide rate shift and test additionally for a single-branch shift. Consequently, the final model can contain any combination of single-branch and clade-wide shifts including both shift types at the same nodes.

For large trees, the number of possible rate shifts is high. MOTMOT allows the user to restrict search space by (1) setting an upper limit on the number of rate shifts to infer; (2) specifying a minimum clade species richness such that the rate shift search does not proceed within smaller clades; and (3) listing specific clades within which no further rate shifts should be inferred.

The final preferred multiple rate model is determined by comparison of the Akaike Information Criterion (AIC, or its small sample alternative, AICc; Akaike 1973; Burnham & Anderson 2002). The choice of a suitable cut-off value for ΔAIC is not trivial. This is because the number of potential nodes at which rate shifts could occur will increase with increasing tree size and if the user decreases the minimum clade size. Consequently, the probability of falsely inferring at least one rate shift is likely to be high and to scale with the number of available nodes in the tree. We conducted simulations to assess a suitable ΔAIC and the accuracy of shift localities. Full details of the simulations are provided as Supporting Information. In brief, a suitable cut-off for ΔAICc (i.e. large enough to reject the null at α = 0·05) declines as the number of possible shift locations declines (Fig. 2a). Even with a high ΔAICc cut-off, the power to detect real rate shifts remains reasonably high (60–70%; Fig. 2b) and the location of shifts is generally inferred accurately (Fig. 2c), although the latter is affected by minimum clade size (see Supporting Information).

Figure 2.

 Simulation results for trait Modelling Evolutionary Diversification Using Stepwise AIC. (a) Estimated ΔAIC values at α = 0.05 for tm1 and tm2 algorithms with minimum clade sizes of 1, 2, 5, 10 and 20 based on data simulated under a constant rate Brownian model. (b) Violin plots showing the frequency distribution of estimated ΔAIC for data with a single-rate shift five times faster than the background rate. The area below the red line indicates the proportion of simulated data sets where the constant rate model could not be rejected. (c) Frequency distribution showing the distance (in number of nodes) between the inferred rate shift node and the actual rate shift node for the tm1 algorithm with a minimum clade size of five. The figure shows data for the 82% of simulated data sets where the inferred node nested (positive values) or was nested within (negative values) the true-rate shift node.

Body size evolution in Greater Antillean Anolis

The radiation of Anolis lizards in the Caribbean has become a classic model system for studying adaptive radiations and macroevolutionary trends with particular interest in the repeated evolution of ecomorphs on different islands (Losos 2009). We use a recently published data set of maximum adult snout-vent length (hereafter body size) measurements for male Anolis (Thomas, Meiri, & Phillimore 2009) and a molecular phylogeny (pruned from the larger tree in Nicholson et al. 2005) to demonstrate some of the main functionality of MOTMOT. The data, phylogeny and annotated R scripts are provided as online Supporting Information.

Models of Trait Evolution

We compared the fit of the Brownian model,

transformPhylo.ML (data, phy=phylogeny, model=‘bm’), to λ (model=‘lambda’), α (model=‘OU’), κ (model=‘kappa’), ψ (model=‘psi’) and δ (model=‘delta’) for log body size. Although all models, with the exception of OU, fit the data better than the Brownian model, the improvement in likelihood is not sufficient to reject Brownian motion (Table 2).

Table 2.   Parameter estimates and model fit for Anolis male body size
ModelML parameter estimate (approx. conf. int.)Maximum likelihoodLRT vs. bm
  1. Model comparison with the Brownian (bm) null is by likelihood ratio test (LRT) with one degree of freedom. All LRTs were nonsignificant.

λ0·991 (0·953–1)84·4532·125
α0·000 (0·000–0·005)83·3910·000
κ1·040 (0·775–1·256)83·4430·105
ψ0·019 (0·000–0·103)84·3491·916
δ0·696 (0·145–1·426)83·7720·763

Rate Variation

We tested for rate variation in male body size first in relation to geography and second using the tm1 and tm2 algorithms. For the geographic analyses, we compared rates between species from the four main islands of the Greater Antilles (Cuba, Hispaniola, Jamaica, Puerto Rico) using the ML.RatePhylo function. We used the ancestral state reconstruction of island occupancy in Mahler et al. (2010) to assign all internal branches to one of the four islands where each internal node has a single fixed value (unlike Mahler et al. who allowed uncertainty in ancestral states in their models). We fitted a single-rate model while assuming a single mean across all taxa,

ML.RatePhylo(rateData, fixed=c(1,FALSE,FALSE, FALSE), pretty=TRUE, common.mean=TRUE),

and found no evidence for rate heterogeneity (log likelihood = 84·650, LRT vs. Brownian = 2·518, P = 0·472, d.f. = 3). We then fitted a single-rate model while allowing means to differ between islands:

ML.RatePhylo(rateData, fixed=c(1,FALSE,FALSE, FALSE), pretty=TRUE, common.mean=FALSE).

We again found no evidence for rate heterogeneity across species from the four islands (log likelihood = 86·997 LRT vs. Brownian with multiple means = 2·209, P = 0·530, d.f. = 3).

For the tm1 and tm2 algorithms, we set the maximum number of possible rate shifts to 10 but did not impose a minimum clade size:

transformPhylo.ML(data, phy=phylogeny, model=‘tm1’, minCladeSize=1, nSplits=10).

The best-rate shift model (based on an AICc cut-off of nine as determined by the simulations described above) identified two-rate shifts (Fig. 3a) for the tm1 algorithm and three-rate shifts for the tm2 algorithm (Fig. 3b). The first two-rate shifts using the tm2 algorithm occur at the same nodes as the two shifts identified using tm1. The tm2 algorithm additionally identified a substantial rate shift on a single branch. We note that if we use a more liberal AICc cut-off of four, the tm1 method also identifies a rate shift at this node but is limited to inference of a clade-wide rate shift (results not shown). We also note that the first rate shift using tm1 and tm2 (node 1 in Fig. 3) pertains to two taxa with identical trait values. It seems unlikely that the species genuinely have identical body sizes, and this may reflect crude measurement and/or rounding error.

Figure 3.

 Body size rates shifts in Caribbean Anolis. (a) Rate shifts inferred from the tm1 algorithm. (b) Rate shifts inferred from the tm2 algorithm and tm1 with post hoc single-branch testing. Branch lengths are scaled according to the maximum likelihood relative rate estimates (inset table) and coloured according to low (blue), high (red) or background (black) rates.


R is rapidly becoming the default platform for phylogenetic comparative analyses. MOTMOT complements the growing number of phylogenetic R packages. Here, we have demonstrated the main functionality of MOTMOT using Anolis of the Caribbean as an example. This functionality can readily be extended to incorporate any trait evolution model based on transformations to the branch lengths of the phylogeny.


We thank David Orme, Luke Harmon and Emanuel Paradis whose R packages (caper, GEIGER and ape) underpin much of the code in MOTMOT; Luke Harmon, Matt Pennell, David Orme and two anonymous reviewers for their insightful reviews; and Travis Ingram, Albert Phillimore, Annat Haber and Chris Vendetti for additional helpful discussion and comments on the methods, code and manuscript. This work was funded by a Natural Environment Research Council (NERC, UK) Postdoctoral Research Fellowship (grant number NE/G012938/1) and Royal Society Grant (grant number RG0870720) to GHT.

Supporting Information

Additional Supporting Information may be found in the online version of this article.

Data S1. Full simulation results for trait MEDUSA and comparison of run times to fit models of trait evolution in MOTMOT and GEIGER.

As a service to our authors and readers, this journal provides supporting information supplied by the authors. Such materials may be re-organised for online delivery, but are not copy-edited or typeset. Technical support issues arising from supporting information (other than missing files) should be addressed to the authors.