[R] general linear hypothesis glht() to work with lme()

Dieter Menne dieter.menne at menne-biomed.de
Thu Jan 10 10:31:36 CET 2008


array chip <arrayprofile <at> yahoo.com> writes:

(Real names are prefered here)

> I am trying to test some contrasts, using glht() in
> multcomp package on fixed effects in a linear mixed
> model fitted with lme() in nlme package. The command I
> used is:
> data=dat)
> glht(dat.lme, linfct = mcp(type =c("b+t-2*m=0")))
> 
> The lme model fit is ok, but I got an error message
> with glht():
> Error in eval(expr, envir, enclos) : object
> "info.index" not found
> Error in factor_contrasts(model) : no 'model.matrix'
> method for 'model' found!
> 
> according to help page of glht(), it should work with
> linear mixed model, what is the problem here?


Here an example from Torsten Hothorn (author of multcomp), both for lme 
and lmer :
To get a better answer, please  provide the (simulated?) data for your example
as required by the posting guide,

# multcomplme.r
nlmeOK <- require("nlme")
lme4OK <- require("lme4")
library("multcomp")
K <- rbind(c(0,1,-1,0),c(0,1,0,-1),c(0,0,1,-1))
data("ergoStool", package = "nlme")
stool.lmer <- lmer(effort ~ Type + (1 | Subject), data = ergoStool)
glme4 <- glht(stool.lmer,K)
summary(glme4)


#Linear Hypotheses:
#        Estimate Std. Error z value p value
#1 == 0   1.6667     0.5187   3.213 0.00376 **
#2 == 0   3.2222     0.5187   6.212 < 0.001 ***
#3 == 0   1.5556     0.5187   2.999 0.00761 **
stool.lme <- lme(effort ~ Type, data = ergoStool,
                     random = ~ 1 | Subject)
gnlme <- glht(stool.lme,K)
summary(gnlme)




More information about the R-help mailing list