Univariate animal model

This tutorial will demonstrate how to run a univariate animal model to estimate genetic variance in birth weight in the mighty gryphons.

Scenario and data

Scenario

In a population of gryphons there is strong positive selection on birth weight with heavier born individuals having, on average higher fitness. To find out whether increased birth weight will evolve in response to the selection, and if so how quickly, we want to estimate the heritability of birth weight.

Data files

Open gryphonped.csv and gryphon.csv in your text editor. The structure and contents of these files is fairly self-explanatory. The pedigree file gryphonped.csv contains three columns containing unique IDs that correspond to each animal, its father, and its mother. Note that this is a multigenerational pedigree, with the earliest generation (for which parentage information is necessarily missing) at the beginning of the file. For later-born individuals maternal identities are all known but paternity information is incomplete (a common situation in real world applications).

The phenotype data, as well as additional factors and covariates that we may wish to include in our model are contained in gryphon.csv. Columns correspond to individual identity (animal), maternal identity (mother), year of birth (byear), sex (sex, where 1 is female and 2 is male), birth weight (bwt), and tarsus length (tarsus). Each row of the data file contains a record for a different offspring individual. Note that all individuals included in the data file must be included as offspring in the pedigree file.

We can read the data file, using read.csv() which consider by default that NA is the symbol for missing values and that the first line of the file contains the column headers.

It is a good idea to make sure that all variables are correctly assigned as numeric or factors:

gryphon$animal <- as.factor(gryphon$animal)
gryphon$mother <- as.factor(gryphon$mother)
gryphon$byear <- as.factor(gryphon$byear)
gryphon$sex <- as.factor(gryphon$sex)
gryphon$bwt <- as.numeric(gryphon$bwt)
gryphon$tarsus <- as.numeric(gryphon$tarsus)
str(gryphon)
'data.frame':   1084 obs. of  6 variables:
 $ animal: Factor w/ 1084 levels "1","2","3","5",..: 864 1076 549 989 1030 751 987 490 906 591 ...
 $ mother: Factor w/ 429 levels "1","2","3","8",..: 362 268 216 375 396 289 328 255 347 240 ...
 $ byear : Factor w/ 34 levels "968","970","971",..: 1 1 2 2 2 2 3 3 3 3 ...
 $ sex   : Factor w/ 2 levels "1","2": 1 1 2 1 2 1 2 1 1 1 ...
 $ bwt   : num  10.77 9.3 3.98 5.39 12.12 ...
 $ tarsus: num  24.8 22.5 12.9 20.5 NA ...

Similarly we can read in the pedigree file, using read.csv() which consider by default that NA is the symbol for missing values and that the first line of the file contains the column headers.

'data.frame':   1309 obs. of  3 variables:
 $ id    : int  1306 1304 1298 1293 1290 1288 1284 1283 1282 1278 ...
 $ father: int  NA NA NA NA NA NA NA NA NA NA ...
 $ mother: int  NA NA NA NA NA NA NA NA NA NA ...
gryphonped$id <- as.factor(gryphonped$id)
gryphonped$father <- as.factor(gryphonped$father)
gryphonped$mother <- as.factor(gryphonped$mother)
str(gryphonped)
'data.frame':   1309 obs. of  3 variables:
 $ id    : Factor w/ 1309 levels "1","2","3","4",..: 1306 1304 1298 1293 1290 1288 1284 1283 1282 1278 ...
 $ father: Factor w/ 158 levels "4","13","18",..: NA NA NA NA NA NA NA NA NA NA ...
 $ mother: Factor w/ 429 levels "1","2","3","8",..: NA NA NA NA NA NA NA NA NA NA ...

Now that we have imported the data and the pedigree file, we are ready to fit an animal model.