R, limma: make contrasts when there is an interaction term in design matrix
1
0
Entering edit mode
Qianhui ▴ 10
@qianhui-16128
Last seen 4.0 years ago
Australia

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)

limma • 1.3k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States

You would be much better off to generate four groups, one for each sex/age group and then make whatever contrasts you want, rather than trying to figure out what your existing coefficients are.

ADD COMMENT
0
Entering edit mode

I will try to use four groups, thank you!

ADD REPLY

Login before adding your answer.

Traffic: 390 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6