I have two conditions, A and B (see the figure below).

I want to test if these conditions are different each other, if condition A is different from 0 and if condition B is different from 0.

I'd like to accomplish this task using a linear mixed model, because I want to consider random effects.

This is my model:

lm<-lmer(x~conditionr +(1|block) + (1|subj) , data=data, REML = FALSE)

This is the output:

            Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)   -0.08554    0.01745    4.00000  -4.903  0.00781 ** 
   B          0.18395    0.03456 1002.70000   5.323 1.26e-07 ***

So, I found a difference between A and B. A (Intercept) is different from 0.

However, I don't know: 1) how to test if B is different from zero. 2) is it possible that the df of intercept is 4? it sounds a bit strange for me..

Thanks in advance BR

enter image description here

  • $\begingroup$ In this case you can suppress the intercept: x ~ 0 + conditionr +(1|block) + (1|subj) . But the multcomp package allows for more complex tests: library(multcomp) ; summary(glht(m, matrix(c(1, 1), 1))) $\endgroup$ Commented Apr 18, 2017 at 14:36
  • 1
    $\begingroup$ Very thanks! Could a contrast matrix like this work? K <- rbind(c( 1, 0) , c( 0, 1), c( 1, -1) ) $\endgroup$
    – piravi
    Commented Apr 18, 2017 at 15:58
  • $\begingroup$ Yes, but I think the final row of K should be c(1,1) if you want to test if B=0 for the model with the intercept included (as in your question). Otherwise, c(1,-1) can be used for the difference for the model with intercept suppressed $\endgroup$ Commented Apr 18, 2017 at 17:28
  • $\begingroup$ of interest stats.stackexchange.com/questions/204741/… $\endgroup$ Commented Apr 18, 2017 at 19:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.