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.