In R, using package lme4, I have used the following 2 mixed models to determine I have a signifacnt interaction between a covariate (continous, normally distributed) and a factor (three levels: herbivores, plants, predators):

test1 <- lmer( mode ~ sr * func.group + (1|community), data=nr.test, REML="FALSE")
test2 < -lmer( mode ~ sr + func.group + (1|community), data=nr.test, REML="FALSE")
anova(test1, test2)

Data: nr.test
test2: mode ~ sr + func.group + (1 | community)
test1: mode ~ sr * func.group + (1 | community)
     Df    AIC    BIC  logLik  Chisq Chi Df Pr(>Chisq)    
nr.test2  6 77.458 82.093 -32.729                             
nr.test1  8 62.570 68.751 -23.285 18.887      2  7.919e-05 ***

I have obviously plotted the interaction for each level of factor, and all three levels are positive relationships which cross over each other (i.e. different levels of slope steepness).

However, I would like to be able to identify which level of the factor are significantly different from one another, and which are also significantly different from a slope value of zero (i.e. which slopes are significant).

I have installed the R package phia, and used the command

testInteractions(test1, pairwise="func.group", slope="sr")

and recieved the following output:

Adjusted slope for sr 
Chisq Test: 
P-value adjustment method: holm
                     Value Df   Chisq Pr(> Chisq)    
    herbivore-plant 0.11878  1  4.3061     0.03798 *  
 herbivore-predator 0.40567  1 65.3283   1.902e-15 ***
     plant-predator 0.28689  1 30.3474   7.224e-08 ***

It would appear for each level of factor the slopes are significantly different from one another, but how can I know which ones are significantly different from zero, and how would I report this?

  • $\begingroup$ As regards this code below which works well, may I ask you to exlain how it works? i.e. Does this compare one factor level (coded as "1") against the the other two factor levels (grouped by coding as "0").... or does it instead run a signifcance test only on the slope classed as a "1" (and the "0" are ignored), so that in effect this code tests each slope independently (hence three slopes = 3 tests)? Also, are the levels of factor organised alphabetically, so that the "1" in (1,0,0) refers to herbivore, while "1" in (0,0,1) refers to predator? $\endgroup$ Commented Aug 17, 2014 at 6:05

1 Answer 1


how can I know which ones are significantly different from zero, and how would I report this?

To obtain the slope estimate and its statistical significance for each level of a factor, you can perform the following tests:

testInteractions(test1, custom=list(func.group=c(1,0,0)), slope="sr", adjustment="none")
testInteractions(test1, custom=list(func.group=c(0,1,0)), slope="sr", adjustment="none")
testInteractions(test1, custom=list(func.group=c(0,0,1)), slope="sr", adjustment="none")

You may report the results of the individual slopes the same way as the pairwise comparisons of slopes (e.g., tables).


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.