What does removing a batch effect (e.g. with limma::removeBatchEffect) assume about the batch effect?

Does it assume simply a constant batch effect for each level? E.g. if the levels are


Then one constant will be subtracted from all samples on Date3, another constant from all samples of Date2 and so on?

Or is it more complicated?


1 Answer 1


You're basically subtracting a constant per-gene per-level. The relevant portion of the code is:

fit <- lmFit(x,cbind(design,X.batch),...)
beta <- fit$coefficients[,-(1:ncol(design)),drop=FALSE]
beta[is.na(beta)] <- 0
as.matrix(x) - beta %*% t(X.batch)

where x is your input matrix, design is the design matrix and X.batch is the matrix of batch and covariates. So you're fitting your data with the combined batch/design matrix (line 1), extracting out the batch coefficients (line 2), and subtracting out the expected effect (line 4). This is simple enough and remarkably effective for its intended use. You can get a bit fancier by using PCA or something else to instead allow individual samples to be more/less affected by a batch-effect, but added complexity has its own issues.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.