This is a test version of Biostars. For the public version, visit https://www.biostars.org.
what is the meaning of covariates in ComBat

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

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

1 answer

nobody has an answer?

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.

Log in to answer this question.