View source: R/Harmonization.R
predict.comfam | R Documentation |
Using parameters estimated via comfam
, apply harmonization on new data.
predict.comfam
will estimate new batch adjustments if new batches are
specified. For batches with existing estimates, the estimates from object
are used. Harmonization targets are the same as object
(e.g. ref.batch
from object
if specified).
## S3 method for class 'comfam'
predict(
object,
newdata,
newbat,
newcovar = NULL,
robust.LS = FALSE,
eb = TRUE,
...
)
object |
Object of class |
newdata |
n x p data frame or matrix of new observations where
p is the number of features and n is the number of subjects.
The features must match the original |
newbat |
Factor indicating new batch (often equivalent to site or scanner) |
newcovar |
Data frame or matrix of new covariates supplied to |
robust.LS |
If |
eb |
If |
... |
Additional arguments to |
Note: The function currently does not support models of class lmer
(e.g., from lmer).
predict.comfam
returns a list containing the following components:
dat.combat |
New harmonized data as a matrix with same dimensions as |
batch.info |
New batch information, including reference batch if specified |
fits |
List of model fits from regression step, forwarded from |
estimates |
List of estimates from standardization and batch effect correction, including new batches if relevant |
com_out <- comfam(iris[1:75,1:2], iris$Species[1:75])
# out-of-sample with new batch
out_pred <- predict(com_out, iris[76:150,1:2], iris$Species[76:150])
# in-sample
in_pred <- predict(com_out, iris[1:25,1:2], iris$Species[1:25])
max(in_pred$dat.combat - com_out$dat.combat[1:25,])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.