View source: R/meancenteraddon.R
meancenteraddon | R Documentation |
Performs addon batch effect adjustment for mean-centering:
1) takes the output of meancenter
applied to a training
data set together with new batch data;
2) checks whether the training data was also adjusted using mean-centering and whether the same number of variables is present in training and new data;
3) performs mean-centering on the new batch data.
meancenteraddon(params, x, batch)
params |
object of class |
x |
matrix. The covariate matrix of the new data. Observations in rows, variables in columns. |
batch |
factor. Batch variable of the new data. Currently has to have levels: '1', '2', '3' and so on. |
The adjusted covariate matrix of the test data.
Because mean-centering is performed "batch by batch" the "addon procedure" for mean-centering consists of plain mean-centering on the new test batches.
Roman Hornung
Hornung, R., Boulesteix, A.-L., Causeur, D. (2016). Combining location-and-scale batch effect adjustment with data cleaning by latent factor adjustment. BMC Bioinformatics 17:27, <doi: 10.1186/s12859-015-0870-z>.
data(autism) trainind <- which(batch %in% c(1,2)) Xtrain <- X[trainind,] ytrain <- y[trainind] batchtrain <- factor(as.numeric(batch[trainind]), levels=c(1,2)) testind <- which(batch %in% c(3,4)) Xtest <- X[testind,] ytest <- y[testind] batchtest <- as.numeric(batch[testind]) batchtest[batchtest==3] <- 1 batchtest[batchtest==4] <- 2 batchtest <- factor(batchtest, levels=c(1,2)) params <- meancenter(x=Xtrain, batch=batchtrain) Xtestaddon <- meancenteraddon(params=params, x=Xtest, batch=batchtest)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.