Entering edit mode
Hi all,
I am doing a methylome-wide association analysis using dmpFinder function from Minfi package. I noticed that dmpFinder is a wrapper of lmFit:
# Part of dmpFinder source code from https://github.com/hansenlab/minfi/blob/master/R/dmpFinder.R
dmpFinder <- function(dat, pheno, type = c("categorical", "continuous"),
qCutoff = 1, shrinkVar = FALSE) {
...
M <- dat
design <- model.matrix(~pheno)
fit <- lmFit(M, design)
...}
I am wondering if it is possible to do the association analysis in a mixed model approach, e.g. using "chip" as a random effect. The way I am thinking is incorporating duplicateCorrelation function into the dmpFinder as following:
dmpFinder_lmm <- function(dat, metadata,form,
qCutoff = 1) {
...
M <- dat
design <- model.matrix(form,metadata)
dupcor <- duplicateCorrelation(M,design,block=metadata$chip)
fit <- lmFit(M, design, block=metadata$chip, correlation=dupcor$consensus)
...}
Is it an appropriate way? Or is there any other R package that can do the similar analysis?
Thank you!