Testing Evolutionary Hypotheses

Morphometrics Lesson 7

Author

Ryan N. Felice

Introduction

When we collect shape data, it is usually because we have some kind of hypothesis in mind that we wish do test. For example:

  • Shape is correlated with some predictor variable (e.g., bite force, body mass)

  • Shapes are different between groups (dietary groups, taxonomic groups, geographic or temporal groups)

  • Shape evolves with a different tempo and mode in different groups (e.g., skull shape evolves faster in carnivores than herbivores)

These types of hypotheses are really easy to test when we have a simple scalar measurement of phenotype (e.g., body mass) or even two measurements (e.g., brain size and body mass), but when our trait of interest is multidimensional (like shape data is) it is a lot more challenging. One option would be to reduce the dimensionality of your data using PCA or some other ordination, and then analyse your PC scores. The problem is that you miss out on some of the variation in your data, including the potentially important correlations among the landmarks.

Luckily, there are a handful of methods that now allow us to do phylogenetic comparative methods (and non-phylogenetic statistical tests) using morphometric data directly. In lessons 3 and 5 we saw some of the different R packages that can do this (mvols, lm.rrpp, procd.lm). Let’s practice with some realistic hypothesis tests using the croc data from lession 6.

Load packages

Load data

#import data:
raw_data<-read.csv('./Data/crocs.csv',row.names = 1)
shape_data <- arrayspecs(raw_data, p=ncol(raw_data)/3, k=3)
#remove one specimen that has no ecology data:
bad_specimen <- which(dimnames(shape_data)[[3]]== "Crocodylus_biporcatus")
shape_data <- shape_data[,,-bad_specimen]
#phylogeny:
phylo1 <- read.nexus('./Data/CrocTree2.nex')
#ecological data
eco_dat <- read_csv('./Data/croc_ecology_data.csv')
#make sure tips and data are in same order
shape_data <- shape_data[,,eco_dat$Tip_label]
#do procrustes alignment
gpa <- gpagen(shape_data)

Ecomorphology Hypothesis

Remember from lesson 6 that our croc species fell into 3 broad dietary niches

levels(as.factor(eco_dat$Diet2))
[1] "Carnivore"          "Omnivore/Herbivore" "Piscivore"         

We might ask “is skull shape significantly different across these three groups?”

A straightforward way to test this is with the geomorph package using the function procD.lm

diet_groups<-eco_dat$Diet2
names(diet_groups) <- eco_dat$Tip_label #make sure your data is always labeled properly
my_data <- geomorph.data.frame(shape = gpa$coords,
                               diet = diet_groups)
test1 <- procD.lm(shape~diet,data=my_data,
                    print.progress = FALSE)
summary(test1)

Exercise: look at the output of the summary. What can you say about your hypothesis at this point? how would you write that in a results section?

Phylogenetic Regressions

We have made progress on testing our hypothesis, but we have left out an important detail: we have ignored the fact that some of the variation in shape is likely to be due to shared ancestry rather than diet. When we have multiple species/lineages, we should really be incorporating phylogenetic covariance. We can also do this with the same geomorph R package by using the function procD.pgls

my_data <- geomorph.data.frame(shape = gpa$coords,
                               diet = diet_groups,
                               phy = phylo1)
test2 <- procD.pgls(shape~diet,
                    data = my_data,
                    phy = phy,
                    print.progress = FALSE)
summary(test2)

Exercise: Interpret the results of the summary. What does this tell you about the relationship between skull shape, diet, and size?

We also know something about the size of the specimens, based on the centroid size calculation that is a product of the Procrustes analysis. Let’s also include that as a covariate.

my_data <- geomorph.data.frame(shape = gpa$coords,
                               diet = diet_groups,
                               phy = phylo1,
                               logCsize = log(gpa$Csize))
test3 <- procD.pgls(shape~logCsize*diet,
                    data = my_data, 
                    phy= phy,
                    print.progress = FALSE)
summary(test3)

Model Comparisons

In this case, it seems clear which hypothesis best describes the correlates of skull shape variation, But it is good to do an explicit model comparison. In this case we will use Akaike Information Criterion (AIC), which measures a model’s ability to fit the data and penalises more complex models. It’s calculated like this

\[AIC = -2ln(Likelihood) + 2k\]

Where k is the number of model parameters. We want the model with the lowest AIC score. Let’s take a look:

#one more slightly slimpler model
test4 <- procD.pgls(shape~logCsize, data = my_data, phy= phy)
model.comparison(test2, test3, test4, type='logLik')

Exercise: 1) Interpret the results of model.comparison and decide which model is best. 2) We also have habitat information in eco_dat. Try to fit phylogenetic regressions with habitat and habitat*size and use the model.comparison function to compare to test2, test3, and test4.

Evolutionary Rates Hypotheses

What we have done so far is to probe the question “is skull shape significantly different in carnivores, omnivores, and piscivores?” and “is skull shape correlated with skull size?”. Another question we might have is “does skull shape evolve at different rates in carnivores, omnivores, and piscivores?” One reason we might expect different rates in different groups is some kind of constraint. For example, maybe we think that specialist diets (like piscivory) have a restricted range of viable phenotypes and thus rarely change shape. Alternatively, we might hypothesize that transitioning into a new ecological niche involves rapid change, as in adaptive radiations.

Before we test these hypotheses, it can be good to compare morphological disparity among the groups of interest. The idea here is that variation is the result of change over time. If we know one group has achieved a lot of variation compared to another group over the same amount of shared evolutionary time, it might be because it evolved fast.

Lets look at disparity across our groups:

morphol.disparity(shape ~ logCsize, groups= ~ diet, 
                  data = my_data, print.progress = FALSE)

You should see from the pairwise p-value table which groups have siginificantly different disparities from one another. The “Procrustes variances for defined groups” output tells you the estimated variance for each group.

Exercise: write down a hypothesis about which groups might be evolving faster, slower, or at the same rate.

Fit evolutionary models

Now we can estimate evolutionary rates. We will use the mvMORPH package which will allow us fit the evolutionary models directly using the shape data. What we want to do is first fit an evolutionary model with a single rate of evolution, then one with different rates for each diet group, then compare models.

my_data2=list(Y = two.d.array(gpa$coords),
              diet = diet_groups,
              logCsize = log(gpa$Csize)
              )
#note that to fit a single-rate model we use model="BM"
fit1<-mvgls(Y~1, data=my_data2,  phylo1, model="BM", penalty="RidgeArch", method="H&L")

To fit a multi-rate Brownian motion model, we need to tell the code which branches on our tree should be evolving at the same rate. We only know the trait values (carnivore/herbivore/piscivore): we dont know when the transitions happened. That means we have to estimate the transition times on the tree. We can do that with simmap function.

regimes.tree<-make.simmap(phylo1, diet_groups, model="ER", nsim=1)
col<-c("orange","green","blue")
names(col)<-c("Carnivore", "Omnivore/Herbivore", "Piscivore")
plotSimmap(regimes.tree,col,fsize=0.6,node.numbers=FALSE,lwd=3, pts=FALSE)

Note that in real life you would try this with lots of different iterations (nsim=100 instead of nsim=1) and different models of trait evolution (“model” in the make.simmap function) but we will stick with this for now.

now you can fit the multi-rate model:

fit2<-mvgls(Y~1, data=my_data2,  regimes.tree, model="BMM", penalty="RidgeArch", method="H&L")
#view the rates for each regime:
fit2$param

As with the previous tests, we need to compare the models. In this case we will use GIC instead of AIC, but the rules are the same- lower is better.

GIC(fit1);GIC(fit2)

Adaptive Evolution Hypotheses

There is another explanation for different levels of disparity in different groups. They could be evolving at the same rate but toward different adaptive optima. The model that describes something like evolution toward an adaptive optimum is the Ornstein-Uhlenbeck model. Lets fit a multiple optimum OU model and compare it to the other models.

fit3<-mvgls(Y~1, data=my_data2,  regimes.tree, model="OUM", method="PL-LOOCV")

Exercise: 1) Use what you have learned about GIC to decide if OU or BM is a better model. 2) If we think that each of the diet groups are evolving to different optimal shapes, we will want to know what those optima look like. In mvgls those optima are stored as the matrix $coefficients. Use what you have learned about converting a matrix of landmarks into a 3D array, then plot each of the optimal skulls and try to interpret something about what makes those optima different.