[R] glht for lme object with significant interaction term

Mark Difford mark_difford at yahoo.co.uk
Wed Nov 23 13:54:02 CET 2011


Nov 23, 2011 at 1:27am Andreas wrote:

> I would like to do multiple comparisons for treatment levels within day
> (i.e. across treatments
> for each day in turn)

Andreas,

The following does what you want. To see how/why it works, look at the
vignette to package multcomp, where there is an example. Note that I had to
change "mean.on.active" to "mean_on_active".

##
library(nlme); library(multcomp)
Tdf <- "Your attached data set"
m.final<-lme(mean.on.active ~ treat * day,random=~1|id,na.action=na.omit,
data=Tdf)
Tdf$IntFac <- interaction(Tdf$treat, Tdf$day, drop=T)
m.finalI<-lme(mean.on.active ~ IntFac,random=~1|id,na.action=na.omit,
data=Tdf)
summary(m.final)
summary(m.finalI)
glht(m.finalI, linfct=mcp(IntFac = "Tukey"))

Regards, Mark.

-----
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: http://r.789695.n4.nabble.com/glht-for-lme-object-with-significant-interaction-term-tp4097865p4099459.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list