# Multiple comparisons on a mixed effects model

I am trying to analyse some data using a mixed effect model. The data I collected represent the weight of some young animals of different genotype over time.

I am using the approach proposed here: http://blog.gribblelab.org/2009/03/09/repeated-measures-anova-using-r/

In particular I'm using solution #2

So I have something like

require(nlme)
model <- lme(weight ~ time * Genotype, random = ~1|Animal/time,
data=weights)
av <- anova(model)


Now, I would like to have some multiple comparisons. Using multcomp I can do:

require(multcomp)
comp.geno <- glht(model, linfct=mcp(Genotype="Tukey"))
print(summary(comp.geno))


And, of course, I could do the same with time.

I have two questions:

1. How do I use mcp to see the interaction between Time and Genotype?
2. When I run glht I get this warning:

covariate interactions found -- default contrast might be inappropriate

What does it mean? Can I safely ignore it? Or what should I do to avoid it?

EDIT: I found this PDF that says:

Because it is impossible to determine the parameters of interest automatically in this case, mcp() in multcomp will by default generate comparisons for the main effects only, ignoring covariates and interactions. Since version 1.1-2, one can specify to average over interaction terms and covariates using arguments interaction_average = TRUE and covariate_average = TRUE respectively, whereas versions older than 1.0-0 automatically averaged over interaction terms. We suggest to the users, however, that they write out, manually, the set of contrasts they want. One should do this whenever there is doubt about what the default contrasts measure, which typically happens in models with higher order interaction terms. We refer to Hsu (1996), Chapter~7, and Searle (1971), Chapter~7.3, for further discussions and examples on this issue.

I do not have access to those books, but maybe someone here has?

-

If time and Genotype are both categorical predictors as they appear to be, and you are interested in comparing all time/Genotype pairs to each other, then you can just create one interaction variable, and use Tukey contrasts on it:

weights$TimeGeno <- interaction(weigths$Time, weights\$Geno)
model <- lme(weight ~ TimeGeno, random = ~1|Animal/time, data=weights)
comp.timegeno <- glht(model, linfct=mcp(TimeGeno="Tukey"))


If you are interested in other contrasts, then you can use the fact that the linfct argument can take a matrix of coefficients for the contrasts - this way you can set up exactly the comparisons you want.

-
Interesting, I'll try that tomorrow at work (don't have the data here with me now), and in the mean time I'll give you a +1 ;) –  nico Dec 9 '10 at 22:21
glht uses the degrees of freedom given in the lme model. I'm not sure these degrees of freedom are appropriate... ? –  Stéphane Laurent Feb 4 at 13:12