[R] Problem with lme using glht for multiple comparisons

Christian Kost ckos001 at ec.auckland.ac.nz
Tue Aug 28 05:06:42 CEST 2007


Hi everyone,

I am new to R and have a question that relates to unplanned post-hoc comparisons using the multcomp package after a mixed effects model. I couldn't find the answer to it in the archive or in any manual. 

I have a dataset in which several plants have been treated in a particular way and a continuous response variable has been measured depending on several leaves per plant. I am now interested in the effect of the treatment depending on the age of the leaves examined. So the dataset (L1) consists of a continuous response variable (EFN), a fixed factor (Leafage), and a random factor (Plant).

I have set up the following mixed effects model, which works fine:


> > LM<-lme(EFN~Leafage,L1,~1|Plant)
>   

Now all I want to do is a post-hoc analysis (multiple comparisons) for the fixed factor EFN. I tried the following code. According to the documentation this should work:


> > Post <- glht(LM, linfct = mcp(Leafage = "Tukey"))
>   

However, I get this error message and don't know what to do:

Error in mcp2matrix(model, linfct = linfct) : 
	Factor(s) Leafage have been specified in ‘linfct’ but cannot be found in ‘model’!


The factor is specified, right? So what is the problem? If I do the same with an normal Anova (command: aov), it works. What is the problem with the lme command?

Thank you very much in advance for your help.

Cheers,


Christian



More information about the R-help mailing list