what is the meaning of covariates in ComBat
1
0
Entering edit mode
5.3 years ago
LJ ▴ 260

Can anyone tell me what the difference between the following code1 and code2 is?

code1:

 pheno<-read.table(file="pdata.txt",header=T,row.names=1)
    head(d)
         subgroups batch
    sample1   1     1
    sample2   1     1
    sample3   1     1
    sample4   4     1
    sample5   1     1
    sample6   4     1
    batch<-pheno$batch
    subgroups<-pheno$subgroups
modcombat1<-model.matrix(~1, data=pheno)
combat_mydata<-ComBat(dat=mydata, batch=batch, mod=modcombat1, par.prior=TRUE, prior.plots=FALSE)

code2:

 pheno<-read.table(file="pdata.txt",header=T,row.names=1)
        head(d)
             subgroups batch
        sample1   1     1
        sample2   1     1
        sample3   1     1
        sample4   4     1
        sample5   1     1
        sample6   4     1
        batch<-pheno$batch
        subgroups<-pheno$subgroups
    modcombat2<-model.matrix(~subgroups, data=pheno)
    combat_mydata<-ComBat(dat=mydata, batch=batch, mod=modcombat2, par.prior=TRUE, prior.plots=FALSE)

To put it simply,what is the difference in mod with or without the covariate level? What is the purpose of including covariates in the mode? And which one should i choose for only batch effects removal but biological variation from the subgroups retained? Many thanks.

R ComBat • 3.3k views
ADD COMMENT
0
Entering edit mode

Can you share your data matrix and genotype information ? I would like to run my code on your data.

ADD REPLY
0
Entering edit mode

Could you please share your code ?

ADD REPLY
0
Entering edit mode
5.3 years ago
LJ ▴ 260

nobody has an answer?

ADD COMMENT
1
Entering edit mode

I'm not an expert on ComBat, but neither code seems to make any sense. You only have one batch in both cases, so there is no batch effect to correct for. Using ComBat does not make any sense.

Now, I'm less sure about the correct code if you had put more than one batch. I think only the first code is correct. You would consider any differences between the subgroups to be due to biological differences, so there would be no need to adjust for them? Anyway, this is how I use ComBat to remove batch effect (obviously I have more than just one batch, as in this example). Someone smarter and more knowledgeable than me will probably come up with a better answer.

ADD REPLY

Login before adding your answer.

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