[R-sig-ME] Deviance tests and contrasts

Adam D. I. Kramer adik at ilovebacon.org
Wed Jun 9 00:54:18 CEST 2010

Dear colleagues,

 	Consider this data set:

d <- data.frame(subject=rep(1:40,each=5), sex=factor(rep(0:1,each=5,20)),
   condition=factor(rep(1:5,40)), score=rnorm(200), cov=rnorm(200) )

...and this model:

l <- lmer(score ~ sex * condition + cov + (1 + condition + cov | subject), data=d)

...I am aware of the problem with estimating p-values for t-values when we
don't know the degrees of freedom for t and how we have no good way to
estimate them. So, my usual go-to method for getting precise p-values in
this case is to do a deviance test, for example to test the covariate's

anova(l, update(l, . ~ . - cov))

...however, I know of no way to do this for a single R-generated contrast.
Could someone recommend a method of conducting a deviance test for the
effect coded by one of the contrasts for the condition factor?

Or in the simpler case,

l2 <- lmer(score ~ sex * condition + (1 + condition | subject), data=d)

...the main effect for sex, which has only one contrast?

Many thanks!

More information about the R-sig-mixed-models mailing list