[R] Two factor ANOVA in lme

Fernando Henrique Ferraz P. da Rosa feferraz at ime.usp.br
Wed Nov 24 15:03:00 CET 2004

nat writes:
> I want to specify a two-factor model in lme, which should be easy? 
> Here's what I have:
> factor 1 - treatment FIXED (two levels)
> factor 2 - genotype RANDOM (160 genotypes in total)
> I need a model that tells me whether the treatment, genotype and 
> interaction terms are significant. I have been reading 'Mixed effects 
> models in S' but in all examples the random factor is not in the main 
> model - it is a nesting factor etc to specify the error structure. Here 
> i need the random factor in the model.
> I have tried this:
> height.aov<-lme(height~trt*genotype,data.reps,random=~1|genotype,na.action=na.exclude)
> but the output is nothing like that from Minitab (my only previous 
> experience of stats software). The results for the interaction term are 
> the same but F values for the factors alone are very different between 
> Minitab and R.
> This is a very simple model but I can't figure out how to specify it. 
> Help would be much appreciated.
> As background: The data are from a QTL mapping population, which is why 
> I must test to see if genotype is significant and also why genotype is a 
> random factor.
> Thanks

        It seems your message didn't get any replies (at least none
posted to r-help). 

        I recentely adjusted such a model  (two effects, one fixed,
another random, with interaction effects) using lme. I used the
following command: 

 z1 <- lme(reacao ~ posicao,data=memoria,random=~1|subject/posicao)

        Where my model is 

         reacao = mu + posicao (fixed) + posicao*subject (random) +
subject (random)

         Beware though that minitab uses different estimation methods (in lme
itself you may use maximum likelihood other restricted m.l) and the
results need not to be the same.


Fernando Henrique Ferraz P. da Rosa

More information about the R-help mailing list