How does one test for interactions in EdgeR?
Entering edit mode
pl23 • 0
Last seen 2 days ago


I am a new user to EdgeR and am curious if there is a straightforward way to test for interaction significance in genes akin to anova. For example, say I wish to test interactions between "factor1" and "factor2". In DESeq2, one can use an LRT test with

deseq(object, test = "LRT", full = ~ factor1*factor2, reduced = ~factor1+factor2)

Can I do something similar with the glmLRT function in edgeR?

Thank you very much!

edgeR • 243 views
Entering edit mode
Last seen 57 minutes ago
WEHI, Melbourne, Australia

Testing for interaction in factorial model

Certainly! edgeR has been offering LRT-based anova tests since 2010 (for over thirteen years). edgeR takes the same coefficient/contrast orientated approach to specifying hypotheses as does the limma package, see

In edgeR, you only specify the full model and then indicate which coefficients or contrasts you want to test equal to zero. For the model

design <- model.matrix(~factor1*factor2)

you would fit the linear model by

fit <- glmFit(y, design)

and then test the interaction by

lrt <- glmLRT(fit, coef=XX)

where XX is the name or number of the interaction coefficients. Just type colnames(fit) to see what the coefficients are and you will easily see the interaction terms. If both factors have two levels, then XX=4. In general, you could specify XX <- grep(":", colnames(fit)), which will pick up all the interaction terms no matter how many levels the two factors have.

Conditional effects

The edgeR approach is very flexible and allows a more informative dissection of the factorial model. Instead of the traditional main effects and interaction model that you have specified, we think that a conditional effect approach is much more informative for genomic analyses. The conditional effect approach is equivalent to the factorial model but allows the effects to be split up into more informative pieces.

Suppose for example that you have mice from KO and WT genotypes and each mouse is subject to either an active or control treatment. You could specify

Genotype <- factor(Genotype, levels=c("WT","KO"))
Treatment <- factor(Treatment, levels=c("Control","Active"))
design <- model.matrix(~ Genotype + Genotype:Treatment)
fit <- glmFit(y, design)

Then you could test for the treatment effect in WT by

glmLRT(fit, coef=3)

the treatment effect in KO by

glmLRT(fit, coef=4)

and the difference between the KO and WT treatment effects by

glmLRT(fit, contrast=c(0,0,-1,1))

In this analysis, the treatment effect in WT mice is the conditional effect of Treatment for Genotype=WT and the treatment effect in KO mice is the conditional effect of Treatment for Genotype=KO. Testing whether the treatment effect depends on genotype, i.e., testing whethere the two conditional effects are different, is the same as testing for interaction.

There are more examples of this sort of analysis in Section 3.3 of the edgeR User's Guide:

Entering edit mode

Thank you very much for your detailed response Gordon! It has been most helpful.


Login before adding your answer.

Traffic: 551 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6