# Assumptions of batch effect removal

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

Date1
Date2
Date3


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?

fit <- lmFit(x,cbind(design,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.