ComBat with repeated measures
0
0
Entering edit mode
s20 • 0
@a673a399
Last seen 6 hours ago
US

I'd like to use ComBat() from the sva library for batch effect correction. Let's say I have this data frame:

gene_data <- data.frame(
  Gene1 = c(5.2, 5.5, 6.1, 6.4, 5.0, 5.3, 6.0, 6.2),
  Gene2 = c(4.8, 4.7, 5.5, 5.8, 4.9, 5.0, 5.6, 5.7),
  Gene3 = c(7.1, 6.8, 7.5, 7.9, 7.3, 7.0, 7.6, 7.8),
  Gene4 = c(8.2, 8.1, 8.4, 8.7, 8.3, 8.2, 8.5, 8.6),
  Gene5 = c(6.0, 6.3, 6.6, 6.7, 6.1, 6.2, 6.7, 6.8)
)

batch <- factor(c(1, 1, 2, 2, 1, 1, 2, 2))
subjects <- factor(rep(1:4, each = 2))  # 4 subjects, with 2 conditions each
conditions <- factor(rep(c("A", "B"), times = 4))  # Two conditions (A and B) per subject

If I understood correctly, ComBat works for independent observations, but in this case, I have a repeated measures factor.

Will I still be able to use ComBat? For example, is this statistically valid?

gene_matrix <- as.matrix(gene_data)
mod <- model.matrix(~ conditions + subjects)
combat_corrected <- ComBat(dat = gene_matrix, batch = batch, mod = mod)

Thank you!

ComBat sva • 705 views
ADD COMMENT
1
Entering edit mode

It looks to me that you do not need the batch information since subject is nested with batch so correcting for subject will do a paired analysis (which is within batch). In your linear model, or whatever you use, simply do ~subjects+conditions.

ADD REPLY

Login before adding your answer.

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