Please help me build a design that accounts for both the matched case-control design (there were 1 case [disease=1] and 2 controls [disease=0] in each pair [having the same matchid], matched for age and gender) and the correlation between multiple measurements at different timepoints (time 1, 2, 3) in a given subject. My objective is to compare the microbial differential abundance between cases and controls over all timepoints (not treating each timepoint separately). Thanks a lot!
My dataset is as following:
personid | matchid | time | disease |
---|---|---|---|
1 | 1 | 1 | 1 |
1 | 1 | 2 | 1 |
1 | 1 | 3 | 1 |
2 | 1 | 1 | 0 |
2 | 1 | 2 | 0 |
2 | 1 | 3 | 0 |
3 | 1 | 1 | 0 |
3 | 1 | 2 | 0 |
3 | 1 | 3 | 0 |
4 | 2 | 1 | 1 |
4 | 2 | 2 | 1 |
4 | 2 | 3 | 1 |
5 | 2 | 1 | 0 |
5 | 2 | 2 | 0 |
5 | 2 | 3 | 0 |
6 | 2 | 1 | 0 |
6 | 2 | 2 | 0 |
6 | 2 | 3 | 0 |
7 | 3 | 1 | 1 |
7 | 3 | 2 | 1 |
7 | 3 | 3 | 1 |
8 | 3 | 1 | 0 |
8 | 3 | 2 | 0 |
8 | 3 | 3 | 0 |
9 | 3 | 1 | 0 |
9 | 3 | 2 | 0 |
9 | 3 | 3 | 0 |
Many thanks for your professional and quick reply. If I want to stick to DESeq2 and I only want to account for correlation between multiple measurements at different timepoints (time 1, 2, 3) in a given subject(ignoring the matching for the moment),how should I build the design.My objective is to compare the microbial differential abundance between cases and controls over all timepoints (not treating each timepoint separately).Thanks a lot!
You would use the strategy in the vignette for testing for condition effects within and across groups while controlling for individuals nested within groups.
Thanks Michael! Compared to limma, I am more familiar with edgeR. EdgeR can also compare the microbial differential abundance between cases and controls. Additionally, there are a lot of examples in the edgeRUsersGuide. If I use edgeR, is the design correct?
design <- model.matrix(~matchid+personid+disease+time+disease:time)
(There are paired examples and repeated measurement examples in the edgeRUsersGuide. However,in repeated measurement examples,repeated measurement at different timepoints were obtained from independent subjects. By contrast,in my study,repeated measurement at different timepoints were obtained from the same subjects.)
Please make a new post and tag the new packages you are asking about. I’m only aware of duplicateCorrelation in the limma package.
OK! Thanks!