# [R] Repeatability and lme

From: Roger Schürch <roger.schuerch_at_esh.unibe.ch>
Date: Mon 08 May 2006 - 20:12:02 EST

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)

...

(Intercept) Residual
StdDev: 24.80547 4.020779

...

> as.numeric(VarCorr(fm1Rail.lme)) / (as.numeric(VarCorr(fm1Rail.lme))
+ as.numeric(VarCorr(fm1Rail.lme) ))
 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?

Cheers
Roger

Universität Bern
Abteilung Verhaltenökologie

Roger Schürch

R-help@stat.math.ethz.ch mailing list