Hi all, I have a question about making contrasts using limma package. I want to look at the differences of 2 age groups in male and female respectively, so I have an interaction term in my model matrix, I am not sure whether my contrast matrix is correct or not (I don't have Female_AgeGroup1
and Male_AgeGroup1
columns in my design matrix), so not sure how to make contrast matrix for this analysis. The R codes were attached as follows, thank you so much!
design <- model.matrix(~ 0+FetalSex+FetalSex:AgeGroups+ArrayDateBatch)
colnames(design) <- c("Female", "Male", "Batch2", "Batch3", "Female_AgeGroup2", "Male_AgeGroup2")
contrastMatrix <- makeContrasts(M_F = Male-Female,
F_G2_G1 = Female_AgeGroup2 - (Female-Female_AgeGroup2),
M_G2_G1 = Male_AgeGroup2 - (Male-Male_AgeGroup2),
levels = design)
I will try to use four groups, thank you!