# [R] Repeatability and lme

Roger Schürch roger.schuerch at esh.unibe.ch
Wed May 17 09:14:20 CEST 2006

```Dear Spencer Graves

First I would like to thank you very much for answering to my mail. Then I
would like to clarify some points, so that I would eventually find a
solution to my problem.

---
SG:  I have not done a serious literature search of "repeatability", but I
would not assume that it is defined in exactly the same way by all sources
that use that term.
---

Well, as stated in the introduction, I am following Lessells & Boag (1987),
who define (in words): "REPEATABILITY is a measure used in quantitative
genetics to describe the proportion of variance in a character that occurs
among rather than within individuals."

So, I would like to know, how consistent my fish behave, whether the
variance is rather between the individuals that I have observed or within
the individuals.

I could use an anova, but I'd rather stick to mixed effects models, as it
seems to be common sense to use that with longitudinal data (though it seems
not to be widely used in zoological/behavioural research ...).

---
SG:  What "slope" are you describing here?  Consider the following
modification of one of the standard 'lme' examples:

[...]

>      (fm1.1 <- lme(distance ~ age,
+         random=~age|Subject, data = Orthodont)) # random is ~ age

[...]

>      (fm1.0 <- lme(distance ~ age,
+         random=~1|Subject, data = Orthodont)) # random is ~ age

The first model estimates a "slope" for "age" as a fixed effect AND a
variation in that for each Subject.  The second assumes this slope is
constant between Subjects, and only the "(Intercept)" varies between
subjects.
---

I allow a different slope for every subject, so my model is similar to the
first model. Additionally I have a fixed effect for "sex":

myLme <- lme(fixed = explorationScore ~ Sex*I(Sequence - 1), data = myData,
random = ~ I(Sequence - 1) | Fish, method = "ML")

Sequence = 1st to 6th measurement (each measurement 30 d apart; do I have to
specify that it is not a continuous variable??)
Fish = Subject

---
SG:  I would encourage you to first think carefully about the problem(s)
you want to solve.  What would people want to do with the results of
"repeatability" (carefully defined with an appropriate citation) seems
to provide some insight, I'd try to explain why it does, then give the
quantitative answer with my interpretation and with appropriate
citations to show that my logic here is not completely original.  If
however, "repeatability" did NOT seem to support my main message, then I
would likely ignore it.
---

So, here are my questions for that particular model that I am investigating:

1. Do the fish change their behaviour during ontogeny?
2. Do the sexes differ in their behaviour?
3. Do my fish behave consistently (when one accounts for the change over
time (see 1. point))?

Let us consider you example again, but add "Sex" as a fixed effect, so that
it is more similar to my analysis:

> fm1.1 <- lme(distance ~ age*Sex,random=~age|Subject, data = Orthodont)

And then have a look at the variance components:

> VarCorr(fm1.1)
Subject = pdLogChol(age)
Variance   StdDev    Corr
(Intercept) 5.78842347 2.4059143 (Intr)
age         0.03255509 0.1804303 -0.668
Residual    1.71611214 1.3100046

We see that an individual's true intercept is deviating from the mean
intercept considerably, but the differences in rate of change seem to be
rather small. Then there is some residual variance that is not accounted for
by fitting a change trajectory for every individual, a scatter around an
individual's true change trajectory.

Now, if I am interested in the ratio (among_variance / (within_variance +
among_variance)), how is that computed? For our example here I would
suggest:

> (as.numeric(VarCorr(fm1.1)[1])+as.numeric(VarCorr(fm1.1)[2])) /
(as.numeric(VarCorr(fm1.1)[1])+as.numeric(VarCorr(fm1.1)[2])+as.numeric(VarC
orr(fm1.1)[3]))
[1] 0.772311

To my understanding, this would be the repeatability of the character
"distance", and would therefore result in a statement like this: most of the
variance in distance is found between subjects, rather than within (r =
0.772311).

The only question I would have liked to pose to the r-help list, is, whether
I compute the among_variance from the R output correctly or whether I am
lacking something that is not directly available from the standard output R
produces.

Repeatability is widely used in zoological literature, but it is usually
assumed that there are no time effects. That is why I would like to use lme
AND provide the readers with a familiar number ... Furthermore, it provides
a guess for the maximal heritability that I can expect for that particular
trait, which might prove very useful for further studies, and it would be
comparable with other behaviours, e.g. in a table.

This has become a somewhat lengthy e-mail, so here are my apologies. But I
am still not sure whether I could make myself understood. Thanks anyway for

Yours
Roger

P.S.: There is a study that has done similar things (Müller & Schrader,
2005, Behaviour 142, 1289--1306), but it rather confused me, and the
corresponding author does not seem willing to correspond ... But perhaps it
helps in understanding my problem.

```