tl;dr
why isn't fit <- eBayes(fit); topTable(fit, coef=4)
the same as fit <- contrasts.fit(fit, c(-1,0,0,1)); fit <- eBayes(fit); topTable(fit)
(column 1 of the design beeing the intercept)?
Example from the limma usersguide
Strain <- factor(targets$Strain, levels=c("WT","Mu"))
Treatment <- factor(targets$Treatment, levels=c("U","S"))
design <- model.matrix(~Strain+Strain:Treatment)
colnames(design)
[1] "(Intercept)" "StrainMu" "StrainWT:TreatmentS" "StrainMu:TreatmentS"
The first term in the model formula is an effect for Strain. This introduces an intercept column to the design matrix, which estimates the average log-expression level for wild-type unstimulated cells, and a column for Strain which estimates the mutant vs wildtype dierence in the unstimulated state. The second term in the model formula represents the interaction between stimulation and strain. [...] It introduces a third and a fourth column to the design matrix which represent the effect of stimulation for wild-type and for mutant mice respectively [...].
fit <- lmFit(eset, design)
fit <- eBayes(fit)
topTable(fit, coef=3)
# will find those genes responding to stimulation in wild-type mice, and
topTable(fit, coef=4)
# will find those genes responding to stimulation in mutant mice
What I don't understand
If using coef
is the same as looking at the difference between the 4th column of the design matrix and the intercept (i.e. the contrast between the fourth and first column), wouldn't we need to look at the contrast between the fourth and second column to get the genes responding to stimulation in mutant mice?
Of course I compared the results when using coef
and when using contrasts. They differ but I do not understand why... Obviously it means that coef=4
does not mean "look at the difference between column 4 and the intercept", but what does it mean then?
I hope that the question is understandable. Many thanks in advance!