The Wild Animal Modeling Wiki

**Random regression models**

### Theory

Let y be the trait value, X, Z1 and Z2 the design (also referred to as incidence matrices) for the fixed (X) and random effects (Z1,Z2). B is the vector of fixed effects, u the additive genetic effects and pe the permanent environmental effects. The basic animal model is then defined asY = Xb + Z1u + Z2pe +e

This model can easily be expanded to allow the additive genetic effects and the permanent environmental effects to vary with the environment as follows

Y = Xb + Ω(u, E, n) + Ω(pe,E,n) + e

Where Ω() is the polynomial function (legendre polynomials), E the environment and n the order of the polynomial.

As with the animal model it is very important not to fit a higher order polynomial of the additive genetic component then the permanent environment component.

Also note that since Legendre polynomials are only defined on the interval -1 to +1 the environmental covariate needs to be standardized within this interval before proceeding with the analyses.

### ASREML coding

The null model to which we compare if the variance components are changing with the covariate or not is of course the standard animal model (where var comps are assumed to be constant across the covariate) and we start by fitting the standard model with zero order polynomials on both the additive genetic and permanent environmental effect:Trait ~ mu Fixed effects Env !r leg(Env,0).ide(animal) leg(Env,0).animal 1 1 2 !STEP 0.01 Trait 0 IDV 15 !S2==1 leg(Env,0).ide(animal) 2 leg(Env,0) 0 IDV 5 ide(animal) leg(Env,0).animal 2 leg(Env,0) 0 IDV 2 animal 0 AINV

This model is thus equivalent to the ‘standard’ animal model and will have the same LogL value as a model without the zero –order polynomials. However, because of scaling effects when using the Legendre polynomials the variance components estimates will not be the same (multiply values from the random regression model by 0.707 to obtain the estimates from the animal model). Note also that Env is fitted as a covariate in the fixed effects (and needs to be defined as a covariate in the data description part).

Second step is then to fit a first order polynomial for the permanent environmental effect as following:

Trait ~ mu Fixed effects Env !r leg(Env,1).ide(animal) leg(Env,0).animal 1 1 2 !STEP 0.01 Trait 0 IDV 15 !S2==1 leg(Env,1).ide(animal) 2 leg(Env,1) 0 US 1 0.1 1 ide(animal) leg(Env,0).animal 2 leg(Env,0) 0 IDV 2 animal 0 AINV

The LogL obtained from this model can thus be compared with that from the previous model with a standard LRT test with 2 d.f (one for the slope variance and one for the covariance between elevation and slope).

If this model is a significant improvement we can then expand it to test if also the additive genetic variance may change with the env variable as following (which is equivalent to testing for a GxE):

Trait ~ mu Fixed effects Env !r leg(Env,1).ide(animal) leg(Env,1).animal 1 1 2 !STEP 0.01 Trait 0 IDV 15 !S2==1 leg(Env,1).ide(animal) 2 leg(Env,1) 0 US 1 0.1 1 ide(animal) leg(Env,1).animal 2 leg(Env,0) 0 US 1 0.1 1 animal 0 AINV

Again, we obtain the LogL from this model and compare it with the previous model with a LRT and 2 d.f. If there is statistical support for this model we can then say that there is a significant genotype-by-environment (or age) interaction. A caveat here is that the power to detect GxE (or GxAge) with the random regression models may be limited and thus one should not discard a non-significant GxE without some extra thought (see Brommer et al. 2008 and Husby et al. in press)

Of course, we can extend these models to also test higher order polynomials, that is, test for non-linearity in the breeding values. This does however require substantial amounts of repeated measures on the focal individual and its relatives and so it is often difficult to make such higher order polynomial models to converge.

When fitting random regression models one should also try to model separate (preferably environment specific) error variances to allow them to vary across the covariate also (which avoids possible bias issues). Often we group them as using environment specific errors demand to much of the little data we have.