A repeated measures animal model

This tutorial will demonstrate how to run a univariate animal model for a trait with repeated observations using different R packages with an example data files provided.

Scenario and data

scenario

Since gryphons are iteroparous, multiple observations of reproductive traits are available for some individuals. Here we have repeated measures of lay date (measured in days after January 1) for individual females varying in age from 2 (age of sexual maturation) up until age 6. Not all females lay every year so the number of observations per female is variable (between 1 to 5). We want to know how repeatable the trait is, and (assuming it is repeatable) how heritable it is.

Data files

The pedigree file gryphonped.csv is that used in the preceding tutorials but we now use a new data file gryphonRM.csv. Columns correspond to individual identity (animal), birth year (byear), age in years (age), year of measurement (year) and lay date (laydate). Each row of the data file corresponds to a single phenotypic observation. Here the data is sorted by identity and then age so that the repeated observations on individuals are apparent. However this is not a requirement for analysis - data could equally be sorted by some other variable (e.g., measurement year) or be in a random order.

str(gryphonRM)
'data.frame':   1607 obs. of  5 variables:
 $ animal : Factor w/ 469 levels "1","2","3","8",..: 1 1 1 1 1 2 2 2 3 3 ...
 $ byear  : Factor w/ 34 levels "968","970","971",..: 22 22 22 22 22 22 22 22 22 22 ...
 $ age    : Factor w/ 5 levels "2","3","4","5",..: 1 2 3 4 5 1 2 3 1 2 ...
 $ year   : Factor w/ 39 levels "970","971","972",..: 23 24 25 26 27 23 24 25 23 24 ...
 $ laydate: num  19 23 24 23 29 21 17 21 20 20 ...
summary(gryphonRM)
     animal         byear      age          year         laydate     
 1      :   5   1000   : 109   2:308   1004   :  79   Min.   : 0.00  
 3      :   5   1001   :  98   3:322   1005   :  78   1st Qu.:20.00  
 9      :   5   999    :  86   4:339   1003   :  69   Median :24.00  
 17     :   5   1002   :  85   5:315   1006   :  64   Mean   :23.54  
 42     :   5   987    :  70   6:323   1002   :  60   3rd Qu.:27.00  
 50     :   5   989    :  66           988    :  54   Max.   :41.00  
 (Other):1577   (Other):1093           (Other):1203                  
head(gryphonRM)
  animal byear age year laydate
1      1   990   2  992      19
2      1   990   3  993      23
3      1   990   4  994      24
4      1   990   5  995      23
5      1   990   6  996      29
6      2   990   2  992      21