Dear all, I'm working on some data from an experiment on the breeding behavior of birds. In short, I have been measuring how the time spent on performing a certain task (variable 'mean_on_active') differs over time (variable 'day', 2 levels) across three experimental categories (variable 'treat'; levels 'C', 'R', 'E'). The model shows a significant interaction between treatment and day. To have a closer look at this, I would like to do multiple comparisons for treatment levels within day (i.e. across treatments for each day in turn). I have browsed the forum for a way of doing this using the glht function, but haven't found a good solution to my problem. Any hints on how to proceed, or on other methods that might be (more) appropriate? Final model output below, data attached. http://r.789695.n4.nabble.com/file/n4097865/sub.data.txt sub.data.txt Kind regards, Andreas ##Final model m.final<-lme(mean.on.active~treat+day+treat:day,random=1|id,na.action=na.omit) summary(m.final) Linear mixed-effects model fit by REML Data: NULL AIC BIC logLik 1051.779 1075.757 -517.8896 Random effects: Formula: ~1 | id (Intercept) Residual StdDev: 6.276309 5.473167 Fixed effects: mean_on_active ~ treat * day Value Std.Error DF t-value p-value (Intercept) 24.987123 1.792599 75 13.939049 0.0000 treatE 15.661119 2.327329 73 6.729225 0.0000 treatR 1.133678 2.228713 73 0.508670 0.6125 day6-7 -1.068160 1.758899 73 -0.607289 0.5455 treatE:day6-7 -6.650690 2.335567 73 -2.847570 0.0057 treatR:day6-7 -1.495927 2.273071 73 -0.658108 0.5125 Correlation: (Intr) treatE treatR day6-7 tE:6-7 treatE -0.736 treatR -0.747 0.572 day6-7 -0.482 0.372 0.389 treatE:day6-7 0.361 -0.522 -0.292 -0.753 treatR:day6-7 0.370 -0.281 -0.524 -0.774 0.582 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.5774244 -0.4585991 -0.1360731 0.3902143 3.9752257 Number of Observations: 154 Number of Groups: 76 -- View this message in context: http://r.789695.n4.nabble.com/glht-for-lme-object-with-significant-interaction-term-tp4097865p4097865.html Sent from the R help mailing list archive at Nabble.com.
Mark Difford
2011-Nov-23 12:54 UTC
[R] glht for lme object with significant interaction term
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.