我的数据设计矩阵如下所示。我运行命令来分析和比较不同的组,但得到错误。
我想进行这些比较: L4vsL6.L8, Q3vsQ5.Q7,QvsL
设计矩阵:
design
organoids_biological_samples method
L4_D49_rep_1 L4 L
L4_D49_rep_2 L4 L
L6_L8_D49_rep_1 L6_L8 L
L6_L8_D49_rep_2 L6_L8 L
Q3_D49_rep_1 Q3 Q
Q3_D49_rep_2 Q3 Q
Q5_Q7_D49_rep_1 Q5_Q7 Q
Q5_Q7_D49_rep_2 Q5_Q7 Q
design$organoids_biological_samples <- factor(design$organoids_biological_samples, levels = c("L4","L6_L8", "Q3", "Q5_Q7"))
design$method <- factor(design$method, levels = c("L", "Q"))
all(rownames(design) %in% colnames(data))
all(rownames(design) == colnames(data))
Group <- factor(paste(design$organoids_biological_samples,design$method,sep="."))
design<- cbind(design,Group)
design.matrix <- model.matrix(~0+Group+method,design)
colnames(design.matrix) <- c("L4.L", "L6_L8.L", "Q3.Q", "Q5_Q7.Q", "method")
design.matrix
L4.L L6_L8.L Q3.Q Q5_Q7.Q method
L4_D49_rep_1 1 0 0 0 0
L4_D49_rep_2 1 0 0 0 0
L6_L8_D49_rep_1 0 1 0 0 0
L6_L8_D49_rep_2 0 1 0 0 0
Q3_D49_rep_1 0 0 1 0 1
Q3_D49_rep_2 0 0 1 0 1
Q5_Q7_D49_rep_1 0 0 0 1 1
Q5_Q7_D49_rep_2 0 0 0 1 1
attr(,"assign")
[1] 1 1 1 1 2
attr(,"contrasts")
attr(,"contrasts")$Group
[1] "contr.treatment"
attr(,"contrasts")$method
[1] "contr.treatment"
edgeR.dgelist = DGEList(counts = data,group = Group)
edgeR.dgelist = calcNormFactors(edgeR.dgelist,method = "TMM")
CommonDisp <- estimateGLMCommonDisp(edgeR.dgelist, design.matrix)
Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset, :
Design matrix not of full rank. The following coefficients not estimable:
method
答案 0 :(得分:1)
您的数据中存在严格的线性依赖:
Q3.Q + Q5_Q7.Q = method
。
因此,您的模型无法为这些列找到唯一系数
如果B1, B2, B3
是最佳系数集,那么对于任何实数B1-x, B2-x, B3-x
,x
都是Text Qualifier
。
在数值上,您的程序无法反转矩阵以找到最佳系数。 考虑测试是否更好地在模型中包含Q3.Q和Q5_Q7.Q或仅包含方法。