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.
Can you share your data matrix and genotype information ? I would like to run my code on your data.
Could you please share your code ?