# [R] lme outer

yann clough yclough at gwdg.de
Tue Jul 19 15:15:31 CEST 2005

```Dear R users

a question about "outer" explanatory variables in lme:

I have measured size of a population of insects in fields.
These fields were spread out over a large region.
The fields are grouped (spatially) in pairs: one with fertiliser "high",
the other one "low".
I want to test effect of mean temperature and fertiliser on popsize.
Meantemp was measured for each field, but measurements are correlated
within pairs,
and this should be taken into account to avoid pseudoreplication (in
other words, I d like meantemp to be considered an "outer" variable).

Do I need to replace the temperature measurements by the means for each
pair?
Or can I leave in the measurements per field pair?

this is my data and model (with meantemp values for each field):
popsize=c(8,19,13,28,30,29,45,41,21,30,20,32,44,52,65,45)
meantemp=c(10,10.4,11.2,11.4,12,12.25,12.5,12.7,10.1,10.7,11.5,11.3,11.7,12.3,12.9,12.8)
fertiliser=as.factor(rep(c("low","high"),each=8))
pair=as.factor(rep(c(1:8),times=2))

model1=lme(popsize~meantemp+fertiliser, random=~1|pair)

I now create a vector with the values of meantemp averaged per pair

meantemp2=tapply(meantemp,pair,mean)
meantemp2=meantemp2[pair]

rerun a model with that explanatory variable:
model2=lme(popsize~meantemp2+fertiliser, random=~1|pair)

summary.lme and anova.lme suggest minute differences in the estimated
parameters and DF (!) between model1 and model2.
How do I explain these differences, especially in the DF?
Is there a model to prefer?

Sincerely,
Yann
--
Yann Clough
Agroecology
Georg-August University
Waldweg 26
D-37073 Goettingen
Tel: 0551/39-2358
email: yclough at gwdg.de
www: http://wwwuser.gwdg.de/~uaoe/mitarbeiter/y_clough_e.htm

```