# Re: [R] Repeatability and lme

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon 15 May 2006 - 14:43:53 EST

Roger Schürch wrote:
> Dear R-help list members
>
> I gathered longitudinal data on fish behaviour which I try to analyse using
> a multi level model for change. Mostly, I am following Singer & Willett
> (2003), who provide also the S/R code for their examples in the book (e.g.
> http://www.ats.ucla.edu/stat/Splus/examples/alda/ch4.htm). Of course I am
> interested in change over time, but I am also very much interested in
> consistency of behaviour of individuals, that is, does an individual for
> example show consistent levels of aggression and differ from others in a
> consistent manner. I thought that I could tackle this question using
> repeatability, defined as
>
> r = sa^2 / (sa^2 + s^2)
>
> where sa^2 is the among-groups variance component and s^2 is the
> within-group variance component (Lessells & Boag, 1987). Usually,
> repeatability is used together with one-way ANOVA, but I'd rather stick to
> lme. So for the introductionary example to lme in Pinheiro and Bates (2001)
> with Rails, I thought it would be appropriate to follow this procedure:
>

```>> library(nlme)
>> fm1Rail.lme <- lme(travel ~ 1, data = Rail, random = ~ 1 | Rail)
>> summary(fm1Rail.lme)
```

>
> ...
>
> Random effects:
> Formula: ~1 | Rail
> (Intercept) Residual
> StdDev: 24.80547 4.020779
>
> ...
>
```>> as.numeric(VarCorr(fm1Rail.lme)[1]) / (as.numeric(VarCorr(fm1Rail.lme)[1])
```

> + as.numeric(VarCorr(fm1Rail.lme)[2] ))
> [1] 0.9743987
>
> This gives a reasonable, high repeatability. First, I would like to know,
> whether this computation of repeatability is correct,

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.

and if so, how I would
> have to proceed if there was also a variance component for the individual
> change trajectory (the slope). Would sa^2 be the sum of the variance
> components for intercept and slope?
>
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
```
<snip>
Random effects:
Formula: ~age | Subject
Structure: General positive-definite, Log-Cholesky parametrization

StdDev Corr

```(Intercept) 2.3270340 (Intr)
age         0.2264278 -0.609
Residual    1.3100397

```

Number of Observations: 108
Number of Groups: 27

``` >      (fm1.0 <- lme(distance ~ age,
+         random=~1|Subject, data = Orthodont)) # random is ~ age
```
<snip>
Random effects:
Formula: ~1 | Subject

(Intercept) Residual
StdDev: 2.114724 1.431592

Number of Observations: 108
Number of Groups: 27

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.

> If my idea of analysing such kind of data is all together wrong, what
> alternatives do I have?
>
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 your study? After you've answered that question, if some definition 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.

```	  Hope this helps.
Spencer Graves
```

p.s. Thanks for citing a self-contained example. I'm not certain even now if I understand your question, but I think I would be even more confused without this example.

> Cheers
> Roger
>
> _____________________________
> Universität Bern
> Abteilung Verhaltenökologie
>
> Roger Schürch
>
> Wohlenstrasse 50A
> CH-3032 Hinterkappelen
> Tel. +41 (0)31 631 91 51
> Fax +41 (0)31 631 91 41
> http://zoology.unibe.ch/behav
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help