Hi, I am using DESeq2 with this model matrix (dput of the model matrix and DESeq2 command are pasted below). However, DESeq2 complains that some of the columns in the model matrix are linear combinations of each other (also see the error below). I am aware that this is an usual model matrix, but I don't see why I get this error. Thank you for your advice.
colData <- structure(list(s1 = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"), s2 = structure(c(1L,
2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L), .Label = c("0",
"1"), class = "factor"), s3 = structure(c(1L, 1L, 2L, 1L, 1L,
1L, 1L, 1L, 2L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"),
s4 = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L,
1L, 1L), .Label = c("0", "1"), class = "factor"), s5 = structure(c(1L,
1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("0",
"1"), class = "factor"), s6 = structure(c(1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L), .Label = c("0", "1"), class = "factor"),
condition = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L), .Label = c("0", "1"), class = "factor"), var = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0",
"1"), class = "factor")), class = "data.frame", row.names = c("s1_a",
"s2_a", "s3_a", "s4_a", "s5_a", "s6_a", "s1_b", "s2_b", "s3_b",
"s4_b", "s5_b", "s6_b"))
dds <- DESeqDataSetFromMatrix(countData = count_input,
colData = colData,
design = ~ s1 + s2 + s3 + s4 + s5 + s6 + condition + var)
Error in checkFullRank(modelMatrix) : the model matrix is not full rank, so the model cannot be fit as specified. One or more variables or interaction terms in the design formula are linear combinations of the others and must be removed.
Please read the vignette section 'Model matrix not full rank':
vignette('DESeq2')