[R-sig-ME] Deviance tests and contrasts

David Duffy davidD at qimr.edu.au
Wed Jun 16 00:16:31 CEST 2010

On Sun, 13 Jun 2010, Adam D. I. Kramer wrote:

> d <- 
> data.frame(favcol=factor(rep(c("red","blue","yellow","purple"),each=50)),
> subj=factor(rep(1:20,each=10)), dv=rnorm(200))
> lmer(dv ~ favcol + (1|subj), data=d)
> ...in this example, with default (dummy-coded) contrasts, the "favcolpurple"
> effect tests whether purple differs from red, but I can't (easily) subtract
> the "favcolpurple" effect and recompute.
> ...but what I want is a more elegant way to do this for lmer models, as it
> seems to me that the "contrasts" system exists for exactly this reason.

Not elegant ;)

levels(d$favcol)[4] <- 'red'

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