I have read around and cannot find a similar example to this particular case and I'm still not clear so I apologise if this is a trivial question.
I have data for an experiment which consisted of two diseases and a control group. The disease groups (C1, C2) consists of those which have been treated and those which have not been treated (C1_treat, C1_ntreat). The treated and untreated groups are paired so the sample for treated comes from treated tissue, and the ntreat sample comes from the untreated tissue from the same patient. There are also two control samples from each patient and I should control for this.
An example of the sample data looks like this:
Group |
Gender |
Hospital |
Patient |
C2_treat |
F |
1 |
5 |
C2_ntreat |
F |
1 |
5 |
C2_treat |
M |
2 |
6 |
C2_ntreat |
M |
2 |
6 |
CTRL |
M |
1 |
1 |
CTRL |
M |
1 |
1 |
CTRL |
F |
2 |
2 |
CTRL |
F |
2 |
2 |
C1_treat |
M |
1 |
3 |
C1_ntreat |
M |
1 |
3 |
C1_treat |
M |
2 |
4 |
C1_ntreat |
M |
2 |
4 |
I want to perform the following contrasts: C1_treat–CTRL, C1_ntreat – CTRL, C1_treat – C1_ntreat and the same for the C2 group.
The samples come from 3 sampling hospitals, and there appears to be a gender effect (Xist and amongst others in the top DEGs) so I want to control for these factors also. There are several samples which do not have a paired sample so I cannot model patient as a fixed effect as the design matrix is not of full rank. I am currently modelling gender and Hospital using a fixed effect and Patient as a random effect using this model:
design <- model.matrix(~0 + f + Gender + Hospital) corfit_main <- duplicateCorrelation(affyTable, design, block = Patient) fit <- lmFit(affyDat, design,block = Patient, correlation = corfit_main$consensus)
The results are as expected I am just unsure of what duplicateCorrelation is doing here. Is the assumption that the intra-patient correlation is the same for all pairs? Is this assumption valid given that some of the pairs are within control samples, and the other pairs are between treated and untreated patients?
Thanks.