Learn R Programming

bapred (version 1.1)

nobaaddon: No addon batch effect adjustment

Description

This function is merely included for consistency. It does the following: 1) takes the output of noba applied to a training data set together with new batch data; 2) checks whether the training data has also not been adjusted using a batch effect adjustment method and whether the same number of variables is present in training and new data; 3) returns the new batch data not adjusted for batch effects.

Usage

nobaaddon(params, x, batch)

Arguments

params

object of class noba.

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.

Value

The unadjusted covariate matrix x of the test data.

References

Hornung, R., Causeur, D., Bernau, C., Boulesteix, A.-L. (2017). Improving cross-study prediction through addon batch effect adjustment and addon normalization. Bioinformatics 33(3):397<U+2013>404, <10.1093/bioinformatics/btw650>.

Examples

Run this code
# NOT RUN {
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 <- noba(x=Xtrain, batch=batchtrain)

Xtestaddon <- nobaaddon(params=params, x=Xtest, batch=batchtest)


all(as.vector(Xtestaddon)==as.vector(Xtest))
# }

Run the code above in your browser using DataLab