Combining control samples from 2 separate studies. Model matrix for batch effect?
1
0
Entering edit mode
4.2 years ago
tolgaturant ▴ 20

For a gene expression project using limma, I have 2 studies with control samples processed the same way but at different times. However, the treatment samples are coming from only one study. I did not want just pool the controls, instead wanted to add the controls with a batch variable. Is below model.matrix suitable for this purpose? I know that if treatments were available for both studies, it would be a standard model with a batch variable but I am confused for this case.

treat  study
1  control_4hr study2
2  control_4hr study2
3  control_4hr study2
4 treatment1_4hr study2
5 treatment1_4hr study2
6 treatment1_4hr study2
7  control_4hr study1
8  control_4hr study1
9  control_4hr study1


model1<-model.matrix(~comparison1$treat+comparison1$study)

    (Intercept) comparison1$treattreatment1 comparison1$studystudy2
1           1                             0                      1
2           1                             0                      1
3           1                             0                      1
4           1                             1                      1
5           1                             1                      1
6           1                             1                      1
7           1                             0                      0
8           1                             0                      0
9           1                             0                      0

Any insight would be appreciated.

gene expression model matrix limma batch effect R • 1.1k views
ADD COMMENT
2
Entering edit mode
4.2 years ago

Your proposed model matrix is correct. You might want to get in the habit of putting batch variable first in your models, since often plotting functions will use the last term in your model for coloring/plotting.

ADD COMMENT
0
Entering edit mode

Thank you for confirming. Could you suggest a reading that explains what the additional variables in the design are doing and when the model is not full-rank?

ADD REPLY

Login before adding your answer.

Traffic: 2626 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