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:
Thank you very much for your detailed response Gordon! It has been most helpful.