我想比较 Q 方法和 L 方法,我考虑了 2 个不同的对比(最后),但我不确定哪个是正确的?
有 2 种不同的方法(Q 和 L),每种方法有 2 个生物复制(L4、L6-L8 和 Q3、Q5-Q7),每个生物复制有 2 个技术复制。如下:
设计
biological_replicate method
L4_rep1 L4 L
L4_rep2 L4 L
L6_L8_rep1 L6_L8 L
L6_L8_rep2 L6_L8 L
Q3_rep1 Q3 Q
Q3_rep2 Q3 Q
Q5_Q7_rep1 Q5_Q7 Q
Q5_Q7_rep2 Q5_Q7 Q
design$biological_replicate <- factor(design$biological_replicate, levels = c("L4","L6_L8", "Q3", "Q5_Q7"))
design$method <- factor(design$method, levels = c("L", "Q"))
Group <- factor(paste(design$biological_replicate,design$method,sep="."))
design<- cbind(design,Group)
biological_replicate method Group
L4_rep1 L4 L L4.L
L4_rep2 L4 L L4.L
L6_L8_rep1 L6_L8 L L6_L8.L
L6_L8_rep2 L6_L8 L L6_L8.L
Q3_rep1 Q3 Q Q3.Q
Q3_rep2 Q3 Q Q3.Q
Q5_Q7_rep1 Q5_Q7 Q Q5_Q7.Q
Q5_Q7_rep2 Q5_Q7 Q Q5_Q7.Q
design.matrix <- model.matrix(~0+Group,design)
colnames(design.matrix) <- levels(Group)
design.matrix
L4.L L6_L8.L Q3.Q Q5_Q7.Q
L4_rep1 1 0 0 0
L4_rep2 1 0 0 0
L6_L8_rep1 0 1 0 0
L6_L8_rep2 0 1 0 0
Q3_rep1 0 0 1 0
Q3_rep2 0 0 1 0
Q5_Q7_rep1 0 0 0 1
Q5_Q7_rep2 0 0 0 1
attr(,"assign")
[1] 1 1 1 1
attr(,"contrasts")
attr(,"contrasts")$Group
[1] "contr.treatment"
my.contrasts_1 <- makeContrasts(QvsL = (Q3.Q+Q5_Q7.Q)/2-(L4.L+L6_L8.L)/2, levels = design.matrix)
my.contrasts_2 <- makeContrasts(QvsL = (Q3.Q+Q5_Q7.Q)-(L4.L+L6_L8.L), levels = design.matrix)