Implementation of the ComBat Family of harmonization methods allowing for flexible covariate modeling and alternative estimators for site effect adjustment. Support for modeling of both location and scale via GAMLSS and longitudinal harmonization via mixed effects models.
comfam(
data,
bat,
covar = NULL,
model = lm,
formula = NULL,
eb = TRUE,
robust.LS = FALSE,
ref.batch = NULL,
...
)
comfam
returns a list containing the following components:
Harmonized data as a matrix with same dimensions as data
Batch information, including reference batch if specified
List of model fits from regression step, outputs of model
for each feature
List of estimates from standardization and batch effect correction
n x p data frame or matrix of observations where p is the number of features and n is the number of subjects.
Factor indicating batch (often equivalent to site or scanner)
Data frame or matrix of covariates supplied to model
Model function. ComBat Family supports any models that take
arguments formula
and data
, but are limited to models fitting with
identity link (e.g. family = gaussian(link = "identity")
). This includes
lm, gam, gamlss,
rq, lmer, and more
Formula for model
starting with y ~
where y
represents
each feature
If TRUE
, uses ComBat model with empirical Bayes for mean
and variance harmonization
If TRUE
, uses robust location and scale estimators
for error variance and site effect parameters. Currently uses median and
biweight midvariance
Reference batch, must take value in levels(bat)
Additional arguments to model
predict.comfam for applying ComBat parameters for harmonization of new observations
comfam(iris[,1:2], iris$Species)
comfam(iris[,1:2], iris$Species, iris[3:4], lm, y ~ Petal.Length + Petal.Width)
Run the code above in your browser using DataLab