Models Of Trait Macroevolution On Trees (MOTMOT) is an R package that allows for testing of models of trait evolution (Thomas et al. 2012).

# Introduction

First we install

``install.packages("motmot")``

``library(motmot)``

For these examples we will use anoles lizard data available from MOTMOT. A time-calibrated phylogeny of Anolis species `anolis.tree`, and various trait and biogeographical trait data `anolis.data`.

``````data(anolis.tree)
data(anolis.data)
attach(anolis.data)
anolis.tree``````
``````##
## Phylogenetic tree with 165 tips and 164 internal nodes.
##
## Tip labels:
##  A_occultus, A_darlingt, A_monticol, A_bahoruco, A_dolichoc, A_henderso, ...
## Node labels:
##  2, 2, 2, 2, 2, 2, ...
##
## Rooted; includes branch lengths.``````

We will use the continuous trait data: male snout-ventral length `Male_SVL`. Here, we construct a matrix of just `Male_SVL` data, remove missing data, and log-transform the values. All this can be done using the function `sortTraitData`

``````sortedData <- sortTraitData(phy = anolis.tree, y = anolis.data,
data.name = "Male_SVL", pass.ultrametric = TRUE)
phy <- sortedData\$phy
male.length <- sortedData\$trait``````

Finally, we will ‘prune’ the species from the tree using `drop.tip` from APE. We plot our tree and data using the MOTMOT `traitData.plot` function.

``````traitData.plot(y = male.length, phy = phy, lwd.traits = 2,
col.label = "#00008050", tck = -0.01, mgp = c(0, 0.2, 0),
cex.axis = 0.5, show.tips = FALSE)`````` Figure 1. TraitData showing the realtive male snout-vent length at the tips

For the sake of brevity, in the following examples we fit the models to a subset of these data: including the clade from node 182 only using the APE function `extract.clade`.

``````## uncomment to view the tree
# plot(phy, show.tip.label=FALSE, no.margin=TRUE, edge.col="grey20")
# nodelabels(182, 182, bg="black", col="white")

# Models of trait evolution

We can now test various models of evolution using our trait data.

## Brownian motion

To start we will fit a simple Brownian motion model to the data, as the null hypothesis of phylogenetic trait evolution (Cavalli-Sforza and Edwards 1967; Felsenstein 1973; 1985). Brownian motion describes a process in which tip states are modelled under the assumption of a multi-variate normal distribution. On a phylogeny, the multi-variate mean of tip states is equal to the root state estimate, and variance accummulates linearly through time. Trait evolution is shared but following a split individual branches evolve and accummulate trait variance independently from their shared ancestral value.

The function `transformPhylo.ML` is used to fit Brownian motion models and its derivatives. Here we fit a simple Brownian motion model to the subset of anolis male SVL data to obtain the Brownian variance, ancestral estimate, log-likelihood, Akaike Information Criterion (AIC), and small-sample AIC (AICc).

``````bm.ml <- transformPhylo.ML(phy = phy.clade, y = male.length.clade, model = "bm")
bm.ml``````
``````## \$brownianVariance
##             [,1]
## [1,] 0.001858067
##
## \$logLikelihood
##  -0.2838382
##
## \$root.state
##  3.849481
##
## \$AIC
##  4.567676
##
## \$AICc
##  5.047676
##
## attr(,"class")
##  "bm.ML"``````

## Pagel’s lambda

Here we fit models to test Pagel’s lambda (Pagel 1997; 1999). Pagel’s lambda is a measure of phylogenetic ‘signal’ in which the degree to which shared history of taxa has driven trait distributions at tips. In this model, internal branch lengths are transformed by the lambda parameter value. When the parameter lambda equals 1, branches are transformed by multiplying by 1 and so the model is equal to Brownian motion (high phylogenetic signal). Values of lambda under 1 suggest there has been less influence of shared history on trait values at the tips. Finally, a lambda value of 0 indicates no phylogenetic influence on trait distributions, and is equivalent to a ‘star phylogeny’ with no shared branch lengths.

The maximum likelihood of lambda can be estimated in MOTMOT.

``````lambda.ml <- transformPhylo.ML(phy = phy.clade, y = male.length.clade,
model = "lambda")
lambda.ml``````
``````## \$MaximumLikelihood
##  6.522191
##
## \$Lambda
##      MLLambda   LowerCI   UpperCI
## [1,] 0.836999 0.5259423 0.9742338
##
## \$brownianVariance
##              [,1]
## [1,] 0.0008245375
##
## \$root.state
##  3.853432
##
## \$AIC
##  -7.044383
##
## \$AICc
##  -6.044383
##
## attr(,"class")
##  "lambda.ML"``````

The maximum likelhood estimate of Pagel’s lambda is equal to 0.84.

A new feature in MOTMOT allows for plotting of the likelihood profile for the branch-transformation parameter, in this case Pagel’s lambda using the argument `profilePlot` in `transformPhylo.ML`.

``````lambda.ml <- transformPhylo.ML(phy = phy.clade, y = male.length.clade,
model = "lambda", profilePlot = TRUE)``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.629741,"math_prob":0.94120336,"size":4710,"snap":"2021-04-2021-17","text_gpt3_token_len":1347,"char_repetition_ratio":0.11708457,"word_repetition_ratio":0.055240795,"special_character_ratio":0.2942675,"punctuation_ratio":0.19825707,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9747333,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-24T18:53:14Z\",\"WARC-Record-ID\":\"<urn:uuid:9a0e340d-078c-4bd1-a632-aeb1f0ff9ae1>\",\"Content-Length\":\"1049004\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c970c491-84e6-47f3-8f05-ae49310ca81a>\",\"WARC-Concurrent-To\":\"<urn:uuid:5ae49491-30ec-4cfc-8b3d-2b98bc35989d>\",\"WARC-IP-Address\":\"40.118.246.51\",\"WARC-Target-URI\":\"https://mran.revolutionanalytics.com/snapshot/2020-04-25/web/packages/motmot/vignettes/motmot.html\",\"WARC-Payload-Digest\":\"sha1:5FPC32JPAQWN25SDIUAK3QOWJF4WWMIC\",\"WARC-Block-Digest\":\"sha1:CFZWN3SSFB2RA2GK67H2EHSL7FMOZNR7\",\"WARC-Truncated\":\"length\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703550617.50_warc_CC-MAIN-20210124173052-20210124203052-00327.warc.gz\"}"}