Exercise 1


Data

In this exercise, we will use data from the Phenotypic Evolution Time Series (PETS) database to fit and assess different univariate models. PETS is a public database with time series of phenotypic change within lineages. The database is maintained by a group of international evolutionary biologists and paleontologists. You can first explore the data on the website linked above. It is possible to filter the data based on a range of options and you can find data from both modern and fossil lineages.

The phenotypic traits have been measured in units on a ratio scale, and include measures of lengths, widths, areas, counts etc. The database also includes phenotypic traits on ratio scales that have been log-transformed (e.g., log length in cm). Computing means and averages are meaningful statistical operations of measurements on a ratio scale (or log-transformed ratio scale variables), which is not the case for all scale types (e.g., measures on nominal or ordinal scales). Principal components scores are not part of the database for various reasons that could make the evolutionary interpretation of such scores difficult.

See the PETS help page for an explanation of the content in the data tables you can download.

After exploring the webpage for a bit, download a time series you want to work with and place it in your working directory. You download the dataset by selecting the specific study under View/download individual series and then clicking Download on the right side. For this exercise you can download the time series as a text file. Also check in the metadata whether or not the data is log-transformed. If not, log-transform the data before continuing with analyses.

Example of how to download and import data from PETS:

Here, we select a time series on teeth crown height in a lineage of extinct giant sharks (Carcharocles megalodon) from Pimiento and Balk (2015):

PETS data

Now, we are going to import the text file into R and get it into the correct format for analysis. Make sure you have loaded the necessary packages (evoTS, paleoTS and tidyverse).

First, set your working directory:

setwd("PATH_TO_WORKING_DIRECTORY")

Then, import the data:

data <- read_delim("./Pimiento_and_Balk_2015_crown_height.txt", col_names = TRUE, delim = "\t")

Then, transform the data into a paleoTS:

crown_height <- as.paleoTS(mm = data$trait_mean, vv = data$trait_var, nn = data$N, tt = data$age_MY, oldest = "first")

As this time series is not already on a log scale, we log-transform the data:

ln_crown_height <- ln.paleoTS(crown_height)

We also convert the time vector to relative time (0 to 1):

ln_crown_height$tt <- ln_crown_height$tt/(max(ln_crown_height$tt))

Now you are ready to analyse the data!


With the data you have chosen, explore the fit of different univariate models using what you have learned in previous sections.

Feel free to analyse several time series if you have time!


When you are done with this exercise, move on to exercise 2.