[R] Error terms in aov and lme

Federico Calboli f.calboli at ucl.ac.uk
Wed Apr 16 17:40:42 CEST 2003

Hi All,

I have a purely theoretical question on how to speciy (correctly, if
possible) the error terms to use in a linear model with mixed effects.

I have an experiment where I grow flies from 4 selection regimes at 2
temeratures. Each selection regime has 3 independent replicates.

I summary:
2 temperatures
4 selection regimes
3 independent replicates per selection regime, for a grand total of 12. The
replicates are coded 1:12 as a factor

If I write dow the anova table, I have the following effects:
temp     	 1
sel		 3
sel/rep		 8
temp*sel	 3
temp*sel/rep	 8

If I am correct, the error terms are:

temp over temp*sel/rep (the df are 1/8)
sel over sel/rep (the df are 3/8)
sel/rep over the residuals (the df are 8/residuals)
temp*sel over temp*sel/rep (the df are 3/8)
temp*sel/rep over the residuals (the df are 8/residuals)

Using lme the model:

anova(lme( measurement.taken ~  temp*sel, random = ~ 1|rep/temp,  mydata))

gives an estimate with the right degrees of freedom for num and dem.  But
WHY do I have to nest tem inside rep? cannot figure it out for the life of me.

If I want to use aov:

anova(aov( measurement.taken ~ temp*sel + temp*sel/rep + sel/rep + Error
???, mydata))

How do I specify the correct error terms? 


Federico C.F. Calboli

Department of Biology
University College London
Room 327
Darwin Building
Gower Street

Tel: (+44) 020 7679 4395 
Fax (+44) 020 7679 7096
f.calboli at ucl.ac.uk

More information about the R-help mailing list