[R-lang] lmer multiple comparisons for interaction between continuous and categorical predictor

Dan Mirman daniel.mirman@gmail.com
Wed Nov 21 06:20:18 PST 2012


Dear list,
A few weeks ago there was a discussion on this list about how to use
multcomp to do comparisons between different levels for an interaction. In
that case it was an interaction between two categorical factors, but it got
me thinking about how to do this for an interaction between a continuous
and a categorical predictor. I've been puzzling over it for a while and
haven't been able to figure it out, so I'm coming back to the list in the
hope that you can help me out.

As an example, I've been using the ChickWeight data set in R. I fit the
model like this:

m <- lmer(weight ~ Time * Diet + (1 | Chick), data=ChickWeight, REML=F)


Where Time is continuous and Diet is categorical (with 4 levels). The
chicks started out at (approximately) the same weight, but (for this
example) I want to know compare individual diets to test if differently
affect growth rate. The following works for getting the pairwise
comparisons for the intercept effect of diet:

summary(glht(m, linfct=mcp(Diet = "Tukey")))


but I can't figure out the analogous thing for the Time:Diet interaction. I
tried putting the interaction into mcp, but that produced an error:

summary(glht(m, linfct=mcp('Time:Diet' = "Tukey")))Error in
summary(glht(m, linfct = mcp(`Time:Diet` = "Tukey"))) :
  error in evaluating the argument 'object' in selecting a method for function
 'summary': Error in mcp2matrix(model, linfct = linfct) : Variable(s)
‘Time:Diet’ have been specified in ‘linfct’ but cannot be found in
‘model’!


Thanks in advance,
Dan

-- 
-----------------------------------------------------
Dan Mirman
Institute Scientist
Moss Rehabilitation Research Institute
Elkins Park, PA 19027
http://www.danmirman.org
-----------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucsd.edu/pipermail/ling-r-lang-l/attachments/20121121/b4a093f8/attachment-0001.html 


More information about the ling-r-lang-L mailing list