Dear R members, I tried to fit an lme model and to use the glht function of multcomp. However, the glht function gives me some errors when using weights=varPower(). The glht error makes sense as glht needs factor levels and the model works fine without weights=. Does anyone know a solution so I do not have to change the lme model?
Thanks Sibylle --> works fine ME$Diversity=factor(ME$Diversity) H08_lme<-lme(log(Height2005_mean)~Diversity, data=ME, random=~1|Plot/ SubPlot, na.action=na.omit, subset=ME$Species=="Pse_men", method="ML") summary(H08_lme) anova(H08_lme) g_H08_lme<-glht(H08_lme, linfct=mcp(Diversity="Tukey")) print(summary(g_H08_lme)) --> using lme with weights I changed the order of factor() and introduced as.factor in the model H08_lme<-lme(log(Height2008_mean)~as.factor(Diversity), data=ME, random=~1|Plot/SubPlot, weights=varPower(form=~Diversity), na.action=na.omit, subset=ME$Species=="Ace_pse", method="ML") summary(H08_lme) anova(H08_lme) ME$Diversity=factor(ME$Diversity) g_H08_lme<-glht(H08_lme, linfct=mcp(Diversity="Tukey")) Error in mcp2matrix(model, linfct = linfct) : Variable(s) Diversity have been specified in linfct but cannot be found in model! [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.