[R] How to do Multiple Comparisons for a Mixed Effects Model

Ben Bolker bbolker at gmail.com
Fri Sep 23 15:01:45 CEST 2011

Allan Carson <acarson <at> unbc.ca> writes:

> When I try to conduct a 
> multiple comparison, I get an error (See below):
> fm3<- lme(abovegroundbiomass.m.2~medium*amelioration*fertilizer*treatment,
>  random=~1|block/medium/amelioration/fertilizer) 
> tukeytest<-glht(fm3, linfct=mcp(treatment="Tukey"))
> Error in contrMat(table(mf[[nm]]), type = types[pm]) : 
>   less than two groups

  You should probably re-post this question to the r-sig-mixed-models
mailing list, which specializes (as you would guess) in mixed models.
  I'm a little suspicious of your random effects specification.  Are there
really random effects at all four levels?  i.e., are there four separate
hierarchical levels at which the predictors vary?

  It's hard to diagnose this problem without a reproducible example.
Is your model fit otherwise sensible?

More information about the R-help mailing list