[R] Repeatability and lme

Roger Schürch roger.schuerch at esh.unibe.ch
Mon May 8 12:12:02 CEST 2006

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, 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?

If my idea of analysing such kind of data is all together wrong, what
alternatives do I have?


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

More information about the R-help mailing list