Skip to content
Prev 6495 / 20628 Next

multiple comparison for a LME with interaction

hi again,

here's an example - if you compare the coefficents between the models,  
or between the models and the plot, as well as summing up the single  
coeffecients in the custom model, you will see that this all makes  
good sense!

if anyone of the "experts" would comment on this approach i'd be happy, too..

### code:
ChickWeight_new <- ChickWeight
ChickWeight_new$Time_factor <- as.factor(ifelse(ChickWeight_new$Time >  
0, 1, 0))
str(ChickWeight_new)

with(ChickWeight_new, interaction.plot(Time_factor, Diet, weight, col = 1:4))

library(nlme)
library(multcomp)

mod1 <- lme(weight ~ Diet*Time_factor, random = ~ 1|Chick, data =  
ChickWeight_new)

ChickWeight_new$Diet <- with(ChickWeight_new, relevel(Diet, ref = "2"))
mod2 <- lme(weight ~ Diet * Time_factor, random = ~ 1|Chick, data =  
ChickWeight_new)

ChickWeight_new$Diet <- with(ChickWeight_new, relevel(Diet, ref = "3"))
mod3 <- lme(weight ~ Diet * Time_factor, random = ~ 1|Chick, data =  
ChickWeight_new)

ChickWeight_new$Diet <- with(ChickWeight_new, relevel(Diet, ref = "4"))
mod4 <- lme(weight ~ Diet * Time_factor, random = ~ 1|Chick, data =  
ChickWeight_new)

c1 <- rbind("Time effect within Diet1" = c(0,0,0,0,1,0,0,0),
             "Time effect within Diet2" = c(0,0,0,0,1,1,0,0),
             "Time effect within Diet3" = c(0,0,0,0,1,0,1,0),
             "Time effect within Diet4" = c(0,0,0,0,1,0,0,1),
             "Time Effect: Diet1 vs. Diet2" = c(0,0,0,0,0,1,0,0),
             "Time Effect: Diet1 vs. Diet3" = c(0,0,0,0,0,0,1,0),
             "Time Effect: Diet1 vs. Diet4" = c(0,0,0,0,0,0,0,1),
             "Time Effect: Diet2 vs. Diet3" = c(0,0,0,0,0,-1,1,0),
             "Time Effect: Diet2 vs. Diet4" = c(0,0,0,0,0,-1,0,1),
             "Time Effect: Diet3 vs. Diet4" = c(0,0,0,0,0,0,-1,1))

summary(glht(mod1, c1))
summary(mod1)
summary(mod2)
summary(mod3)
summary(mod4)
###

Zitat von Kay Cecil Cichini <Kay.Cichini at uibk.ac.at>: