The Wild Animal Modeling Wiki
Univariate Animal Model
Summary
This univariate model is the simplest of all animal models and assumes no repeated measures across years or individuals. Here we provide the code to calculate the additive genetic variance component of a phenotypic variable, for example body size.If you haven't used these programs before, this information will not make a huge amount of sense. We strongly recommend that you read the additional background information and step-by-step instructions which can be found in the freely available ecologists guide to the animal model, published in the Journal of Animal Ecology and available here.
Table of contents
Definitions
Sample code in the following examples includes the following variablesResponse variable: Size
Fixed effects: Intercept (mu)
Random effects: Additive genetic variance
Data containing phenotypic information: phenotypicdata
Data containing pedigree data:pedigreedata
Sample Code
ASReml
# provide a title - failure to do this will prevent the program from running properly ASReml analysis of size # next section describes contents of data file # note that column headings are indented (use at least one space) # !P associates a term with the pedigree file ANIMAL !P SIZE # then specify the pedigree and data files # for the data file we tell ASReml to skip the first line since these are headers not data # Note that the pedigree and data file names below should not be indented pedigreedata.ped !skip 1 phenotypicdata.dat !skip 1 # Then we specify the model # mu is the mean & any term after !r is treated as random SIZE ~ mu !r ANIMAL
ASReml-R
model1<-asreml(fixed=SIZE~ 1 #1 , random= ~ped(ANIMAL,var=T,init=1) #2 , data=phenotypicdata #3 ,ginverse=list(ANIMAL=pedigreedata_inverse) #4 , na.method.X="omit", na.method.Y="omit") #5 #1: SIZE is the response variable and the only fixed effect is the mean(denoted as1) #2: fit random effect of ANIMAL Va with an arbitrary starting value of 1 #3: use data file phenotypic data #4: connect the individual in the data file to the pedigree #5: omit any rows where the response or predictor variables are missing #to see the estimates of the fixed effects summary(model)$coef.fixed #and the estimates of the random effects summary(model)$varcomp
MCMCglmm
Here is the simplest implementation of an animal model:
#set the prior p.var<-var(phenotypicdata$SIZE,na.rm=TRUE) prior1.1<-list(G=list( G1=list(V=matrix(p.var/2),n=1)), R=list(V=matrix(p.var/2),n=1)) #model specification model1.1<-MCMCglmm(SIZE~1,random=~ANIMAL, pedigree=pedigreedata,data=phenotypicdata,prior=prior1.1)
WOMBAT
# A single optional comment line of up to 74 characters COMMENT WOMBAT analysis of Gryphon birth weight # The type of analysis to be performed. In this case a UNIvariate analysis ANALYSIS UNI # Name the pedigree file, assuming it is in the same folder as the parameter file PEDS pedigreedata.ped # Name the data file, assuming it is in the same folder as the parameter file DATA phenotypicdata.dat # Description of the data file # Each variable to be fitted in the model needs to be followed by the maximum number of levels ANIMAL 900 SIZE END DATA # Model specification # Type of effect (FIXed, COVariate, RANdom) and variable name # NRM indicates that a pedigree is available for ANIMAL MODEL RAN ANIMAL NRM # The trait to be analysed TRAIT SIZE END # Specify starting values and the number of rows and columns in the matrix # These are not very important here VAR residual 1 1.0 VAR ANIMAL 1 1.0
Next Steps
Calculate the heritabilityAdd fixed effects to your model
Repeated measures/longitudinal analysis
Bivariate models