I'm trying to compare multiple conditions on edgeR. I have looked up into previous posts and read through edgeR's user guide, yet still don't have a clear answer.
My question is whether we can combine subgroups as one group by design matrix on comparison.
For example, if I have 4 groups to compare, after normalization as below,
d <- DGEList(counts=count, lib.size=size, group=group)
d <- calcNormFactors(d, method="RLE")
d <- estimateDisp(d)
design <- model.matrix(~0+group, data=d$samples)
colnames(design) <- levels(d$samples$group)
fit <- glmQLFit(d, design)
I understand that if we want to compare group 2 vs group 1, the pipeline would be
group2vs1 <- makeContrasts(group2-group1, levels=design)
qlf.2vs1 <- glmQLFTest(fit, contrast=group2vs1)
In this case,
coef = (-1, 1, 0, 0)
How about if I want to compare group 1 vs the rest? Does the codes below do what is desired?
group1vsrest <- makeContrasts(group1-(group2+group3+group4)/3, levels=design)
which gives
coef = (-1, 0.333, 0.333, 0.333)
Or should I do without multiple by 1/3
group1vsrest <- makeContrasts(group1-(group2+group3+group4), levels=design)
which corresponds to
coef = (-1, 1, 1, 1)
I've read some lines on edgeR's user guide mentioning the former would compare group1 and the mean of group 2-4. Does the "mean" mean that we treat group2-4 as one group? Do I need to make another design variable attributing group1 and the rest separately into two categories to do this comparison?
I really appreciate your help.