Skip to content
Prev 14829 / 20628 Next

a question of conducting contrast in lme4 (not pairwise contrast)

On 16-09-02 02:18 PM, Gu Hao wrote:
Some notes on linear contrasts:

http://ms.mcmaster.ca/~bolker/classes/s4c03/notes/week2B.Rnw
http://ms.mcmaster.ca/~bolker/classes/s4c03/notes/week2B.pdf

The three contrasts you've set up are collinear: let's code them as

   c1 = c(1, -1/3, -1/3, -1/3,  0)  ## AA vs (BB,CC,DD)
   c2 = c(1,      0,      0,      0, -1) ## AA vs EE
   c3 = c(0,  1/3,   1/3,  1/3, -1) ## (BB,CC,DD) vs EE

then you can see that c1 + c3 is equal to c2.  Therefore, you can't use
these three contrasts as part of a full set of 5 contrasts that span the
space of possibilities.

  Before I saw that you said you've already tried multcomp I wrote the
following down; it might be useful to someone else.
  Adapted from the examples in ?multcomp::glht


 z <- gl(5,10,labels=LETTERS[1:5])
y <- rnorm(50)
library(multcomp)

K <- rbind("A - BCD" = c( 1, -1/3, -1/3, -1/3,  0),
           "A - E" =   c( 1,    0,    0,    0, -1),
           "BCD-E" =   c( 0,  1/3,  1/3,  1/3, -1))

m <- lm(y~z)
mc <- glht(m,
           linfct = mcp(z = K),
           alternative = "less")
summary(mc)

If you want to live dangerously I think

summary(mc,test=univariate())

will give you the unadjusted p-values ...