Hello everyone,
I'm working with some DNA methylation data and would like to use either Jaffe et al.'s bumphunter algorithm as implemented in the minfi package or the DMRcate package to identify differentially methylated regions. My study is a bit more complex as I have repeated measures (two time points) and therefore am running into some trouble specifying a design matrix. I would like to use a linear mixed effect model (lmer) to account for the repeated measures. Does anyone have experience with this? Any guidance would be much appreciated!
I would like to specify my design matrix to look something like this...
design<-lmer(cpg_mval~case_status+age+sex+cell_composition+smoking+meds+(1|id), data=data)
Sincerely,
Ash
Dear James,
Thank you very much for the clear explanation. I am wondering if you could help me resolve my confusion with a similar matter. I am doing a longitudinal study with repeated measures at three time points. We are studying methylation changes during the course of malaria infection and after treatment in the host. We have three repeated measures at three time points for each individual (before infection T1, after infection T2, and after treatment T3). My initial plan was to treat individual as a "random effect" in a mixed-model, after coming across your post along with reading section 3.5.2 on "Blocking" at the edgeR User's I decided to block on the "individual" in my model. However, after reading a bit in the literature I got more confused and I am wondering if its actually the right thing to do given that I have three repeated measures.
So my question, Can I still block "individual" in my model given that we have 3 repeated measures?
I have provided the script that I used for you just in case you needed to have a look on what I did:
Age <- pData(New.gset.funnorm.addsnp)$Age Individual <- pData(New.gset.funnorm.addsnp)$Individual InfectionStatus <- pData(New.gset.funnorm.addsnp)$InfectionStatus Sex <- pData(New.gset.funnorm.addsnp)$Sex
biolrep<-Individual
designMatrix.snp1 <- model.matrix(~Infection_Status+Age+Sex)
corfit1 <- duplicateCorrelation(myMs, design=designMatrix.snp1, block = biolrep) dmrCate.snp1<-cpg.annotate("array", myMs, what="Beta", arraytype = "EPIC", analysis.type="differential", design=designMatrix.snp1, coef=2, block=biolrep, correlation=corfit1$consensus.correlation,fdr=0.05) dmrcoutputall.snp1 <- dmrcate(dmrCate.snp1,lambda=500, C=5, pcutoff="fdr",min.cpgs=3,mc.cores=1) wgbs.rangesall.snp1 <- extractRanges(dmrcoutputall.snp1, genome = "hg19") write.csv (wgbs.rangesall.snp1,file="DMRCateModel1DifferentailRange.txt")
Thanks a lot for your time
Dareen