Hi, I have used edgeR for single factor and two factor experiments, but I am confused with 3 factor experiments. my code looks like below:
treat=c(rep("treated",12), rep("untreated",12))
subjects=factor(c(rep(1:12), rep(1:12)))
design <- model.matrix(~subjects+treat+W_1, data=pData(set2))
design <- model.matrix(~subjects+treat+W_1, data=pData(set2))
y <- DGEList(counts=counts(set), group=treat)
y <- calcNormFactors(y, method="upperquartile")
y <- estimateGLMCommonDisp(y, design)
y <- estimateGLMTagwiseDisp(y, design)
fit <- glmFit(y, design)
lrt <- glmLRT(fit, coef=?)
I would like to look for DE genes between "treated" vs "untreated". The W_1 comes from RUVSeq. So what would be my coef here ? as I have 12 subjects, my treatment becomes coef 13 ? or I could simply make my design as
design <- model.matrix(~subjects+W_1+treat, data=pData(set2))
so that by default, the last factor will be considered.
Thanks in advance.
Thank you very much.